Using The Big Digit Driver

From Evil Mad Scientist Wiki
Revision as of 12:30, 10 August 2011 by Windell (talk | contribs)
Jump to: navigation, search

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

Safety

The Big Digit Driver is an electrical device that uses voltages and currents in excess of used by many hobby electronics projects. Care should be taken to avoid touching or shorting out any exposed traces, pins, or contacts when the BDD is powered. You should also be aware that 12" displays, including those sold by Evil Mad Science, commonly have uninsulated traces on their back sides.

Important note: Components on the BDD - especially the LM317 current regulators - will run very hot during normal use. Allow to cool before handling.


Power

A single 12 inch LED display (Model BL-SE1200B-11UHR, red), when attached to a BDD, uses about 0.7 amps at 36 volts DC. Do not exceed 40 V DC input at the BDD input.

The BDD has two methods for accepting power: a 2.1 mm 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.

Plug-in power supplies must not be connected to each other, through a BDD or otherwise. If you are using a large number of digit in series, the series should instead be split into group of digits, each with their own power supply.

We recommend this power supply (36 V DC, 0.7 A)-- one power supply per digit --for powering individual 12" digits in a controlled (e.g., indoor) environment.

For powering a single 12" digit in an outdoor installation, we recommend using a weatherproofed power supply like the Meanwell LPV-35-36. For powering a large number of digits, particularly outdoors, we recommend using a weatherproofed power supply like the Meanwell HLG-240-36. Note that neither the BDD nor the 12" digits are themselves weatherproofed. For outdoor installation, they should be housed in a shaded weatherproof box similar to the type used for traffic signals.

Note: If custom power wiring is needed, always consult with professional electrician.


Communication

The BDD has a 3-wire serial (SPI) interface, with inputs and outputs that can be daisy chained. The interface was designed with the Arduino platform in mind, and thus has a 6 pin (2x3 DIL) header that matches the SPI (aka ICSP/ISP) header found on most Arduino and other AVR-microcontroller based development boards. For the purposes of discussion, we will refer to the controller as an "Arduino," however any AVR or other microcontroller with an SPI interface can be used as well.)

To connect an Arduino to a BDD, use a suitable cable to connect the SPI header on the Arduino to the SPI input header on the BDD. Ensure that you have the ribbon cable polarity is correct: Pin 1 of the ribbon cable is usually marked with a red stripe on one side, and a little arrow on the connector. On the BDD, pin 1 of both SPI headers is marked with a large triangle. On the Arduino side, pin 1 of the 6-pin connector may be marked with a stripe, the number "1" or another indication of polarity.


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, along with corresponding pinouts on an Arduino board.

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

BDD boards are designed to allow you to control a large number of digits from a single controller (e.g., Arduino). One Arduino can control a string of potentially dozens of BDDs, each of which is attached to a single 12" LED digit.

To propagate data and clock signals down a series of displays, BDD boards can be daisy chained by connecting the "output" SPI header of one BDD to the "input" SPI header of the next BDD, using 6-pin (2x3) ribbon cables. (One such cable is included with every kit.) When looking at the printed side of a BDD board, the input SPI header is on the left side and the output SPI header is on the right side. Take care to notice the location of pin 1 on both SPI headers (marked with an arrow) so that communication works correctly.

Power distribution in large arrays of digits can be a challenge. To make this easier, DC power can also (to a more limited extent) be daisy chained through a series of digits. As mentioned earlier, the BDD can carry up to five amps, allowing up to seven displays in series from a single power supply, provided that the power is connected in and out through the screw terminals on either side.


Code Examples

Arduino

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