I got me a bunch of 7seg LED boards from sureelectronics and I expected them to have some “smarts” on them even as they are fairly cheap. Now, the nasty buggers come without any documentation so it took me a bit to figure out how they are connected and how to drive them.

The modules take 12V and 3 inputs, data, clock and something called DIMM. After bit of checking out the schematic it looks like this:

DE-DP22811 2.3" Two Digits 7-Segment LED Information Board MTO schematic

DE-DP22811 2.3" Two Digits 7-Segment LED Information Board MTO schematic

So, the data line goes directly into data input of the 74HC164 (it is one from NXP on the boards I have) shift register, clock for some reason goes trough a double NAND and finally the DIMM goes also trough double NAND and then controls the current trough modules. When DIMM line is high the 7segment led will be dimmed (almost off).

For some reason, who ever designed this board decided to go with 74HC164 instead with 74HC595 and to add DIMM instead of latch… donno what to say, I really like latch more then this dimm solution, but it works like this too..

Note that schematic is just something I drawn (at 6am so don’t be too rush on me, I know that according to this schematic dimm low would dimm the segments but it is really not important). What is not on the schematic is “irrelevant” for driving the bastard, the 7seg’s are not connected directly too 12V and to shift register but shift register drives the ULN2003 that then sinks the current for the 7segs, of course there are some current limiting resistors and also a 5V regulator for the onboard electronics. There is also some circuitry (4 transistors plus some extra passive components) that gets the dimm line high dimms the segments but it is too early/late and I really need sleep and is not important really “how” it works… important is “what it does” and how to control it.

Here is also a sample code (for pic16F690 – chosen this one as I had it on the table from some manual I made for a friend yesterday) :

#include <16F690.h>
#device adc=8
#case
#use fast_io(C)

#FUSES NOWDT
#FUSES INTRC_IO
#FUSES NOPROTECT
#FUSES NOBROWNOUT
#FUSES NOMCLR
#FUSES NOCPD
#FUSES NOPUT
#FUSES NOIESO
#FUSES NOFCMEN  

#use delay(clock=8000000)

//define data, clock and blank pin
#define DATAPIN PIN_C0
#define CLOCKPIN PIN_C1
#define BLANKPIN PIN_C2

//define clock delay routine. the display comes with
//NXP 74HC164 so minimal pulse width at 5V is 24ns
//a single nop takes much longer at 8MHz clock (500ns)
#define clkdelay() #asm ASIS nop #endasm

//   0
// 5   1
//   6
// 4   2
//   3    7

unsigned int8 digit[10] = {
  0x3F,
  0x06,
  0x5B,
  0x4F,
  0x66,
  0x6D,
  0x7D,
  0x07,
  0x7F,
  0x6F
};

void clean(){
  int8 i;
  output_low(DATAPIN);
  for(i=0;i<100;i++){
    output_high(CLOCKPIN);
    clkdelay();
    output_low(CLOCKPIN);
    clkdelay();
  }
}

void sendDigit(signed int8 d){
  int8 x;

  if (d<0){
    output_high(DATAPIN);
    d = -d;
  }else{
    output_low(DATAPIN);
  }
  if (d > 9) d=0;
  x = digit[d];

  //send DP
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x40){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x20){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x10){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x08){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x04){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x02){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x01){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);
}

void main()
{
   int16 i;
   int8 a,b,c,d;

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_oscillator(OSC_8MHZ);

   set_tris_c(0);
   clean();   

   while(1){

     //single module
     for (i=0;i<100;i++){
       output_high(BLANKPIN);
       sendDigit(i%10);
       sendDigit(i/10);
       output_low(BLANKPIN);
       delay_ms(100);
     }

     for (i=0;i<10000;i++){
       a = i%10;
       b = (i/10)%10;
       c = (i/100)%10;
       d = (i/1000)%10;
       output_high(BLANKPIN);
       sendDigit(a);
       sendDigit(b);
       sendDigit(c);
       sendDigit(d);
       output_low(BLANKPIN);
       delay_ms(100);
     }
   }
}

I hope you use it well :)

Another interesting thing is the power consumption. The two modules take up to 750mA when powered from 12V. The brightness is great but so is the power consumption. Depending on how many segments are shown (600mA exactly with 12 source and 8584 on display)  the consumption goes down (for e.g. for 1413 on display the usage is 360mA). What I found is that when I power it from 9V the brightness is still great (almost as strong as with 12V) but the power consumption almost drops 50% so the same settings only 9V the power draw when 8584 is on display is 330mA (when 1413 is on display the power usage is 200mA). As you are “dimming” the display while updating it it the current draw drops a bit but so does the brightness. After some testing I believe 9V is perfect psu for this board.