Wednesday, May 15, 2013

16 by 40 Dual Color LED Sign being sold on eBay Part 2

I have finally made the sign work! It takes a slight trick in the code to send the serial bit to the 4015's for the rows.  It is " if (row= =0) digitalWrite(OutEnable, LOW);" in the code.

Here is what it looked like when it first came to life.  I was sending the code for making a smiley face.


This is what it looks like with an Arduino running the code that is listed below.

This is what it looks like connected to an Arduino Pins 1-6, and a 5 volt 2.5 amp AC adapter.  For the schematic and pin connections see my older post on this sign.


Here is the code to make it work;
//********************************************//
//  Name    : LED 24x40 array Driver    
//  Author  : Bob Davis                           
//  Date    : 12 May, 2013                   
//  Version : 1.0                                
//********************************************//
// Pins for the clocks and data
int TCLK = 1;
int TSerial = 5;
int BCLK = 6;
int BSerial = 3;
int Strobe = 4;
int OutEnable = 2;

// arrays to say Arduino
byte Tbitmap[][8] = {  //red characters
  {0,  4, 10, 17, 17, 31, 17, 17}, //A
  {0, 0,0,0,0,0,0,0},
  {0, 28, 18, 17, 17, 17, 18, 28}, //D
  {0, 0,0,0,0,0,0,0},
  {0, 14, 04, 04, 04, 04, 04, 14}, //I
  {0, 17, 25, 25, 21, 19, 19, 17}, //N
  {0, 14, 17, 17, 17, 17, 17, 14}, //O
};
byte Bbitmap[][8] = {  //green characters
  {0,  4, 10, 17, 17, 31, 17, 17}, //A
  {0, 30, 17, 17, 30, 20, 18, 17}, //R
  {0, 0,0,0,0,0,0,0},
  {0, 17, 17, 17, 17, 17, 17, 14}, //U
  {0, 14, 04, 04, 04, 04, 04, 14}, //I
  {0, 0,0,0,0,0,0,0},
  {0, 14, 17, 17, 17, 17, 17, 14}, //O
};
// Set the pins to output to the array
void setup() {
  pinMode(TCLK, OUTPUT);
  pinMode(TSerial, OUTPUT);
  pinMode(BCLK, OUTPUT);
  pinMode(BSerial, OUTPUT);
  pinMode(Strobe, OUTPUT);
  pinMode(OutEnable, OUTPUT);
}
void loop() {
  for (int row = 0; row < 8; row++){   //there are actually 16 rows
    for (int character = 7; character >=0; character--){
      for (int shiftbit = 0; shiftbit < 6; shiftbit++){
      digitalWrite(TSerial, HIGH); 
      digitalWrite(BSerial, HIGH);
      if bitRead(Tbitmap[character][row],shiftbit) digitalWrite(TSerial, LOW); 
      if bitRead(Bbitmap[character][row],shiftbit) digitalWrite(BSerial, LOW); 
      digitalWrite(TCLK, HIGH); 
      digitalWrite(TCLK, LOW);
      digitalWrite(BCLK, HIGH); 
      digitalWrite(BCLK, LOW);
      }   }
    digitalWrite(OutEnable, HIGH);  // turns off display
    if (row==0) digitalWrite(OutEnable, LOW);  // turns on display
    //latch the data
    digitalWrite(Strobe, LOW);  
    digitalWrite(Strobe, HIGH);
    digitalWrite(OutEnable, LOW);  // turns on display
    delay(.5);   
}  }  
Post a Comment