Can You Explain...

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bkeyport
 
Posts: 21
Joined: Sat Nov 10, 2018 10:54 pm

Can You Explain...

Post by bkeyport »

Capture.PNG
Capture.PNG (16.16 KiB) Viewed 170 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?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Can You Explain...

Post by adafruit_support_bill »

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

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Can You Explain...

Post by westfw »

Circuit A should have a base resistor...

The base current in B is (Vio-(Vled*2+Vbe))/200, potentially quite small or zero...

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: Can You Explain...

Post by jps2000 »

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”