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); delay(300); delay(1000); } } // 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… //NOTICE THAT WE ARE COUNTING DOWN in our for loop //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; } else { 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 · 8 Comments »


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 pmI 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 amIf 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 pmNice write up! thanks for the work.
October 4th, 2009 at 2:57 pmI 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?
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 amVery 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 amDavid, 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 amOh, but it does have a way. The preface is 0b. For example, 0b11111111 = 255.
April 1st, 2011 at 2:29 pm