greets
I want to make a simple inverter for a LED, i.e. to have the LED off when the switch S1 is engaged.
Would this work? (I don't have any pnp transistors at the moment so I can't test it).
greets
I want to make a simple inverter for a LED, i.e. to have the LED off when the switch S1 is engaged.
Would this work? (I don't have any pnp transistors at the moment so I can't test it).
No, it won't work. When the switch is open the transistor base is floating.
You need to connect R1 between Vcc and the base of the transistor (normally on) and connect the switch between the base of the transistor and ground (when you press the switch the transistor base goes to ground).
You also need to put R2 and the LED above the transistor. Transistor emittors need to be at ground level.
PNPs like to source current, so the LED and R2 are in the correct place.
Add another resistor from the junction of R1/PNP base to pull the base high to turn the PNP off. R1 then limits the current out of the base so the PNP does not burn up.
you could always leave the transistor out. Just put a resistor and LED in series with the battery and wire the switch across the LED....
Or put the switch in series with the LED, only have current flow when switch is closed for longer battery life.
CrossRoads:
PNPs like to source current, so the LED and R2 are in the correct place.
Oh, "PNP"...brain fart.
Yeah but then the LED wouldn't be off when the switch is "engaged"
The PNP approach is fine with the added pullup resistor.
(or use a normally closed switch instead of normally open)
thanks for the help guys
here's what I got now:
RoyK:
you could always leave the transistor out. Just put a resistor and LED in series with the battery and wire the switch across the LED....
in this case yes, it would be a simpler solution. But I want to learn how to invert a signal without using an inverter IC. I do have some of them but they are overkill if you just need to invert one signal.
Ok, this discussion became a little mixed up with use of PNP and switch to turn Off vs turn on.
Here's what's needed. R1, R2 are used to turn the transistors on.
Switch is used to turn transistors off.
@CrossRoads cool, thanks!
I see, I confounded a PNP with a NPN transistor.
p.s. What program do you use to draw circuits?
I use expresspcb for quick diagrams to post here.
I use Eagle for PCB design.
naut:
thanks for the help guyshere's what I got now:
You need the resistor to ground and the switch to Vcc if using a PNP