8x8 led dot matrix

Discussion in 'The Projects Forum' started by u-will-neva-no, Aug 11, 2011.

  1. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    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!
     
  2. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    Here are the pictures, Very messy...It may help though..Also, ignore that blue wire in the second image, its a loose wire and is not connected to anything.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
  4. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    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!
     
  5. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    Do you know any software where I could have an image of a breadboard, chips and wires to show the schematic?
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
    u-will-neva-no likes this.
  7. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    Here attached is the layout of my breadboard circuit and i am using the 8x8 led dot matrix which is attached in the second image.
     
  8. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    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.)
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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
     
    u-will-neva-no likes this.
  10. chejian6

    New Member

    May 22, 2011
    10
    1
    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.
     
    u-will-neva-no likes this.
  11. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    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.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
    u-will-neva-no likes this.
  13. u-will-neva-no

    Thread Starter Member

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

    Code ( (Unknown Language)):
    1.  
    2. // Project 19-beginning arduino
    3. #include <TimerOne.h>
    4. int latchPin = 8; //Pin connected to Pin 12 of 74HC595 (Latch)
    5. int clockPin = 12; //Pin connected to Pin 11 of 74HC595 (Clock)
    6. int dataPin = 11; //Pin connected to Pin 14 of 74HC595 (Data)
    7. byte led[8]; // 8 element unsigned integer array to store the sprite
    8.  
    9. void setup() {
    10. pinMode(latchPin, OUTPUT); // set the 3 digital pins to outputs
    11. pinMode(clockPin, OUTPUT);
    12. pinMode(dataPin, OUTPUT);
    13. led[0] = B11111111; // enter the binary representation of the image
    14. led[1] = B10000001; // into the array
    15. led[2] = B10111101;
    16. led[3] = B10100101;
    17. led[4] = B10100101;
    18. led[5] = B10111101;
    19. led[6] = B10000001;
    20. led[7] = B11111111;
    21. // set a timer of length 10000 microseconds (1/100th of a second)
    22. Timer1.initialize(10000);
    23. // attach the screenUpdate function to the interrupt timer
    24. Timer1.attachInterrupt(screenUpdate);
    25. }
    26. void loop() {
    27. for (int i=0; i<8; i++) {
    28. led[i]= ~led[i]; // invert each row of the binary image
    29. }
    30. delay(500);
    31. }
    32. void screenUpdate() { // function to display image
    33. byte row = B10000000; // row 1
    34. for (byte k = 0; k < 9; k++) {
    35. digitalWrite(latchPin, LOW); // open latch ready to receive data
    36. shiftIt(~led[k] ); // shift out the LED array (inverted)
    37. shiftIt(row ); // shift out row binary number
    38. // Close the latch, sending the data in the registers out to the matrix
    39. digitalWrite(latchPin, HIGH);
    40. row = row << 1; // bitshift left
    41. }
    42. }
    43.  
    44. void shiftIt(byte dataOut) { // Shift out 8 bits LSB first, on rising edge of clock
    45. boolean pinState;
    46. digitalWrite(dataPin, LOW); //clear shift register read for sending data
    47. for (int i=0; i<8; i++) { // for each bit in dataOut send out a bit
    48. digitalWrite(clockPin, LOW); //set clockPin to LOW prior to sending bit
    49. // if the value of DataOut and (logical AND) a bitmask
    50. // are true, set pinState to 1 (HIGH)
    51. if ( dataOut & (1<<i) ) {
    52. pinState = HIGH;
    53. }
    54. else {
    55. pinState = LOW;
    56. }
    57. //sets dataPin to HIGH or LOW depending on pinState
    58. digitalWrite(dataPin, pinState);
    59. digitalWrite(clockPin, HIGH); //send bit out on rising edge of clock
    60. digitalWrite(dataPin, LOW);
    61. }
    62. digitalWrite(clockPin, LOW); //stop shifting
    63. }
    64. [/i][/i]
     
  14. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    @chejian6, did you use an arduino uno or an arduino mega when doing this project?
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, I indented your code for you:

    Code ( (Unknown Language)):
    1. // Project 19-beginning arduino
    2. #include <TimerOne.h>
    3. int latchPin = 8;  //Pin connected to Pin 12 of 74HC595 (Latch)
    4. int clockPin = 12; //Pin connected to Pin 11 of 74HC595 (Clock)
    5. int dataPin = 11;  //Pin connected to Pin 14 of 74HC595 (Data)
    6. byte led[8];       // 8 element unsigned integer array to store the sprite
    7.  
    8. void setup() {
    9.    pinMode(latchPin, OUTPUT); // set the 3 digital pins to outputs
    10.    pinMode(clockPin, OUTPUT);
    11.    pinMode(dataPin, OUTPUT);
    12.    led[0] = B11111111; // enter the binary representation of the image
    13.    led[1] = B10000001; // into the array
    14.    led[2] = B10111101;
    15.    led[3] = B10100101;
    16.    led[4] = B10100101;
    17.    led[5] = B10111101;
    18.    led[6] = B10000001;
    19.    led[7] = B11111111;
    20.    // set a timer of length 10000 microseconds (1/100th of a second)
    21.    Timer1.initialize(10000);
    22.    // attach the screenUpdate function to the interrupt timer
    23.    Timer1.attachInterrupt(screenUpdate);
    24. }
    25. void loop() {
    26.    for (int i=0; i<8; i++) {
    27.       led[i]= ~led[i]; // invert each row of the binary image
    28.    }
    29.    delay(500);
    30. }
    31. void screenUpdate() { // function to display image
    32.    byte row = B10000000; // row 1
    33.    for (byte k = 0; k < 9; k++) {
    34.       digitalWrite(latchPin, LOW); // open latch ready to receive data
    35.       shiftIt(~led[k] ); // shift out the LED array (inverted)
    36.       shiftIt(row ); // shift out row binary number
    37.       // Close the latch, sending the data in the registers out to the matrix
    38.       digitalWrite(latchPin, HIGH);
    39.       row = row << 1; // bitshift left
    40.    }
    41. }
    42.  
    43. void shiftIt(byte dataOut) { // Shift out 8 bits LSB first, on rising edge of clock
    44.    boolean pinState;
    45.    digitalWrite(dataPin, LOW); //clear shift register read for sending data
    46.    for (int i=0; i<8; i++) { // for each bit in dataOut send out a bit
    47.       digitalWrite(clockPin, LOW); //set clockPin to LOW prior to sending bit
    48.       // if the value of DataOut and (logical AND) a bitmask
    49.       // are true, set pinState to 1 (HIGH)
    50.       if ( dataOut & (1<<i) ) {
    51.          pinState = HIGH;
    52.       }
    53.       else {
    54.          pinState = LOW;
    55.       }
    56.       //sets dataPin to HIGH or LOW depending on pinState
    57.       digitalWrite(dataPin, pinState);
    58.       digitalWrite(clockPin, HIGH); //send bit out on rising edge of clock
    59.       digitalWrite(dataPin, LOW);
    60.    }
    61.    digitalWrite(clockPin, LOW); //stop shifting
    62. }[/i][/i]


    ...but I don't see anything wrong with it offhand.
     
    u-will-neva-no likes this.
  16. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    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?
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
    u-will-neva-no likes this.
  18. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    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
     
  19. u-will-neva-no

    Thread Starter Member

    Mar 22, 2011
    230
    2
    Here is my led dot matrix pinout.
     
  20. RRITESH KAKKAR

    Senior Member

    Jun 29, 2010
    2,831
    89
    Sorry guys, i can't help you b'coz i have no idea of Mr. Arudino......!!
     
    u-will-neva-no likes this.
Loading...