Go Down

Topic: 3x3 LED grid using NPN transistors to switch (Read 1 time) previous topic - next topic

CatsLoveJazz

I am trying to design a basic project to multiplex a 3x3 LED grid in a common anode arrangement. In order to avoid sinking (sourcing?) too much current from the digital I/O pins I would like to uses NPN transistors as a low-side switch for each column.

I understand the case where I use a transistor to switch a single LED with the anode connected to Vs. However, I am having difficulty in designing the circuit for the multiplexed approach.

As my circuit stand I can't understand how to to wire it to source current from Vs and using I/O to control the flow.


Thanks

Grumpy_Mike

#1
Aug 01, 2016, 11:08 pm Last Edit: Aug 01, 2016, 11:10 pm by Grumpy_Mike
Your circuit as it stands is less than perfect:-


The problem is that you can still draw too much current on the rows. Move the resistors from the collector of the transistors and put them in the lead from the Arduino to the anodes. Then put the walking one on the column with the display data on the row.

CatsLoveJazz

#2
Aug 01, 2016, 11:32 pm Last Edit: Aug 01, 2016, 11:38 pm by CatsLoveJazz
I'm not sure I understand what you mean by "the walking one".

Can you explain why the resistor on the anode side means I will draw less current on the rows, would the resistor in series with the LED not limit the current either way?

How might I design the circuit such that the I/O pins are used only to control the LEDs but the current source is Vs (5 or 3.3V)?

Please forgive me as I am a programmer and new to the world on electronics.


Grumpy_Mike

Quote
I'm not sure I understand what you mean by "the walking one"
See
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

Quote
Can you explain why the resistor on the anode side means I will draw less current on the rows, would the resistor in series with the LED not limit the current either way?
Because the way you had it the two choices of multiplexing (see above link ) you have would have resulted in either the rows supplying the current for three LEDs or the columns having one, two or three LEDs with current limited by just one resistor.

CatsLoveJazz

Thank Mike, I intend to scan the matrix row by row so I believe my placement of the resistor on the cathode was correct.

I think this was the solution I was aiming for (not including the LED resistor), using I/O pins to control the logic with all current (-Ibase) being sourced from the main Vs.



I also plan to investigate LED driver chips such as MAX7219 although I will try to construct the above circuit first as I have the parts.

Grumpy_Mike

There is only the need for one lot of current drivers either column or row not both.
If you have them in the row lines then there is no need for them in the columns because they will never be sinking more than one LED at a time. But the resistors should still be in the columns.

CrossRoads

#6
Aug 02, 2016, 05:51 pm Last Edit: Aug 02, 2016, 05:51 pm by CrossRoads
This is the electrical equivalent for a 4x4x4 cube.
The anodes are driven from Arduino outputs, the transistors are used to turn on one layer at a time.
Thus only one current limit per anode column is needed, the transistor is rated to sink 16 LEDs worth of current.
16 * .02A = 320mA.

If you desire to have external PNP transistors sourcing current vs Arduino IO pins, the design still stands.
A 2nd resistor is then needed between Arduino and PNP base, with a low from Arduino turning on the PNPs and a high from Arduino turning on the NPN of the active row.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

Your design in Reply 4 has no current limit resistors, which is not good.
When the PNPs turn on, they will have ~ 0.7V Vce. When the NPN turns on, it will have similar.
So you have (5V - .7V - .7V) = 3.6V, enough to turn the LED full on with nothing to limit current flow, so the LED eventually burns up.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CatsLoveJazz

Thank you, that circuit diagram is very useful indeed.

I have arranged my circuit so that the columns are being switched via NPN on the low side and each row LED is driven directly to the anode from the I/O pins. The circuit appears to function as intended.

I haven't fully understood the concept of the NPN transistors sinking the current but I think I am correct in saying that so long as they can sink enough current for one whole column being on (3 in my case) this design should be fine and there is no risky of damaging the Arduino.


Sorry I wasn't clear, that's what I had meant by
(not including the LED resistor)
I had taken that image from elsewhere and full intended to include current limiting resistors.

Thank you for your help, the coding is easy but electronics is still a bit of black magic to me currently.

CrossRoads

"but I think I am correct in saying that so long as they can sink enough current for one whole column being on "

No, they sink enough for one whole layer. You drive all the anodes, the NPN sinks current for 1 layer.
3 layers, 3 NPN, but only 1 is turned on a time.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

MAX7219 works similar. You send it data for the 8 columns, it drives the anodes via the Segment pins, it sinks one cathode via the Digit pins. The switching is done at 800 Hz so there is no flickering.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up