Using The Big Digit Driver

From Evil Mad Scientist Wiki
Revision as of 16:32, 15 June 2011 by Dhembry (talk | contribs)
Jump to: navigation, search

This page covers basic usage of the Evil Mad Science Big Digit Driver (BDD).


Power

A single 12 inch LED display (as sold by Evil Mad Science), when attached to a BDD, uses about 0.7 amps at 36 volts DC. Do not exceed 40 volts when using the BDD.

The BDD has two methods for accepting power: a 2.1mm barrel jack (center positive), and a pair of screw terminals. The barrel jack has a power rating suitable only for powering a single digit and should NOT be used for powering a series of digits. The two screw terminals on the board are for attaching a power supply in permanent installations and for powering a series of digits in a 'daisy chain' configuration. Do not exceed five amps of current through any given board.

Do not connect multiple power supplies to one BBD. If you are using a large number of digit in series, the series should be split into group of digits, each with their own power supply. Do not wire power supplies in parallel! This may damage your BDD's and/or the power supplies and/or you.

For powering a single display and BDD in a permanent installation Evil Mad Science recommends using a weather-proofed power supply like the Meanwell LPV-35-36.

For power a large number of displays and BDDs, Evil Mad Science recommends using a weather-proofed power supply like the Meanwell HLG-240-36.

Note: Evil Mad Science LLC does not provide support for any power supply we do not sell. We recommend that users acquire the services of a professional electrician when installing or maintaining custom power wiring.


Communication

The Big Digit Driver (BDD) was designed with the Arduino platform in mind and thus has a 6 pin (2x3 DIL) header that matches the SPI header found on most Arduino boards. The Arduino can manipulate the pins connected to its SPI header like any of its other pins, and the header makes a handy attachment point. To connect an Arduino to a BDD, use a suitable cable to connect the SPI header on the Arduino to the SPI header on the BDD. Take care to note the placement of pin one on both the Arduino and BDD. The BDD marks pin one on each of its SPI headers with a large triangle.

The BDD contains a simple eight bit shift register hooked up to the header. Data is shifted in by setting the MOSI pin high or low, and then pulsing the SCK pin to clock the data in. The shift register we use (a 74595) also has a latch between the shift register and the outputs. This allows us to change the contents of the shift register but not 'display' that data until we've finished clocking in all the data. A pulse the MISO pin will copy data to the latches and thus the outputs.

Here is an overview of the various signals used by the BDD:

ATMega IC Pin ATMega Port Arduino Pin SPI Symbol BDD Shift Register Function
19 PB5 Digital 13 SCK Register Clock
18 PB4 Digital 12 MISO Latch Clock
17 PB3 Digital 11 MOSI Serial Data In


Data Format

The display this driver was designed to work with has eight segments: seven segments to display digits zero through nine, and one segment for a decimal point. Each bit in the shift register controls a segment:

Bit 7 6 5 4 3 2 1 0
Segment DP G F E D C B A

segments.png


The following table provides a list of characters and their associated bit pattern:

Symbol Decimal Hex Binary
0 63 0x3F 00111111
1 6 0x06 00000110
2 91 0x5B 01011011
3 79 0x4F 01001111
4 102 0x66 01100110
5 109 0x6D 01101101
6 125 0x7D 01111101
7 7 0x07 00000111
8 127 0x7F 01111111
9 111 0x6F 01101111
A 119 0x77 01110111
b 124 0x7C 01111100
C 57 0x39 00111001
d 94 0x5E 01011110
E 121 0x79 01111001
F 113 0x71 01110001


Driving A Series Of Digits

The BDD is designed to be used to drive a large number of digits from a single controller (Arduino or otherwise). As mentioned above, the BDD can carry up to five amps, allowing up to seven displays in series from a single power supply. To propagate data and clock signals down a series of displays BDD boards can be 'daisy chained' by connecting the 'output' SPI header of a display to the 'input' SPI header of the next display in the series. When looking at the silkscreen side of a BDD board (with the text right way up) the input SPI header is on the left-hand side. The output SPI header is on the right-hand side. Ensure that you have the data cables attached correctly. On the BDD, pin one of both SPI headers is marked with a large triangle. We recommend using the Schmitt trigger included with the BDD kit, even for short runs of digits. Refer to the assembly instructions for more information.


Code Examples

Arduinio

Display 123456

This block of code will display the string '123456' on a series of six displays.

//This sketch will push the string '123456' out to a series of Big Digit Drivers.

void setup() {                
  pinMode(13, OUTPUT);    //SH_CP/SCK    Shift register clock
  pinMode(12, OUTPUT);    //SR_CP/MISO   Latch Clock
  pinMode(11, OUTPUT);    //DS/MOSI      Serial data in
  
  //Blank out the register
  shiftOut(11, 13, MSBFIRST, 0x00);
  digitalWrite(12, HIGH);
  digitalWrite(12, LOW);
}

void loop() {
  shiftOut(11, 13, MSBFIRST, 0x06);  //'1'; segments B and C, or b00000110
  shiftOut(11, 13, MSBFIRST, 0x5B);  //'2'; segments A, B, D, E, G or b01011011
  shiftOut(11, 13, MSBFIRST, 0x4F);  //'3'; segments A, B, C, D, G, or b01001111
  shiftOut(11, 13, MSBFIRST, 0x66);  //'4'; segments B, C, F, G, or b01100110
  shiftOut(11, 13, MSBFIRST, 0x6D);  //'5'; segments A, C, D, F, G, or b01101101
  shiftOut(11, 13, MSBFIRST, 0x7D);  //'6'; segments A, C, D, E, F, G, or b01111101

  //Pulse the latch clock to load the output
  digitalWrite(12, HIGH);  
  digitalWrite(12, LOW);

  delay(1000);

}//End loop

Test Pattern

This block of code will turn half of the segments on, (other) half of the segments on, turn on all the segments, and then turn all segment off. Loops indefinitely. If used on a series of digits, you should see each stage of the pattern work its way down the line.

//This sketch cycles through four states (half on, other half on, all on, all off) to test all segments of display.

byte data = 0x00;
int state = 0;


void segout(byte data) { 
  //Shift data out to shift register
  shiftOut(11, 13, MSBFIRST, data);

  //Pulse the latch clock to load the output
  digitalWrite(12, HIGH);  
  digitalWrite(12, LOW);
}

void setup() {                
  pinMode(13, OUTPUT);    //SH_CP/SCK    Shift register clock
  pinMode(12, OUTPUT);    //SR_CP/MISO   Latch Clock
  pinMode(11, OUTPUT);    //DS/MOSI      Serial data in
  
  //Blank out the register
  shiftOut(11, 13, MSBFIRST, 0x00);
  digitalWrite(12, HIGH);
  digitalWrite(12, LOW);
}

void loop() {
     switch (state) {
      case 0:
          data = 0xAA;   //b10101010
          state = 1;
        break;

      case 1:
          data = 0x55;  //b01010101
          state = 2;
        break;
        
      case 2:
          data = 0xFF;  //b11111111
          state=3;
        break;
        
      case 3:
          data = 0x00;  //b00000000
          state=0;
        break;

    }//End switch
    
    //Write the data to the shift register
    segout(data);

  delay(2000);

}//End loop