Go Down

Topic: Makershed SMD LED Shield (Read 2 times) previous topic - next topic

rikitheshadow

I recently purchased a SMD LED shield to learn both multiplexing LEDs with shift registers (74HC595) and surface mount soldering. And for the first time at SMD, i think i did a pretty good job soldering. Now I wanted to try their sample coding for this shield to get some ideas......but none of their sample code did anything special or didn't work properly. There shouldn't be any reason none of it would work properly besides faulty coding as I've made my own sample code to test the shield and it worked fine. Honestly, a lot of their sample coding may have looked like it would of done something elaborate, but all i got was all the 8x8 LEDs blinking or a single line of LEDs solidly lit. I've checked the pin outs, there is no additional libraries needed for the 74HC595s, and a lot of the times they enabled serial but did nothing with it. I couldn't even find another individual online who may have built this and coded it as well. So I however, have made my own sample coding, a chase sequence that is pretty compact in terms of coding footprint.

Code: [Select]
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  for (int i = 0; i < 8; i++) {
    byte rowBitsToSend = 0;
    byte columnBitsToSend = 0;
    digitalWrite(latchPin, LOW);
    bitWrite(columnBitsToSend, i, HIGH); //advance and light up column
    shiftOut(dataPin, clockPin, MSBFIRST, columnBitsToSend);
    bitWrite(rowBitsToSend, 8, HIGH); //enables all LEDs in the row
    shiftOut(dataPin, clockPin, MSBFIRST, rowBitsToSend);
    digitalWrite(latchPin, HIGH);
    delay(100);  //controls speed, fastest visible is about a 25ms delay
  }
}


On that note I was wondering if there was anyone that knows of a simple way of addressing each pin of the 74HC595s individually so I can start making some more interesting light sequences?
There was another project I was trying to work on in the past with 74HC595s, but all I ended up doing was using someone's pre-constructed library to make visible numbers with 7 segment LEDs....which on top of that didn't help me learn anything. AND I attempted to chain 2x shiftout registers together and all they would do is hand each other's numbers down to each other.

johnwasser

The only SMD LED shield I can find documentation for is the 9x17 Charlieplexed SMD version of the "LoL Shield".  The makershed.com site shows only "Service Unavailable" for any page I try.

Have you got a pointer to the device you are trying to write sketches for?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

rikitheshadow


The only SMD LED shield I can find documentation for is the 9x17 Charlieplexed SMD version of the "LoL Shield".  The makershed.com site shows only "Service Unavailable" for any page I try.

Have you got a pointer to the device you are trying to write sketches for?


Sorry for delay, thought it would pull up on search easily.

link to product...
http://www.makershed.com/SMD_LED_Arduino_Shield_p/msrjh2.htm

Should be additional links to get to their sample coding on that page.

johnwasser

Very strange.  The board has two shift registers for 64 red LEDs which implies multiplexing but the first example code they point to seems to imply that there are 8 red and 8 green LEDs and each is connected to the output of a shift register.  o.0

The second example seems to much better match the hardware.  If should display a sequence of 6 frames over and over.  Give it a try:

https://raw.github.com/Make-Magazine/SMD-Shield/master/SPW/SMDLEDShield3/SMDLEDShield3.ino

If that works you should be able to use that code to display any sequence of patterns you like.  It is easier to see the patterns when they are written in binary instead of decimal:

Code: [Select]

byte sequence[][8] = {
{
0b11111111,
0b10000001,
0b10000001,
0b10000001,
0b10000001,
0b10000001,
0b10000001,
0b11111111
} ,
{
0b00000000,
0b01111110,
0b01000010,
0b01000010,
0b01000010,
0b01000010,
0b01111110,
0b00000000
} ,
{
0b00000000,
0b00000000,
0b00111100,
0b00100100,
0b00100100,
0b00111100,
0b00000000,
0b00000000
} ,
{
0b00000000,
0b00000000,
0b00000000,
0b00011000,
0b00011000,
0b00000000,
0b00000000,
0b00000000
} ,
{
0b00000000,
0b00000000,
0b00111100,
0b00100100,
0b00100100,
0b00111100,
0b00000000,
0b00000000
} ,
{
0b00000000,
0b01111110,
0b01000010,
0b01000010,
0b01000010,
0b01000010,
0b01111110,
0b00000000
}
};
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

rikitheshadow


Very strange.  The board has two shift registers for 64 red LEDs which implies multiplexing but the first example code they point to seems to imply that there are 8 red and 8 green LEDs and each is connected to the output of a shift register.  o.0

The second example seems to much better match the hardware.  If should display a sequence of 6 frames over and over.  Give it a try:

https://raw.github.com/Make-Magazine/SMD-Shield/master/SPW/SMDLEDShield3/SMDLEDShield3.ino

If that works you should be able to use that code to display any sequence of patterns you like.  It is easier to see the patterns when they are written in binary instead of decimal:

Code: [Select]

byte sequence[][8] = {
{
0b11111111,
0b10000001,
0b10000001,
0b10000001,
0b10000001,
0b10000001,
0b10000001,
0b11111111
} ,
{
0b00000000,
0b01111110,
0b01000010,
0b01000010,
0b01000010,
0b01000010,
0b01111110,
0b00000000
} ,
{
0b00000000,
0b00000000,
0b00111100,
0b00100100,
0b00100100,
0b00111100,
0b00000000,
0b00000000
} ,
{
0b00000000,
0b00000000,
0b00000000,
0b00011000,
0b00011000,
0b00000000,
0b00000000,
0b00000000
} ,
{
0b00000000,
0b00000000,
0b00111100,
0b00100100,
0b00100100,
0b00111100,
0b00000000,
0b00000000
} ,
{
0b00000000,
0b01111110,
0b01000010,
0b01000010,
0b01000010,
0b01000010,
0b01111110,
0b00000000
}
};



Yeah there second sample code doesn't work....it just lights up one whole column and thats it.

I've been looking for an easier method than just decimals. Is that all you would need to type into the code to get it to shift out bytes? I need help implementing something like that for multiple projects. Just trying to get a visual demonstration of the code, I follow and learn better by visual examples.

johnwasser

Since there seem to be no published schematics and no working examples we will have to determine the schematic by experiment.  If you run the following code, exactly what pattern do you get? 

In theory it should light each LED for 1/10th of a second in a regular pattern.  By knowing the pattern you get we can determine what shift-register pins are connected to the various rows and columns

Code: [Select]

const int latchPin = 8;
const int clockPin = 12;
const int dataPin = 11;

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  for (int row = 0; row < 8; row++) {
    for (int column = 0; column < 8; column++) {
      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, MSBFIRST, 1<<column);  // One column HIGH
      shiftOut(dataPin, clockPin, MSBFIRST, ~(1<<row));  // One row LOW
      digitalWrite(latchPin, HIGH);
      delay(100);  //controls speed, fastest visible is about a 25ms delay
    }
  }
}
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

50makro


In theory it should light each LED for 1/10th of a second in a regular pattern.  By knowing the pattern you get we can determine what shift-register pins are connected to the various rows and columns


I have the same issue, Here is  animated gif of what that code looks like in action


I can only get the columns to light up, never the rows.

Riva

Not sure if it's just your gif animation but there is something different about the final column (bottom row as shown in animation)

50makro

#8
Dec 01, 2013, 09:13 pm Last Edit: Dec 01, 2013, 09:43 pm by 50makro Reason: 1
The last column seems to count down individual LEDs.  I used a gif to capture what more accurately what my eye sees.
I should mention that the Animated GIF is not a complete loop, the last column does cycle thru each of the 8 LED individually.
High Res photos of the shield front and back:


johnwasser

Try swapping the Row and Column registers by changing:
Code: [Select]

      shiftOut(dataPin, clockPin, MSBFIRST, 1<<column);  // One column HIGH
      shiftOut(dataPin, clockPin, MSBFIRST, ~(1<<row));  // One row LOW

to:
Code: [Select]

      shiftOut(dataPin, clockPin, MSBFIRST, ~(1<<row));  // One row LOW
     shiftOut(dataPin, clockPin, MSBFIRST, 1<<column);  // One column HIGH


See what pattern you get then.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

50makro


Try swapping the Row and Column registers by changing:
Code: [Select]

      shiftOut(dataPin, clockPin, MSBFIRST, ~(1<<row));  // One row LOW
     shiftOut(dataPin, clockPin, MSBFIRST, 1<<column);  // One column HIGH

See what pattern you get then.


Its rather strange result. I have feeling the second 595 is NOT sending out a "High". The last row is cycling a LED off from top to bottom

The last column is cycling a LED off from top to bottom.

johnwasser

OK, let's try swapping polarity (HIGH for LOW) by changing:
Code: [Select]

      shiftOut(dataPin, clockPin, MSBFIRST, ~(1<<row));  // One row LOW
     shiftOut(dataPin, clockPin, MSBFIRST, 1<<column);  // One column HIGH

to:
Code: [Select]

      shiftOut(dataPin, clockPin, MSBFIRST, 1<<row);  // One row LOW
     shiftOut(dataPin, clockPin, MSBFIRST, ~(1<<column));  // One column HIGH
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

50makro

Code: [Select]

const int latchPin = 8;
const int clockPin = 12;
const int dataPin = 11;

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  for (int row = 0; row < 8; row++) {
    for (int column = 0; column < 8; column++) {
      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, MSBFIRST, 1<<row);  // One row LOW
      shiftOut(dataPin, clockPin, MSBFIRST, ~(1<<column));  // One column HIGH
      digitalWrite(latchPin, HIGH);
      delay(60);  //controls speed, fastest visible is about a 25ms delay
    }
  }
}


Woah! Well I see the last column has some potential. Still no full Rows. The Columns cycle completl

johnwasser

I'm not sure but I think maybe that bizarre pattern might come from the Clock and Data pins being swapped.  Try switching them to:
Code: [Select]

const int latchPin = 8;
const int clockPin = 11;
const int dataPin = 12;
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

50makro

#14
Dec 03, 2013, 11:11 pm Last Edit: Dec 03, 2013, 11:41 pm by 50makro Reason: 1

I'm not sure but I think maybe that bizarre pattern might come from the Clock and Data pins being swapped.  Try switching them to:
Code: [Select]

const int latchPin = 8;
const int clockPin = 11;
const int dataPin = 12;



Zero LED's lit up. I will manually test the Clock and Data pins.
BTW: found the datasheet on the Two 595 http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf

Go Up