Can You Explain...

Capture.PNG (16.16 KiB) Viewed 152 times

Here is two different versions of a circuit, using Adafruit's lit arcade buttons (the Red or Yellow, 3489/3490 respectively) - the resistor and LEDs are accurate to the circuit internal to the switches as of the time of ordering (2018)

I'm wondering why Circuit A works, while Circuit B fails... can someone explain?

bkeyport

Posts: 15
Joined: Sat Nov 10, 2018 10:54 pm

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

Posts: 81583
Joined: Sat Feb 07, 2009 10:11 am

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...

westfw

Posts: 1781
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

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.

jps2000

Posts: 639
Joined: Fri Jun 02, 2017 4:12 pm