So I built my First LED Cube and the thing turns ON!!! Pretty happy about that but here is my problem.
When I try and get the Cube to display say a basic "outline" (a wire form of a cube only the outer most LEDs are on)
The shift registers, that I have daisy chained together, give the correct display 80% of the time, but the other 20% give completely wrong LEDs lighting up.
I have used 4 74HC595 shift registers linked together so I am only using 3 of my Arduino ports to control the 5*5*5 Cube. The basic shape is there but the ones that are not meant to be lighting up cause a lot of flickering (or ghosting?) in the center of the cube.
I have thought about using pull up or pull down resistors but I find that, when I run my program at a slower rate, the LEDs that are lighting wrongly are lighting up controlled so I think it has to be something with my code or setup.
Has anyone got any experience with LED cubes doing this?
Also I am only using the output enable and disable to make use the wrong this is not displayed when I am shifting the data out, should I be using the clear?
One last thing, does anyone have recommendations for the delay time to let each layer shine for?
My code is below
int clockPin = 8;
int dataPin = 7;
int set = 6;
void setup()
{
//set pins to output so you can control the shift register
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(set,OUTPUT);
}
void loop()
{
digitalWrite(set,HIGH); // DISABLES OUTPUT
// level 1 ( top )
shiftOut(dataPin, clockPin, MSBFIRST, B00000011);//from left 3rd to the 7th = levels 5-1,, The right first LED
shiftOut(dataPin, clockPin, MSBFIRST, B11111000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B11000110);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00111111);// Makes the " wire cube "
digitalWrite(set,LOW); // enables output
delay(2);
digitalWrite(set,HIGH); // DISABLES OUTPUT
// level 2
shiftOut(dataPin, clockPin, MSBFIRST, B00000101);//from left 3rd to the 7th = levels 5-1,, The right first LED
shiftOut(dataPin, clockPin, MSBFIRST, B00010000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00000000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00010001);// Makes the " wire cube "
digitalWrite(set,LOW); // enables output
delay(2);
digitalWrite(set,HIGH); // DISABLES OUTPUT
// level 3
shiftOut(dataPin, clockPin, MSBFIRST, B00001001);//from left 3rd to the 7th = levels 5-1,, The right first LED
shiftOut(dataPin, clockPin, MSBFIRST, B00010000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00000000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00010001);// Makes the " wire cube "
digitalWrite(set,LOW); // enables output
delay(2);
digitalWrite(set,HIGH); // DISABLES OUTPUT
// level 4
shiftOut(dataPin, clockPin, MSBFIRST, B00010001);//from left 3rd to the 7th = levels 5-1,, The right first LED
shiftOut(dataPin, clockPin, MSBFIRST, B00010000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00000000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00010001);// Makes the " wire cube "
digitalWrite(set,LOW); // enables output
delay(2);
digitalWrite(set,HIGH); // DISABLES OUTPUT
// level 5 ( bottom )
shiftOut(dataPin, clockPin, MSBFIRST, B00100001);//from left 3rd to the 7th = levels 5-1,, The right first LED
shiftOut(dataPin, clockPin, MSBFIRST, B11111000);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B11000110);// Makes the " wire cube "
shiftOut(dataPin, clockPin, MSBFIRST, B00111111);// Makes the " wire cube "
digitalWrite(set,LOW); // enables output
delay(2);
}
Any help would be appreciated
Thanks