Using The Big Digit Driver

From Evil Mad Scientist Wiki
Revision as of 18:52, 14 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 powering a series of digits and they are intended to be used to 'daisy chain' power through multiple BDD boards. (That is, a power supply may be attached to one side of BDD-A, and BDD-B may be wired to the opposite side of BDD-A.) Do not exceed five amps of current through any given board - this is enough to run seven digits.

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.

(Power supply recommendations?)

(Isolating board ground from SPI ground?)


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


Segments

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

(Segment diagram image here.)


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

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