FER24,
The thing about transistors is they turn on, pass current between collector and emitter, when the voltage between the emitter and base connections gets much above 0.6 volts for silicon (0.3 volts for geranium) transistors. It's current flow in the base/emitter circuit that does the job and should always be limited to below what that junction allows. Hence the series resistor.
In your circuit using a PNP transistor emitter at +5v and even if the GPIO pin is expressing a logic one as +3.3v you've still got a 1.7v voltage source able to drive (pull) current into/(from) the base circuit thus turning it on. Pushing a logic zero out of the GPIO pin will only serve to turn the transistor on even more.
Yes you can fiddle with the base series resistor to make it work but you'll never quite turn the transistor off without getting clever with more components.
You need an NPN transistor with its emitter connected to the Pi zero volts to switch your load and with a series resistor to limit the current from the 3.3v GPIO drive.
The LED in the collector circuit will have a maximum safe working current so must have a series resistor to prevent its destruction when the transistor turns on. You really do need one and its an Ohms law thing.
You work out the transistor's series base resistor using Ohms law on the basis ( 3.3v minus the O.6v base/emitter voltage ) divided by the current needed to reliably turn on the transistor. Similar for the laser LED, 5volts minus the minimum voltage before it'll conduct divided by the required current needed to work correctly
A final useful point is to add a highish value resistor across the base/emitter to keep the transistor off during power up/down when the GPIO's are in their undefined Tri-state mode. Between 5k and 10k should do it, maybe add a little extra current when calculating the emitter resistor.
Think I got my Ohms Law correct but check any way, its been a while.
(27)
The thing about transistors is they turn on, pass current between collector and emitter, when the voltage between the emitter and base connections gets much above 0.6 volts for silicon (0.3 volts for geranium) transistors. It's current flow in the base/emitter circuit that does the job and should always be limited to below what that junction allows. Hence the series resistor.
In your circuit using a PNP transistor emitter at +5v and even if the GPIO pin is expressing a logic one as +3.3v you've still got a 1.7v voltage source able to drive (pull) current into/(from) the base circuit thus turning it on. Pushing a logic zero out of the GPIO pin will only serve to turn the transistor on even more.
Yes you can fiddle with the base series resistor to make it work but you'll never quite turn the transistor off without getting clever with more components.
You need an NPN transistor with its emitter connected to the Pi zero volts to switch your load and with a series resistor to limit the current from the 3.3v GPIO drive.
The LED in the collector circuit will have a maximum safe working current so must have a series resistor to prevent its destruction when the transistor turns on. You really do need one and its an Ohms law thing.
You work out the transistor's series base resistor using Ohms law on the basis ( 3.3v minus the O.6v base/emitter voltage ) divided by the current needed to reliably turn on the transistor. Similar for the laser LED, 5volts minus the minimum voltage before it'll conduct divided by the required current needed to work correctly
A final useful point is to add a highish value resistor across the base/emitter to keep the transistor off during power up/down when the GPIO's are in their undefined Tri-state mode. Between 5k and 10k should do it, maybe add a little extra current when calculating the emitter resistor.
Think I got my Ohms Law correct but check any way, its been a while.
(27)
Statistics: Posted by RaspISteve — Sun Jul 07, 2024 4:07 pm