Go Down

Topic: 8*8*8 led matrix - arduino mega 2560 /w hc595 (Read 2182 times) previous topic - next topic

Joeridp

Hi everyone.

I'm new to this forum and to arduino so bare with me. I made a 8*8*8 led cube but now i'm at the coding part. So I thought lets take out the bread bord and try out the tutorial of shift out(using 1k ohm resistors instead of 220), but i'm a little confused about the pin numbers... For my latch pin i used pin 77. But what pins should i use for my clock and data? I'm using an arduino mega 2560.

Grumpy_Mike

If you post the schematic of what you have built then maybe someone could answer you.
There are many ways of making an LED cube, which have you used?

Joeridp

For Now i'm just trying the shift out turorial but here i already have my first problem... All of my led's light up...when i write this in my code... shiftOut(datapin,clockpin,MSNFIRST,1) there should only be 1 value on right? Q0 should light up... If i enter 2 q1 should light up or am i wrong?I'll post a schema tomorrow of my led cube...

This is the tut i'm following for now... I just want to try out my shift registers and working with the arduino before i use the big guns... My led cube... If i could just light up one led at a time that would already be amazing... My latch pin is on pin 17, my datapin is on pin 24 en my clock on 25 right?

Tnx for the help so far

Grumpy_Mike

You can use what ever pins you like as long as you change the code to match the pins you have.
Do not put the capacitor on the latch pin as mentioned in the tutorial, this can damage your arduino.

Joeridp

How do you kwow if your arduino is broken then cause i did pit the capacitor on there... Maybe that's why it's not working?

Grumpy_Mike

Quote
How do you kwow if your arduino is broken then

Connect a resistor and LED to the pin and see if you can flash it with the suitable code.

Joeridp

If i would connect the data pin to an led shouldn't it blink or just light up at least? Still can't get the basic to work... Used the power source of my arduino and connected all of my led's but they don't light up until i touch the wire... It's really strange... If you need any more info please just ask... I really need help with this

Grumpy_Mike

Quote
they don't light up until i touch the wire

Sounds like a bad connection.

When you connect a LED and resistor to a pin you have to write code to make that pin an output and make it blink or stay on.

You still have not posted a schematic. It is like saying, what is wrong with my car but not saying what make of car you have.

Joeridp

I know i'm sorry... for now i'm following this tutorial: http://arduino.cc/en/Tutorial/ShiftOut
It's the exact same schematic as in this tutorial.
this is my code:

Code: [Select]
const int latchPin = 77;



void setup() {
pinMode(latchPin, OUTPUT);

}

void loop() {

 
  digitalWrite(latchPin,HIGH);
  delay(1000);
  //digitalWrite(latchPin,LOW);
  //delay(1000);
}


I connected an oscilloscope to my arduino to see if my pin went high but it didn't so I don't know what to do anymore.

tnx in advance

Joeri

funkyguy4000

I don't understand how it wouldn't know, the o-scope reads what is there, maybe you connected improperly?

Also your code doesn't make much sense.  The code that the tutorial wants you to follow has you doing shiftOut() commands, in which you will need to define your clock pin and your data pin along with the already defined latch pin. 

If you are using a mega and you did make an 8x8x8 led cube, you aren't exactly following that tutorial at all.  Although if you are referring to the wiring diagrams in that tutorial, then you could easily use the o-scope to check to see if the pins are going high.  Check up on how to use an O-scope real quick, it only takes a few minutes. 

now as for your current code, i'll help you out.

Code: [Select]
const int latchPin = 77;
With this definition, the arduino doesn't know you have 595's there.  to the arduino and every other code in the world, this is just another interger definition. 

Code: [Select]
void setup() {
pinMode(latchPin, OUTPUT);

}

This is just another definition of an output, nothing odd there.  Just not definitive of a 595 or an led cube

Code: [Select]
  digitalWrite(latchPin,HIGH);
  delay(1000);

So this is pretty normal, you are turning whatever is connected to latchPin for 1000ms, nothing wrong here.

Code: [Select]
  //digitalWrite(latchPin,LOW);
  //delay(1000);

Heres a problem,  with both of these lines commented out, you'll be looping over and over and over again trying to turn an already high pin, high again.  So with these commented out, there is nothing turning it back low, and thus no need for any delay methods.  If you want to keep these two commented out, i would suggest changing the code to this:
Code: [Select]
void loop() {
digitalWrite(latchPin, HIGH);
}


That way it will always be high, with less bits of code. 

Did that help?
Accelerate to 88 miles per hour.

Grumpy_Mike

Ok last time, I only ask three times and then I am out of here.
Post the schematic and code of what you are doing. Say what it does and say what you want it to do.

funkyguy4000

Accelerate to 88 miles per hour.

Go Up