Go Down

Topic: 8 * 16 RGB LED MATRIX (Read 1 time) previous topic - next topic

rabobox

Heey all,

i am trying to make an 16 * 8 RGB LED arduino table and this are my 2 boards the prototype and production board:

this is build according to this:

wich is build from:
http://www.instructables.com/id/64-pixel-RGB-LED-Display-Another-Arduino-Clone/step3/Schematic/

now that is a 8*8 and i want a 16 * 8 and i dont get anything off the code he wrote, so till this day i could not really test it.
i have CC leds at the moment and i have CA RGB leds comming in, what type of led should i use? and because they are all 74hc595 in chain i used the shift out tutorial but that is not really testing / helping me as an electronic person not a programmer :P

is there any sample code i could use to make this work or help me more on my way even if it was just getting each led on one by one,last thing i wondered if i use cc leds could i make an 8 * 18 or 9 * 16 because of the common ground ? that way i have 2 shift registers left for more leds.

This project is a bit over my head i suppose but it would be great to get some help :)!

frollard

#1
Oct 12, 2012, 04:25 pm Last Edit: Oct 12, 2012, 04:40 pm by frollard Reason: 1
What level of control do you want for these leds?
RGB on/off (RGBCMYKWBl) 7 colour +white and black is most reasonable with shift registers.
Keep in mind the 595 can't source or sink much current.  If you want to drive multiple leds at the same time (you do) you want to have individual buffer transistors on EACH output (row/column) to drive enough current. 8 * .02 = 160mA = more current than one column driver could support.

You have CA and CC leds -- ideally you want not-common...isolated rgb cathode and anode so you can drive all 3 colours at the same time, but if they are common, you'll have to drive the reds, then the greens, then the blues separately.


Are you driving the columns AND rows with shift registers?  If so you need to address them all, every frame.
an output frame would look like
//outputred
latch low
redColumn16b, greenColumn16b, blueColumn16b (6 bytes with only 1 bit set at a time), then 8 bits for that colour
latch high
might look like {01000000,00000000,00000000,00000000,0000000,000000000,10101010} //so only one colour column is driven at a time, with the last byte mattering.
You can do it more efficiently I suppose with 8bit columns and 16bit (unsigned integer) colour rows, but it takes more ram, your choice.  Since a max of 16 leds can be on at a time instead of 8 it might change things a bit.
How much other code do you plan to do?  Do you need all the other arduino pins?  You could easily skip a register for just using 8 pins and output 8 shifted bits faster.  You can set an entire port of pins with one line of code (such as the 'row' byte)...


the code will be very similar to the code for the 8x8;

I HIGHLY recommend understanding the 595 shift register tutorial
http://www.arduino.cc/en/Tutorial/ShiftOut

Also good to learn would be bitwise math, because shifting out is done in bits not bytes.  Your rgb matrix can be stored in 3 arrays of 16 bytes (48 bytes total).

Code: [Select]
byte red[15]; //each byte represents a row of 8 bits of that colour
byte blue[15];
byte green[15];

unsigned int frame[7]; //7 byte frame to be shifted out

//to simplify procedural assertion of column bits within a row, you could declare various named patterns
byte bits[8] = {1,2,4,8,16,32,64,128}; //binary equivalent of single bits



a simple for loop would count 0-15
1 byte would represent a row of r, or g, or b

in your main loop you need to address
-setting an animation pattern (static pattern to begin) - choose 1 frame at a time of course
-outputting the pattern
I'd consider generating the frame[] with 2 nested for loops
column and colour

the first 6 bytes are set using the bits[] array
Code: [Select]

frame[] = {0,0,0,0,0};
int temp[2] = {0,0};
for (int column = 0; column < 16; column++)
{
temp[] = {0,0}; //convert the column into 2 bytes
if (colour < 8) {temp[0] = bits[column];}
else {temp[1] = bits[(column-8)];}

for (int colour = 0; colour < 3; colour++)
{

if (colour = 0){//red
frame[0] = temp[0];
frame[1] = temp[1;]
frame[6] = red[column];
}

if (colour = 1){//green
frame[2] = temp[0];
frame[3] = temp[1];
frame[6] = green[column];
}

if (colour = 2){//blue
frame[4] = temp[0];
frame[5] = temp[1];
frame[6] = blue[column];
}

}end for
}end for

rabobox

First of all sorry for the late reply !

The level of control would be as many colors as possible just like:
http://www.instructables.com/id/64-pixel-RGB-LED-Display-Another-Arduino-Clone/
or the exact same thing i want:
http://www.dirk-melchers.de/2009/06/14/arduino-news/

i have thought of the fact that i cant put much current through it, but i can always try to piggy bank shift registers which is not ideal but might just work. but i will look at the buffer transistors as my leds are bigger than these small projects!


My are common so that will mean i have to do the r g b separate. but that should if i look at those other projects not be a real problem
The idea is to shift columns and rows as in my example links and projects.  so 2 registers red 2 registers green 2 registers blue and 2 anode (or cathode)

In the end it would be nice to play tetris in the end so you need up down left right and reset all which can be controlled by one plus and 5 min (6 pins)

So there is still a long way to go before it all will be done but atleast now i have a better startup point ^^



Hippynerd

#3
Oct 31, 2012, 05:47 pm Last Edit: Oct 31, 2012, 05:53 pm by Hippynerd Reason: 1
what I've been learning about RGB LEDs is that you probably want to run them common anode, common cathode seems to be a bit more effort and parts. If you run them common anode, you can use inexpensive, easily found LED drivers (like the very commonly used TLC 5940). If you want to use the shift registers, then you will need a lot of resistors.

I've built my cube as a CC cube, and it would have been easier to get finished, had i set it up for CA.

I've been trying to run shift registers near the LED voltage to minimize the resistoring, but it maybe futile.

If you use a driver chip, it does things like controls the current to each LED, if you use shift registers, you dont get that feature, and you need resistors to control the current to each resistor, and to do that, you need to know the LEDs forward voltage. Red LEDs are always pretty low (like 2v), but blue and green ones are usually higher, so you will probably need a few sizes of resistors.

I too like piggybacking chips, look over in my thread for a pictures and other info about RGB leds and the problems i've been working on.
https://sites.google.com/site/rgbledcubes

rabobox

Hey ,

The initial plan indeed was to use them with CA leds which i ordered out of china a month ago! and with the bonus of all the resistors i need.
And make the array RGB+RGB+ according to the PCB i already made. this weekend ill finish the tables is al goes wel.

I know the driver chips are easier, but i found more examples using these then driver chips hence my choice for them.
plus someone already got it working as you could see in my previous post,, only thats not me ;) and i did not recieve any message from him yet about the code or the schematic... so thus far i got a table without code which is pritty useless !

ill try yo find your threat i am curious also a led cude is cool, i have many spare leds to use so that might be project number 2.





Hippynerd

CC RGB cube thread:
http://arduino.cc/forum/index.php/topic,129431.0.html
CA white LED cube thread:
http://arduino.cc/forum/index.php/topic,123495.0.html

If you want to do it with shift registers, you will need to know the forward voltage on your leds. You can hook up resistors and electricity to them, and measure and calculate the current.

Hook up a resistor to each LED (red, green and blue 220 ohm or similar, but not too low!), hook up electricity, measure the voltage across the diode, then calculate:
Say you are using 5v, and 220 ohm resistor, and the voltage across the diode is 2v.
The formula is:
(5-2)/220 = 0.013636364 amps or 13.6ma

If you have a datasheet on your LEDs, then its a lot easier. You can use one of the many LED/resistor calcuclator sites.

http://ledcalculator.net/
https://sites.google.com/site/rgbledcubes

rabobox

thanks for the reply i know the valeus to that :)
http://www.ebay.nl/itm/380465163760?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

or to save you the trouble:
Forward Voltage (V)   
RED: Typical: 2 V Max: 2.4V
GREEN: Typical: 3.4 V Max: 3.8V
BLUE: Typical: 3.4 V Max: 3.8V


When powered by 5V DC,
The red anode shall be connected with 180 ohm resistor while green and blue anode shall be connected 100ohm resistor.
Package Contents:
    5mm RGB LED ×100
    100 ohm resistors ×200
    180 ohm resistors ×100
    470 ohm resistors ×200
    510 ohm resistors ×100


the seller saved me all the caculation trouble!

and sended me enough off them! so the making of the table isnt the problem.

this weekend ill make the grids, lay out all the cables, and solder all the leds into the tables.

then the task of making it work,,,wich will be a small pain in the ass

Go Up