Pages: [1] 2   Go Down
Author Topic: Understanding the components of a LED matrix  (Read 1838 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm looking into making an 8x8 LED matrix. My eyes are almost burning from the amount of googling I've been doing. The most common parts that pop up all the time are the 74HC595 and the ULN2803A. The biggest hurdle is dealing with the current drain. Taking a look at this tutorial for the 74HC595 (http://arduino.cc/en/Tutorial/ShiftOut), I've realized that powering all 8 LEDs with only 220 ohm resistors would be far over the limit of the  chip, which appears to be a maximum of ±70mA (http://www.sparkfun.com/datasheets/IC/SN74HC595.pdf). In a row-scanning matrix, the ULN2803A can sink 8 LEDs worth of current on a single pin, but it can handle 500mA, so that's fine (http://www.sparkfun.com/datasheets/IC/uln2803a.pdf). However, if each LED in the row is on, the 74HC595 still has to source 8 LEDs, 1 per pin. Why don't I see any examples or tutorials using a bunch of PNP transistors (differences to MOSFETS?) between the shift register and the LEDs to handle the current? Apologies for the noob questions. I'm trying to determine if I need to order a bunch of transistors to make my matrix. Thanks for any help!
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2567
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What chip(s) you need depend on what you want.
Are you talking about a 8x8 RGB, bi-colour or single colour matrix?
Do you need to dim individual LED's within the matrix or whole matrix dimming with simple LED on/off?
Logged


Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 34488
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why don't I see any examples or tutorials using a bunch of PNP transistors (differences to MOSFETS?) between the shift register and the LEDs to handle the current?
Two reasons:-
1) Depending on how you scan the matrix you might have a ULN2803A sinking 8 LEDs but only one pin sourcing the current for one LED at at time. As described here:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

2) There are a lot of moron tutorials out there. Some don't even use resistors to limit the current in the mistaken belief that because it is multiplexing there is no need to. This is wrong. See:- http://www.thebox.myzen.co.uk/Tutorial/LEDs.html 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is quite a helpful tutorial! However I still don't understand how you'd only ever source or sink 1 led as a worst case. Wouldn't the worst case be that each chip could be handling 8 LEDs, just one is per pin, and the other is a single pin? Take the last line in the row-scan example: each LED in the row is lit. That's 8x20mA sourced on a single pin (the walking bit), and 20mA sinking on each column. If those were connected straight to the arduino, wouldn't that be a dangerous 160mA? I feel like I'm misunderstanding some fundamental step here smiley-confuse

This will be a single color matrix with no dimming for clarification.
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2567
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This will be a single color matrix with no dimming for clarification.
Then have a look at this article http://playground.arduino.cc//Main/MAX72XXHardware You cannot get much simpler than using a MAX7219 as it takes care of all the row/column scanning for you and only needs a single resistor to set current limiting. They are cheap to buy on ebay and so simple to use I made this http://arduino.cc/forum/index.php/topic,118338.0.html as my first arduino project.
Logged


Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 34488
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That's 8x20mA sourced on a single pin (the walking bit), and 20mA sinking on each column.
No it is the walking bit that needs the help in sourcing or sinking the current. So 20mA sinking is fine but 8X20mA sourcing needs extra help.
Normally on an arduino you can choose if you want to supplement  the sourcing or sinking capacity. Then the way it is scanned is chosen so that the low capacity current pin only carry the current for one LED.

Quote
If those were connected straight to the arduino,
Yes so don't.
Logged

Eugene, Oregon
Offline Offline
Sr. Member
****
Karma: 9
Posts: 388
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Technically, you can make a single color 8x8 matrix without any ics. You use 16 arduino pins, 8 resistors, and 64 LEDs. I've made a 64 LED cube (4x4x4) with 64 LEDs, 4 resistors (16 resistors works better), wire, solder, and an arduino.

You can also do this with charliplexing, You could even do this with RGB LEDs if you use charlieplexing. Check out asher glicks charliecube.
http://aglick.com/charliecube.html
Im working on doing some documentation for this, he shows you what you need to accomplish, but not so much about how to get there, and its a bit tricky.
Technically, this design should be doing damage to something Im unclear on weather its the LEDs or microcontriller at risk, but I've been running them over a month, without failure, and no appreciable differences in brightness or color, or speed.

If you really want to use shift registers, then you should check out ShiftPWM:
http://www.elcojacobs.com/using-shiftpwm-to-control-rgb-leds-with-arduino/

I made a few examples that ran straight off the arduinos 5v pin, plugged into a 5v USB phone charger (about 500mA), I only ran them for a couple days, and technically its probably too much current for the arduino, so it *may* be doing some kind of damage.

Have you considered constant current drivers? They make chips just for controlling many LEDs, it makes things a lot easier, less stuff to deal with, less stuff to screw up, and tidier too.

If you want more examples of people using multiplexing with transistors, also check out cubes, and LED strips.
Here Ladyada is using Mosfets and Darlingtons to power strips.
http://learn.adafruit.com/rgb-led-strips/usage

Im still trying to figure out sinking and sourcing to my 2 other cube setups (one with shift registers, one with constant current driver), but I've been busy with other things. The charliecube was a lot of work soldering, but I had it working within a week, my other cubes are still not finished, and I started them over a month ago.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No it is the walking bit that needs the help in sourcing or sinking the current. So 20mA sinking is fine but 8X20mA sourcing needs extra help.

What I'm trying to get at is that I can't source OR sink with a 74HC595 since 8x20mA on one pin is too much, and 20mA on 8 pins is also too much. I'm completely new to this, so if I am not understanding some fundamental rules of current flow, I apologize.

Technically, this design should be doing damage to something Im unclear on weather its the LEDs or microcontriller at risk, but I've been running them over a month, without failure, and no appreciable differences in brightness or color, or speed.

That is a bit settling, but it's what I'm trying to avoid, hehe.
« Last Edit: December 24, 2012, 05:19:41 pm by M4573R » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
20mA on 8 pins is also too much.

It isn't too much unless you are building for NASA.

In that case,  you can add a swich (npn/pnp, depending on your design) on the 595's output.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
20mA on 8 pins is also too much.

It isn't too much unless you are building for NASA.

In that case,  you can add a swich (npn/pnp, depending on your design) on the 595's output.


The 595 is listed as 70mA max current across the chip, how long should I expect it to last?
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At 20ma/pin, it will outlast all of us, by a few multiples.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At 20ma/pin, it will outlast all of us, by a few multiples.


To be clear, we're talking 20mA per pin on all 8 pins at once, double the chips rated current. If that's true, I could use the 595's and a 2083 to even extend this to a 4x4x4 or 8x8x8!
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If that's true,

You can easily try it.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If that's true,
You can easily try it.

I can try a lot of things! But I'd like to save my wallet from burning through chips and my mind by saving hours of debugging related to things like this.
Logged

Eugene, Oregon
Offline Offline
Sr. Member
****
Karma: 9
Posts: 388
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Since you are talking about an 8x8 multiplex, thats a total of 16 control lines, you can do that with just resistors and LEDs, multiplexing is good enough.

If you want to reduce your control lines you can do that by serializing the data, but with this size you are not saving a lot, unless you serialize both at the same time (16 pins to 3 pins, vs 16 pins to 6 pins). It seems like you should be able to use 2 shift registers (one for source, one for sink).

Since you will only have 1 row on at a time, you have a 12% Duty cycle, so they may not be as bright as if you just have them on. If you want them as bright as each one can be, then you could serialize all the anodes or cathodes to 64 pins through 8 shift registers and 64 resistors. You can then have 100% duty cycle.

If you wanted do 100% duty cycle, but didnt want to do the resistors, you could use constant current drivers, heck, you may even be able to find a single chip to solve that.

The ShiftPWM demo runs 3 shift registers to 24 resistors to 8 RGB LEDs (thats 3 diodes per LED). Its sinking or sourcing up to 480mA through 3 70mA devices.  So, in theory, it could source or sink 480 through something rated for 210 or about 225% of its rating. I personally have only run it for a few days, but I had no problems, It theoretically could be doing damage, but I dont know how long it takes to fail, days, weeks, years, its hard to say.

The charliecubes I have running over a month are pretty crazy, thats 192 LEDs running on an arduino, with no other parts. Its just crazy, thats almost 4 amps if the leds were fully driven at 20mA each (64 RGB LEDs = 192 LEDs @ 20mA each= 3840. This all runs from a single arduino, on a 500mA usb power supply, so there is no way its using 3840mA.

here are some things that I have tried:
https://www.youtube.com/watch?v=CD-6Dq9qV9s
https://www.youtube.com/watch?v=53SB525n2QY
https://www.youtube.com/watch?v=ZN0qXgcU-w0

What have you tried?
Logged


Pages: [1] 2   Go Up
Jump to: