Can You Explain...
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- bkeyport
- Posts: 21
- Joined: Sat Nov 10, 2018 10:54 pm
Can You Explain...
I'm wondering why Circuit A works, while Circuit B fails... can someone explain?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Can You Explain...
The PN2222 is an NPN transistor and generally works best in 'low-side' switching applications. To switch from the high-side a PNP is used.
https://www.baldengineer.com/low-side-v ... witch.html
https://www.baldengineer.com/low-side-v ... witch.html
- westfw
- Posts: 2008
- Joined: Fri Apr 27, 2007 1:01 pm
Re: Can You Explain...
Circuit A should have a base resistor...
The base current in B is (Vio-(Vled*2+Vbe))/200, potentially quite small or zero...
The base current in B is (Vio-(Vled*2+Vbe))/200, potentially quite small or zero...
- jps2000
- Posts: 811
- Joined: Fri Jun 02, 2017 4:12 pm
Re: Can You Explain...
A transistor switches only if the voltage between base and emitter is above about 0.65 V and a small current can flow.
The upper schematic is wired as an emitter follower. so the voltage of the base has to exceed 0.65V + 2x Uf of the diodes + the diode current * 200 ohms.
UF in red led is about 1.4V. assuming 10mA current gives 0.2V. So it may work when the GPIO is from a 5V controller. It will not work with a 3v3 controller and green or white LEDs. ( UF is the forward voltage). This circuit does not need a base resistor but it will not hurt.
The lower schematic shows a transistor switch. A base resistor (10-100k) is mandatory. Without the latter it draws high (rather undefined currents from the GPIO pin. In on the collector voltage is just some hundred millivolts. It is called open colletor switch. It has the advantage to switch voltages even higher than the controller supply and it allows the controller to be supplied when the LED supply is off.
So always consider npn or nmos open collector / open drain circuit as driver. In case you have to switch from VCC side then use 2 transistors ( NPN + PNP) instead
Actually it is good custom to draw a schematic such that ground points down and supply voltages point up. This eases understanding.
The upper schematic is wired as an emitter follower. so the voltage of the base has to exceed 0.65V + 2x Uf of the diodes + the diode current * 200 ohms.
UF in red led is about 1.4V. assuming 10mA current gives 0.2V. So it may work when the GPIO is from a 5V controller. It will not work with a 3v3 controller and green or white LEDs. ( UF is the forward voltage). This circuit does not need a base resistor but it will not hurt.
The lower schematic shows a transistor switch. A base resistor (10-100k) is mandatory. Without the latter it draws high (rather undefined currents from the GPIO pin. In on the collector voltage is just some hundred millivolts. It is called open colletor switch. It has the advantage to switch voltages even higher than the controller supply and it allows the controller to be supplied when the LED supply is off.
So always consider npn or nmos open collector / open drain circuit as driver. In case you have to switch from VCC side then use 2 transistors ( NPN + PNP) instead
Actually it is good custom to draw a schematic such that ground points down and supply voltages point up. This eases understanding.
Please be positive and constructive with your questions and comments.