led driver

Hi all,

I'm a real newbie in electronics and physical computing . Currently i'm trying to build an array of 8x8 or possibly more leds and being able to control the sequence of lighting. I'm using the phillips 595 led driver and i managed to get it working by following the shiftout tutorial in the arduino site http://www.arduino.cc/en/Tutorial/ShiftOut . The thing is the way it controls the sequence with binary is limited from 0-255 .

//Arduino doesn't seem to have a way to write binary straight into the code
//so these values are in HEX. Decimal would have been fine, too.
dataArrayRED[0] = 0xFF; //11111111
dataArrayRED[1] = 0xFE; //11111110
dataArrayRED[2] = 0xFC; //11111100
dataArrayRED[3] = 0xF8; //11111000
dataArrayRED[4] = 0xF0; //11110000
dataArrayRED[5] = 0xE0; //11100000
dataArrayRED[6] = 0xC0; //11000000
dataArrayRED[7] = 0x80; //10000000
dataArrayRED[8] = 0x00; //00000000
dataArrayRED[9] = 0xE0; //11100000

//Arduino doesn't seem to have a way to write binary straight into the code
//so these values are in HEX. Decimal would have been fine, too.
dataArrayGREEN[0] = 0xFF; //11111111
dataArrayGREEN[1] = 0x7F; //01111111
dataArrayGREEN[2] = 0x3F; //00111111
dataArrayGREEN[3] = 0x1F; //00011111
dataArrayGREEN[4] = 0x0F; //00001111
dataArrayGREEN[5] = 0x07; //00000111
dataArrayGREEN[6] = 0x03; //00000011
dataArrayGREEN[7] = 0x01; //00000001
dataArrayGREEN[8] = 0x00; //00000000
dataArrayGREEN[9] = 0x07; //00000111

So my question is, if my led drivers are daisy chained. How can I control the sequence of the leds and be able to light each one up individually in anyway i want to for 8x8 leds. I would appreciate your help so much if you guys could help me out. Thanks!

//Arduino doesn't seem to have a way to write binary straight into the code

Use B10101010.

So my question is, if my led drivers are daisy chained. How can I control the sequence of the leds and be able to light each one up individually in anyway i want to for 8x8 leds. I would appreciate your help so much if you guys could help me out. Thanks!

I've currently got a bunch of RGB LEDs doing what you want with 3 595's.
You just keep sending the data and it overflows in to the adjacent chips.

By the way: Its usually better to have a algorithm to make the animation patterns instead of manually figuring out each frame.
Mine currently has 6 different algorithms and it changes every 5 seconds.

Photos here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1190032971/16#16

Hi cheater,

Thanks for the suggestion . Can you explain to me in detail? Maybe some code examples of how to do it with algorithm? Sorry if i'm asking too much. Also are you working with the 7219 or 595? I would really appreciate it if u can help me out here. Thank you.

I'm using 595's. The material for making a 8x8 RGB array is in the mail atm. :slight_smile:
Yes thats 24 595's hooked up together and 256 LED pins to solder.

Here is my outputting function:

void writeoutput(int order)
{
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, order, tmp1);
  shiftOut(dataPin, clockPin, order, tmp2);
  shiftOut(dataPin, clockPin, order, tmp3);
  digitalWrite(latchPin, 1);
  delay(DELAY);
}

shiftout is the standard 595 function on the playground (slightly optimized).

A simple RGB LED chaser with a Red, Green and Blue LED chasing each other around is below:

void chaser(int d)
{
  tmp1 = 0xFF - (1 << led);
  tmp2 = 0xFF - (1 << ((led + 3) > 8 ? (led - 6) : (led + 3)));
  tmp3 = 0xFF - (1 << ((led + 6) > 8 ? (led - 3) : (led + 6)));
  writeoutput(d);
  led++;
  if (led == 9)
  {
    led = 0;
  }
}

Slightly more complex than hard coded frames but it beats actually hard coding the frames.
Basically its manipulating a byte to turn on specific LEDs.
tmp1 is red, tmp2 is blue and tmp3 is green. Ignore 'd' btw.

Thank you so much :slight_smile: I will try now.