2 Sparkfun’s 7-Segment Red 6.5? Display and Arduino

A few weeks ago I posted about connecting Sparkfun’s 7-Segment 6.5″ Display’s to Arduino. In that post I only showed how to hook up 1 digit. In this post I will show how to hook up 2, but it scales to however many you want to add. Much of the same applies from my previous post but here are new diagrams and code.

int dataPin = 11;
int clockPin = 12;
int latchPin = 8;
int len = 10;
//holders for infromation you're going to pass to shifting function
byte dataRED;
byte dataArrayRED[10];
byte off = 0x00;
byte decimalpoint = 0x80;
void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  //Arduino doesn't seem to have a way to write binary straight into the code
  //so these values are in HEX.  Decimal would have been fine, too.
  dataArrayRED[0] = 0x3F; //00111111 - 0
  dataArrayRED[1] = 0x06; //00000110 - 1
  dataArrayRED[2] = 0x5B; //01011011 - 2
  dataArrayRED[3] = 0x4F; //01001111 - 3
  dataArrayRED[4] = 0x66; //01100110 - 4
  dataArrayRED[5] = 0x6D; //01101101 - 5
  dataArrayRED[6] = 0x7D; //01111101 - 6
  dataArrayRED[7] = 0x07; //00000111 - 7
  dataArrayRED[8] = 0x7F; //01111111 - 8
  dataArrayRED[9] = 0x67; //01100111 - 9
void loop() {
int count = 100;
int val = 10; //this is for how many digits
for( int i = 0; i<count; i++ )
  digitalWrite(latchPin, 0);
   int digit2 = i % val;
  int digit1 = ( i - digit2 ) / val;
    shiftOut(dataPin, clockPin, dataArrayRED[ digit2 ]);
    shiftOut(dataPin, clockPin, dataArrayRED[ digit1 ]);
  digitalWrite(latchPin, 1);
// the heart of the program
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first,
  //on the rising edge of the clock,
  //clock idles low
  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);
  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);
  //for each bit in the byte myDataOut…
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights.
  for (i=7; i>=0; i--)  
    digitalWrite(myClockPin, 0);
    //if the value passed to myDataOut and a bitmask result
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000
    // and proceeds to set pinState to 1.
    if( myDataOut & (1<<i) ) 
	pinState= 1;
	pinState= 0;
    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);
  //stop shifting
  digitalWrite(myClockPin, 0);

I also have a video uploaded on viddler

Now that I have this up and running I just have to do something useful with it. And I have to find a better way to solder the digits, because there are wires everywhere.

Continue reading » · Written on: 06-19-09 · 13 Comments »

13 Responses to “2 Sparkfun’s 7-Segment Red 6.5? Display and Arduino”

  1. D.J. wrote:

    I am considering using these 7-segment displays for an arduino driven backyard scoreboard (for horse shoes, bags, washers, etc.), but I was wondering how visible they would be in the direct sunlight. Have you tried them outside? If so, any information that you could provide regarding how visible they are in the sunlight would be much appreciated. Thanks!

    July 23rd, 2009 at 11:38 pm
  2. julian wrote:

    I haven’t tried them in the sun but they are fairly bright in my sunny room. I’d take them outside for you but weather forecast isn’t calling for sun for a few days.

    July 24th, 2009 at 9:11 am
  3. D.J. wrote:

    If you have a chance to try them outside in the direct sunlight sometime I would appreciate hearing the results. I have ordered a 2.25″ display from digikey that appears from the datasheet to be pretty bright, but if it doesn’t work these 6.5″ ones might be my next attempt. Thanks!

    July 27th, 2009 at 11:33 pm
  4. D W wrote:

    Nice write up! thanks for the work.
    I hate to ask. but how would one go
    about scaling the code up for
    more displays? I’ve already figured
    out how to control these with a pot
    and was wondering what the scale up
    process would be?

    October 4th, 2009 at 2:57 pm
  5. Jacob wrote:

    Sorry this code is completely over my head, but can it only be used as a clock to count upward?

    I’d like to use 4 7-segments to display a number that a different part of the program comes up with.

    Could you help me with this please? I’d like to understand it, but I’m still a novice.

    June 19th, 2010 at 10:38 am
  6. David Herbert wrote:

    Very interesting. I remembered messing with Shift Registers using Arduino as well. But I never expected them to be powerful enough to power a 6.5″ 7 Segment LED.

    July 11th, 2010 at 8:35 am
  7. Ken G wrote:

    David, if I understand what you’re saying the shift register is not driving the display. There is a separate 12 volt power line depicted in his picture. This separate power actually drives the display. The Arduino is simply twiddling the control lines which requires very little power.

    September 30th, 2010 at 8:39 am
  8. Grody wrote:

    Oh, but it does have a way. The preface is 0b. For example, 0b11111111 = 255.

    April 1st, 2011 at 2:29 pm
  9. Tai Johnson wrote:

    I was hoping you could explain to me how to integrate 2 more of these into the code. I am making a Time display and only need four digits (no colon in the middle). I see you have created 2 variables called digit1 and digit2. How would I add the few extra lines to push the bits thru to 2 other segments? Thank you tons for any help.

    August 15th, 2012 at 7:33 pm
  10. Julian wrote:


    It should be pretty straight forward to do. Basically you send call the shiftOut() function in the order from the last digit in the sequence to the first.

    For example, if the time was 12:59 you would do the following.

    shiftOut(dataPin, clockPin, dataArrayRED[ 9 ]);
    shiftOut(dataPin, clockPin, dataArrayRED[ 5 ]);
    shiftOut(dataPin, clockPin, dataArrayRED[ 2 ]);
    shiftOut(dataPin, clockPin, dataArrayRED[ 1 ]);

    The digit1 and digit2 variables where just used so that I could put this in a loop and based on the “i” variable I could figure out what the first and second digit would be in a 2 digit number.

    Hope that helps.

    August 15th, 2012 at 7:46 pm
  11. Ryan wrote:

    Would I have to change the wiring to make this a two digit count down timer?

    November 13th, 2012 at 5:07 pm
  12. Dominic wrote:

    help us thinking a unique project about 7 segment using combinations circuit…

    February 27th, 2013 at 11:45 pm
  13. Dominic wrote:

    hope you will help us…

    Thank you

    February 27th, 2013 at 11:48 pm

Leave a Reply