8x8x8 led cube controlled with unl2803APG & SN54HC595

:o sooooo

  1. I have 8 of the 595s wired correctly, and each 595 controls columns 1-8 of each of the 8 vertical column plane, with each if the 8 layers being controlled by a pin pair on the 2803.

  2. I use pins 11,12,13 of the arduino to interface with the 595's

  3. I use pins 2,3,4,5,6,7,8,9 to control each horizontal layer of my cube, via the 2803, using analogWrites to control the brightness of the LEDs (by sending various values to the pins of the 2803)...

This seems to work ok, but.. when I write a value of zero to arduino pin2, write a value of 24 to arduino pin3 .. this works, but I also notice the even though I have layer 1 at a value of zero, my leds on layer1 will very dimly light when I activate an led on layer2...

Not sure what's happening.. I even changed my programming logic to use pins 2-9 (my layer pins) going to the 2803 to be OUTPUT and tried a digitalWrite of LOW / HIGH... still I see the flicker of layer1 when I've set layer1 to LOW and layer2 to high..

What am I missing?

Thanks in advance

sammiam:
What am I missing?

Your code.
A wiring diagram.

Here’s the code… wiring diagram will take a bit for me to get prepared…

int SER_Pin = 11; //pin 14 on the 75HC595
int RCLK_Pin = 12; //pin 12 on the 75HC595
int SRCLK_Pin = 13; //pin 11 on the 75HC595

int secs_to_delay = 50;

long randNumber;

////////////////////////////////////////////////////////////////////
//How many of the shift registers - change this
/////////////////////////////////////////////////////////////////
#define number_of_74hc595s 6

//////////////////////////////////////////////////////////
// How many layers
//////////////////////////////////////////////////////////
#define number_of_layers 2

int num_LEDs = number_of_74hc595s * 8;

///////////////////////////////////////////////////////////
// PWM value - controls LED brightness
//////////////////////////////////////////////////////////
int PWM_value=24;

//do not touch
#define numOfRegisterPins number_of_74hc595s * 8

boolean registers[numOfRegisterPins];

////// SETUP /////////

void setup(){
pinMode(SER_Pin, OUTPUT);
pinMode(RCLK_Pin, OUTPUT);
pinMode(SRCLK_Pin, OUTPUT);

//reset all register pins
clearRegisters();
writeRegisters();

// analogWrite(2,0);
// analogWrite(3,0);

}

//set all register pins to LOW
void clearRegisters(){
for(int i = numOfRegisterPins - 1; i >= 0; i–){
registers = LOW;

  • }*
  • writeRegisters();*
    }
    //Set and display registers
    //Only call AFTER all values are set how you would like (slow otherwise)
    void writeRegisters(){
  • digitalWrite(RCLK_Pin, LOW);*
  • for(int i = numOfRegisterPins - 1; i >= 0; i–){*
  • digitalWrite(SRCLK_Pin, LOW);*
    _ int val = registers*;_
    digitalWrite(SER_Pin, val);
    digitalWrite(SRCLK_Pin, HIGH);
    _
    }_
    digitalWrite(RCLK_Pin, HIGH);
    _
    }_
    _
    //set an individual pin HIGH or LOW*_
    void setRegisterPin(int index, int value){
    * registers[index] = value;*
    }
    /////////// LOOP ////////////////////
    void loop(){

* for(int PWM=(2);PWM<(number_of_layers+2);PWM++) // pin 2 of arduino is the start of my PWM - controlling the Darlington 2803*
* {*
* analogWrite(PWM,PWM_value);*

* for(int pin = 0; pin < num_LEDs; pin++)
_
{_
_
setRegisterPin(pin, LOW);_
_
writeRegisters();_
delay(secs_to_delay);
_
clearRegisters();_
_
setRegisterPin(pin, HIGH);_
_
writeRegisters();_
delay(secs_to_delay);
_
clearRegisters();_
_
}_
for(int pin = (num_LEDs - 1); pin > -1; pin–){
_
setRegisterPin(pin, LOW);_
_
writeRegisters();_
delay(secs_to_delay);
_
clearRegisters();_
_
setRegisterPin(pin, HIGH);_
_
writeRegisters();_
delay(secs_to_delay);
_
clearRegisters();_
_
}*_

* analogWrite(PWM,0); // set off the current 2803 pin*

* }*

}

It's not pretty, it's ASCII art... I have all 8 595's up and running. with just 1 layer, everything works well.. it's when I add additional layers that I see the dim flash of the LEDs is layers that are turned off. Forgive me, I'm rather new at electronics, I've programmed for 30+ years... I also wired all the necessary leads on each of the 595's together as I've seen circuit diagrams on the web... as I said, everything works perfect if I do:

  1. manually wire each layer independently to ground
  2. only have pin 2 of the arduino set with an analogWrite(2, 24) or some other value

so far I have only my bottom most layer (layer 1), and next layer up (layer 2).. one thing I notice is that I don't see any dim flashing of my layer2 when I'm activating layer1... but when I deactivate layer 1, and activate layer 2, that's when I see the LEDs in layer 1 dimly flashing.. not the end of the world, but I would like for them not to flash, even dimly.. I'm going to add one rot of layer 3, and see if the same behaviour occurs.

attached circuit diagram

8x8x8_circuit_diagram.doc (19.5 KB)