> I would like to give an open drain output from a circuit (RA4 not > available). > The circuit works with 3V or 3.6V which transistor do I choose and what > resistors should I use (or how do I calculate which resistor to use > given the 3V input voltage) I probably can use BD138 but I don't know > how to connect it to my circuit and the resistor values. You first start with the maximum current the transistor must sink, and the maximum voltage it must withstand when off. Your schematic shows this as 110mA and 30V. Just about any small signal transistor can do this. Note that it needs to be an NPN, not PNP as shown in your schematic. I use 2N4401 for such things in one-off situations, but there are many alternatives. Figure most of these transistors will have a gain of around 100, so the minimum base current needs to be 110mA/100 = 1.1mA. That's right at the edge, so I'd want the circuit to drive the base with at least 2mA, but I'd feel better with 3mA unless current drain of the PIC circuit is an issue. The lowest PIC voltage is 3.0V according to your spec, and figure the B-E junction will drop another 700mV worst case. That leaves at least 2.3V accross the base resistor. 2.3V / 3mA = 767ohms, so R1 should be in the 750ohm to 820ohm range. You don't need R2 at all since the PIC output actively drives low. You don't need R3 either if the load itself will guarantee not to source more than 110mA (unless R3 is the load). If the load is inductive, you will need a diode from the collector to the 30V supply, else the collector voltage will spike very high and destroy the transistor when it is turned off. It's always a good idea to check power dissipation too. The transistor will be saturated, so figure it will drop 200mV when on. 200mV x 110mA = 22mW, no problem. Even if it dropped 500mV, that would still be only 55mW, again no problem. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics