David VanHorn wrote: > >The RB4 pin is used to drive the base of a PN2222 transistor through a 2.2k > >ohm resistor. The emitter is grounded and the collector is connected > through > >a 220 ohm resistor. Output is taken from the collector. > > Check the output pin spec, you'll find that the maximum low voltage is high > enough to keep the base of an NPN active. Add an additional resistor from > the base to ground, probably 2.2k or 4.7k, and the problem will dissapear. > > This has to be about the most common uC mistake. :) Low isn't Zero! > That transistor only needs a couple microamps through the base to stay on. > Also, once they heat up from being on, their own leakage and gain goes up! Not just a problem for uC's. This is a common problem ESPECIALLY if one puts a cap from base to ground thinking that it will help reduce noise from tripping the transistor (but you didn't say you were useing a cap). Another thing you can do (depending on your application) is to put a diode from the emitter to ground. It raises the .7V trip point of the base up to 1.4V. However, the collector will now only go down to .7V (the voltage drop of the emitter to ground diode) I also will use a 2N7000 (a common FET) that trips somewhere around 2 volts at times.