Go Down

### Topic: General question (LED Matrix) (Read 2108 times)previous topic - next topic

#### GoingForGold

##### Nov 10, 2011, 09:55 pm
Hi together!

i'm new to the arduino community since i ordered my first (2009) a few minutes ago. i apologize for my english, i'm not a native english speaker i hope you can help me.

1. i own a 8x8 LED matrix and first, i justt want to run it without any ICs or something. to light up a LED i set the row-pin to high and the corresponding column-pin to low. but what do i do with the other column pins? in tutorials they write "just dont drive any current through the other pins", but which mode is this?

2. this is kind of a basic electronics question, and i hope i know how to explain it exactly like i mean it. we have, if set to high, 5V per pin. so i go from each pin 1-8 (#0-7) to a resistor and further to the columns of matrix. and i connect the rows directly to pins 9-16. so e.g. i want to light up the whole row 1. i set all the column-pins to high and the row-pin 1 to low. so i have from every column-pin 20mA driving to the LED, which sums up to 160mA (8x20mA) at the row-pin. i know, the maximum per digital-pin is 50mA, but is this just for "output" or also for the "input"? i mean; is this a problem and what to do about it? yes, i could light up every LED alone, but i want to multiplex the rows.

3. step 2 for me will be the use of 74HC595 to reduce to just 3 pins on the arduino. but with 3 pins i have a maximum of 150mA, but i see people running large LED boards like this. where does the power come from?

thank you very much!

#1
##### Nov 10, 2011, 10:11 pm
You are correct, the matrix will allow more current flow than is healthy for the IO pins. You don't want more than 20mA in or out on a pin for longevity. LEDs also start wearing prematurely with more than 20mA in most cases.

Solution:
Have the 8 Hi outputs go thru a current limit resistor each to the matrix anodes.
Use part like ULN2803 as buffer for cathodes. Then 8 high outputs can be sunk by 1 low pin on the ULN2803.

8 anodes Hi/Lo, cathode #1 low for some # of mS, then back hi
Next row:
8 anodes Hi/Lo, cathode #2 low for some # of mS, then back hi
etc
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.

#2
##### Nov 10, 2011, 10:29 pm
Also, 74HC595 is spec'ed to be only good for 6-8 mA.
I would a different part, like 74AC299PC or some part that is rated for 20-24mA.

http://www.ti.com/product/cd74ac299
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.

#### GoingForGold

#3
##### Nov 10, 2011, 11:07 pm

Have the 8 Hi outputs go thru a current limit resistor each to the matrix anodes.

This is what I wrote, right?

Use part like ULN2803 as buffer for cathodes. Then 8 high outputs can be sunk by 1 low pin on the ULN2803.

Ok you lost me.. could you explain this a little bit please? how would you connect toe cathodes to the ULN2803 and what happens afterwards?

Also, 74HC595 is spec'ed to be only good for 6-8 mA.

are you sure? i just found a datasheet which said it goes up to 35mA. but thats not my biggest problem at the moment
and could you please give me some help for question nr. 1? i think here's the core of my problem..

thanks again!

#### GoingForGold

#4
##### Nov 10, 2011, 11:55 pm
to be clear considering the question, i did read the datasheet but i dont get how i could use it in this context. i think it contains out of 8 transistors and makes of low voltage higher voltage. i need to reduce 160mA/1.8V to 20mA. And tbh I dont have a clue how you destroy amperes, i just know how to reduce voltage.

#5
##### Nov 11, 2011, 07:27 am
Picture says it all - I just can't post the during the day ...

TI's 74HC595 data sheet says: Recommended operating conditions ±6-mA Output Drive
Philips 74HC595 data sheet says Recommended operating conditions: IO = -6.0 mA with Vcc =4.5

You could use 25mA, for a while, until they blow 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.

#### GoingForGold

#6
##### Nov 11, 2011, 10:06 am
Thank you very much for your help, now i think i figured out my problem. considering the 74HC595 of course i believe you, i was just a bit confused because there are loads of tutorials out there which say this IC would just be right (one of them is from arduino personally  )

So there is just one (as we say in switzerland) snarl in my head: at all times theres just one row high, the others are low. this makes sense to me. so if i want to light up the first 4 LEDs ind the first row(forget about the power problems) i set the first 4 colums to low. but this implies that the other columns are set to high (or is this wrong?). so at this specific led (the second 4) there are 5V at both the anode and the cathode. and for the other rows this means that the power "flows" from the column pins (since they're high) to the row pins which are low. i guess theres a huge mistake but i dont see it.

thank you again!

#7
##### Nov 11, 2011, 05:30 pm
Lots of people may use the 74HC595, as an electrical engineer I do not recommend it for 20mA loads.

High Y and High X (which results in 8 Low cathodes as the transistor turns on) will turn an LED on.

To drive the display, you will set the columns hi/lo as desired.
Then by turning on X for 1 row, the transistor for that row turns on and provides a path for current flow for the LEDs with hi columns.
The other rows can be thought of as disconnected - with no path for current to flow, no other LEDs turn on.
If you wanted, you could add a pullup resistor to the collector of each transisitor. Thus you would either haved 5V on either side of the LED, and no current flow, or you would have 5V on the cathode and ~0V on the anode (columns side) and the LED would be "reverse biased", and no current flow.

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.

#8

#### GoingForGold

#9
##### Nov 12, 2011, 01:06 am
aaaah perfect, thank you! so i see, HIGH is like on and LOW like off in this case.

so theres one last question, just to understand this correctly. i cant get rid of the datasheet of the ULN2803. what goes in and what comes out? (amperes and volts). so am i going to connect the arduino to pins 1-8 and pins 11-18 to the rows of the matrix, and for the columns i use resistors to get
the correct amount of volts, right?

thank you very much again! this is so much fun for me and i like to learn mew
things

#10
##### Nov 12, 2011, 01:28 am
ULN2803, pins 1-8 connect to arduino.
9 goes to ground
10 is not connected
11-18 connect to the cathode columns.
Resistors on anodes to limit current.
R = (5V - Vce - Vforward_LED)/0.02
5V, assuming 5V from arduino source
Vce= approx. 0.7V across the transistor or the ULN2803
Vforward_LED = voltage drop across the LED, from 0.7V to common RED LED up to 3.6V for high-brightness type LEDs, such as

http://www.superbrightleds.com/moreinfo/component-leds/5mm-blue-led-15-degree-viewing-angle-5500-mcd/269/1196/
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.

#### GoingForGold

#11
##### Nov 12, 2011, 09:04 am
Thank you again, perfect!

So my Matrix got red LEDs with a forward voltage of 1.8V, so this would be (5V - 0.7V - 1.8V)/0.02 = 125 Ohms. So i'm going to use 130 ohms resistors right?

So now i know how i have to connect everything, thank you. but could you please be a bit more precise about what the ULN2803 actually does? i mean what is input and output in amperes and volts?

#### Grumpy_Mike

#12
##### Nov 12, 2011, 09:35 am
It inputs logic levels so that is 0v or 5v, the current is so small it doesn't matter much. The output is a transistor that turns on, that is an output that goes from infinite ohms to zero ohms, to be simplistic.
The current from the output is a function of what you connect it to and can be anything from zero to infinity. Mind you if you arrange it so that it is over 500mA you melt it inside. Also the total of all the outputs on at any one time should not exceed 650mA to avoid internal melting.

#13
##### Nov 12, 2011, 09:37 am
120 would work okay too and is a standard value.

The ULN2803 can be thought of as 8 transistors each with current limiting base resistors in a easy to work with DIP package.
So instead of having 8 transistors and 8 resistors, you just have 1 DIP package.

The Arduino can drive its input directly.
The outputs can accept up to 50V and can sink several  hundred mA of current.
In this case, 5V and up to 160mA are well within its capability.
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