At 09:58 AM 2/11/01 -0500, Byron A Jeff wrote: >I've found that lately that using transistors for interfacing is critical. >In the past I've used optoisolators and open collector IC's for higher >voltage interfaces. But it's clear that understanding how plain old NPN >transistors do their work is important. > >So today's question is how to use an NPN transistor to switch 24V >(arbitrarily picked) with a PIC output pin. From what I've read if you >do the standard: > > +24 > | > Load > | > C > / >PIC-R--B > \ > E > | > GND > >Then the transisor won't be saturated because the 5V output from the PIC >isn't high enough relative to the collector voltage. Nope - circuit is OK, text under the circuit is wrong. Here is an easy way to look at the circuit above. You have to consider the voltage between the Base and Emitter terminals of the transistor. The emitter - base junction looks like a diode, with anode at B and cathode at E. In order to make the transistor conduct, you have to feed CURRENT into the B-E junction. If the applied voltage is less than 1 diode drop (0.65V), no base current flows and the transistor is OFF. As the applied voltage is increased, the voltage at the B-E junction is clamped at 1 diode drop and base current is determined by (voltage at PIC pin) - (voltage at B-E junction) all divided by the value of the series base resistor. Lets pick some real world numbers. Vbe is ~0.65Vdc. Vpic_pin is 5V. Resistor is 1k. Base current is (5-0.65) / 1000 or about 4.35 mA. The MAXIMUM collector current that can flow through the Collector is the base current X Hfe. If the actual collector current being sunk by the transistor above is LESS than the maximum possible current, the transistor is saturated. Note that Hfe varies as Ic varies - if you want to saturate a transistor with a fairly high collector current, you really have to look at the Hfe curves for that transistor to determine the minimum gain at that current and work backwards to find the minimum required base current. But for small transistors like the 2n4401 and 2n4403, you can assume Hfe is greater than 100 when Ic is less than 100 mA with no problems. If you want to ensure that the transistor is well into saturation, aim for a base current of 2X the minimum calculated base current. So - the above circuit driving a 100 mA load with a base current of 4.35 mA is well saturated. You could increase the base resistor to 2k2 and still be in saturation. dwayne Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 17 years of Engineering Innovation (1984 - 2001) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads