I was having some troubles using a NPN transistor controlling a 12V relay. I connected my circuit as in Figure A:
V+ is 12V and the input to the base of the transistor is 5V or 0V (using an Atmel Microcontroller). The resistor from the microcontroller output to the base of the transistor is 1k ohms. The transistor has an hfe value of 200.
Everything works fine when I try to switch the relay on, I apply 5V to the base of the transistor and I measure 12V across the inductive load of the relay. My problem occurs when I try to turn the relay off. I apply a 0V signal to the base of the transistor and I measure about 3.8V across the inductive load of the relay. The relay says it needs .25V to switch off, so 3.8V is way too much.
Does anyone know how to make it so when I apply a 5V signal, the relay gets 12V and when I apply a 0V signal the relay gets below .25V? Any help would be greatly appreciated!
(I'm making a motion sensor lamp that will only turn on when it's dark. It almost works, it just doesn't turn off!)