8x8 led dot matrix

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
Hi everyone, Im not sure whether my problem is hardware or software. Im following the "beginning arduino" book and am trying to do project 19. I have wired my led dot matrix specifically to the one i have, and I am confident that each pin connected from the 74HC595 IC's are connected to the correct rows and columns. (I disconnected the connection from each pin to see that the rows and columns stop lighting). I also had to include the TimerOne library and everything compiled correctly with the code from the book. All that happend however is all the LEDs light up, whereas there should be an image of a heart.

I have checked my wiring a billion times, every connection looks good. Im happy to upload a picture but the wiring is messy...I was wondering if anyone knew what the problem was just by my description. Let me know if you want any more description, picture etc if that would help. Thanks!
 

SgtWookie

Joined Jul 17, 2007
22,230
If you're sure the wiring is correct, then post the code that you are compiling.

You probably have typed something different than what is in the book.

Without having access to the source code, schematics, or LED specifications, or your actual wiring, about all we can do is say "Well, either you did something wrong, or the book has errors, and we have no idea which is the problem because of lack of information."
[eta]
Your breadboard is so messy that it's impossible to tell what is connected to what.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
I agree, for the code i first typed it up but to be on the safe side I just compiled the one directly from the book. I think that the TimerOne.h that I included from the external library may be the cause. I have an arduino mega and everything compiled correctly so does that mean that the timerOne library is working fine?

If not, I will produce a schematic of what I have produced because I have no wire left!
 

SgtWookie

Joined Jul 17, 2007
22,230
Pebble is basic, but handy.
Link: http://www.rev-ed.co.uk/picaxe/software.htm
Scroll about 2/3 the way down the page. I suggest downloading it instead of using it online; if your online session gets interrupted you'll have no way to save it.

Just unzip Pebble.zip where ever you choose to do so, then open the PEBBLE folder and click on PEBBLE.html - and you're off.

They don't have your exact protoboard, but you could use "64R .."(etc) to get a similar single board, or use the "5R Double BB ..." etc to get a 2-up board configuration.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
I also forgot to say that pin 14(on IC) is connected to pwm on my arduino,15 to another pwm pin and pin 11 to another pwm (and my rails are 3.3v and 0 volts and are connected to those pins on the arduino.)
 

SgtWookie

Joined Jul 17, 2007
22,230
Pin 14 should not be connected to PWM; that's serial data in.
Pin 15 is output QA, not an input! You may damage the Arduino or the 74HC595 by connecting the outputs together.
Pin 11 is the serial clock input; why is it connected to a PWM output?

1) Left shift register - Pin 14 is serial in; not shown as connected.
2) Right shift register - pin 13 (G\) should be grounded.
3) Left shift register - pin 12 needs register clock from CPU.
4) " " " - pin 11 needs serial clock from CPU.
5) " " " - pin 10 is shift register clear; needs CPU input
 

chejian6

Joined May 22, 2011
10
You must make sure the right LED matrix is used. There're common anode and common cathode LEDs. Some are dual or even tripple colors. I have the same problem when doing the dot matrix led test with the part bought from siliconray (her it is) but failed. Then I found it's a common anode dual color matrix, not the same as the one as in the book at all. I reconnected the pins and then everything is OK.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
Ok so I have an arduino mega 2560, meaning that I have to connect pin 14 from the IC to SDA(serial data on the arduino), and pin 11 to SCL?

Im not sure where pin 12 on the IC should be connected on the arduino for the register clock. There are pins like RX1,RX2; would that be it?

Im also not sure which pin is shift register clear on the arduino for pin 10.

The book connects to all PWM pins on the arduino, which was why I did that.
 

SgtWookie

Joined Jul 17, 2007
22,230
I don't know. I don't have the book, I don't know the Arduino, I don't see the program code posted. Maybe they ARE using the PWM for the clock.

The serial clock gets data through the shift register, however you need to at least occasionally pulse the register clock, or the shifted data never gets latched to the output. If nothing else, you might get away with using the SCLK for the RCLK too - but the RCLK really needs to be delayed from the SCLK.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
This is the code, I have the wires back to the PWM signals as thats how the code is.

Rich (BB code):
// Project 19-beginning arduino 
#include <TimerOne.h>
int latchPin = 8; //Pin connected to Pin 12 of 74HC595 (Latch)
int clockPin = 12; //Pin connected to Pin 11 of 74HC595 (Clock)
int dataPin = 11; //Pin connected to Pin 14 of 74HC595 (Data)
byte led[8]; // 8 element unsigned integer array to store the sprite

void setup() {
pinMode(latchPin, OUTPUT); // set the 3 digital pins to outputs
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
led[0] = B11111111; // enter the binary representation of the image
led[1] = B10000001; // into the array
led[2] = B10111101;
led[3] = B10100101;
led[4] = B10100101;
led[5] = B10111101;
led[6] = B10000001;
led[7] = B11111111;
// set a timer of length 10000 microseconds (1/100th of a second)
Timer1.initialize(10000);
// attach the screenUpdate function to the interrupt timer
Timer1.attachInterrupt(screenUpdate);
}
void loop() {
for (int i=0; i<8; i++) {
led= ~led; // invert each row of the binary image
}
delay(500);
}
void screenUpdate() { // function to display image
byte row = B10000000; // row 1
for (byte k = 0; k < 9; k++) {
digitalWrite(latchPin, LOW); // open latch ready to receive data
shiftIt(~led[k] ); // shift out the LED array (inverted)
shiftIt(row ); // shift out row binary number
// Close the latch, sending the data in the registers out to the matrix
digitalWrite(latchPin, HIGH);
row = row << 1; // bitshift left
}
}

void shiftIt(byte dataOut) { // Shift out 8 bits LSB first, on rising edge of clock
boolean pinState;
digitalWrite(dataPin, LOW); //clear shift register read for sending data
for (int i=0; i<8; i++) { // for each bit in dataOut send out a bit
digitalWrite(clockPin, LOW); //set clockPin to LOW prior to sending bit
// if the value of DataOut and (logical AND) a bitmask
// are true, set pinState to 1 (HIGH)
if ( dataOut & (1<<i) ) {
pinState = HIGH;
}
else {
pinState = LOW;
}
//sets dataPin to HIGH or LOW depending on pinState
digitalWrite(dataPin, pinState);
digitalWrite(clockPin, HIGH); //send bit out on rising edge of clock
digitalWrite(dataPin, LOW);
}
digitalWrite(clockPin, LOW); //stop shifting
}
 

SgtWookie

Joined Jul 17, 2007
22,230
Well, I indented your code for you:

Rich (BB code):
// Project 19-beginning arduino 
#include <TimerOne.h>
int latchPin = 8;  //Pin connected to Pin 12 of 74HC595 (Latch)
int clockPin = 12; //Pin connected to Pin 11 of 74HC595 (Clock)
int dataPin = 11;  //Pin connected to Pin 14 of 74HC595 (Data)
byte led[8];       // 8 element unsigned integer array to store the sprite

void setup() {
   pinMode(latchPin, OUTPUT); // set the 3 digital pins to outputs
   pinMode(clockPin, OUTPUT);
   pinMode(dataPin, OUTPUT);
   led[0] = B11111111; // enter the binary representation of the image
   led[1] = B10000001; // into the array
   led[2] = B10111101;
   led[3] = B10100101;
   led[4] = B10100101;
   led[5] = B10111101;
   led[6] = B10000001;
   led[7] = B11111111;
   // set a timer of length 10000 microseconds (1/100th of a second)
   Timer1.initialize(10000);
   // attach the screenUpdate function to the interrupt timer
   Timer1.attachInterrupt(screenUpdate);
}
void loop() {
   for (int i=0; i<8; i++) {
      led= ~led; // invert each row of the binary image
   }
   delay(500);
}
void screenUpdate() { // function to display image
   byte row = B10000000; // row 1
   for (byte k = 0; k < 9; k++) {
      digitalWrite(latchPin, LOW); // open latch ready to receive data
      shiftIt(~led[k] ); // shift out the LED array (inverted)
      shiftIt(row ); // shift out row binary number
      // Close the latch, sending the data in the registers out to the matrix
      digitalWrite(latchPin, HIGH);
      row = row << 1; // bitshift left
   }
}

void shiftIt(byte dataOut) { // Shift out 8 bits LSB first, on rising edge of clock
   boolean pinState;
   digitalWrite(dataPin, LOW); //clear shift register read for sending data
   for (int i=0; i<8; i++) { // for each bit in dataOut send out a bit
      digitalWrite(clockPin, LOW); //set clockPin to LOW prior to sending bit
      // if the value of DataOut and (logical AND) a bitmask
      // are true, set pinState to 1 (HIGH)
      if ( dataOut & (1<<i) ) {
         pinState = HIGH;
      }
      else {
         pinState = LOW;
      }
      //sets dataPin to HIGH or LOW depending on pinState
      digitalWrite(dataPin, pinState);
      digitalWrite(clockPin, HIGH); //send bit out on rising edge of clock
      digitalWrite(dataPin, LOW);
   }
   digitalWrite(clockPin, LOW); //stop shifting
}


...but I don't see anything wrong with it offhand.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
hmm..thanks for checking it out. When all the leds light up on the led dot matrix, would that imply that the wiring between the ICs are wrong? I'm confident with all my outputs but the Left IC connects pin 9 to pin 14 on the Right IC. Also, I brought the 74HC595 IC but the data sheet actually writes it as 74HC595N. Perhaps I need to wire it different to the one in the book because of this?
 

SgtWookie

Joined Jul 17, 2007
22,230
I think it's something silly like the data input line is connected to +5v instead of the correct pin on your uC, or maybe a bad spot on your breadboard. If you've been jamming parts in there that have big pins (like TO-220 packaged items) then you may have stretched out some of the holes, and they no longer make good contact.

You might try tearing the whole thing down, moving the IC's to a different place on the breadboard, and then wire everything back up - more neatly this time though.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
I just want to double check something, on the data sheet for the led dot matrix pinout, do the numbers on the left hand side, representing the rows, attach to the first IC? I think I have them the wrong way...I will upload a picture of my led matrix pinout, not sure if I have already
 
Top