Sparkfun’s 7-Segment Red 6.5″ Display and Arduino
A little while ago I purchased 10 of Sparkfun’s 7-segment red 6.5″ displays.
http://www.sparkfun.com/commerce/product_info.php?products_id=8530
I had been wanting to purchase them for quite some time but they had been out of stock. When I was finally notified that they had received more I instantly bought them, without really thinking what I was going to use them for. Once they arrived I quickly opened them up and saw that it was going to be a little bit more of a challenge then I originally thought it would be. And I also thought they would come with some fancy schematic that I could just follow, but they didn’t.
So the first step was just to try and get a segment to light up by just supplying power. The digits use a common anode, which means it has one lead connection and 7 ground connection for each segment. So I started running it through a 5v power supply with not luck. Then a 9v, still no luck. Finally 12v did the trick. After I soldered wires to all of the connection I was able to get all 7 segments to light up by just running the common anode to the power and each segment to a ground.
Ok so step one complete now to try and get it talking with Arduino. Now I wasn’t really sure how to go about doing this since each segment was connected to a ground. So I started digging around on the Arduino forums and found some similar posts on what I was trying to do. My conclusion was that I need to get a shift register to turn each segment on and off. I found some people who had some luck with this display and the Allegro 6278EAT. You can pick some up for $1.55 at Digi Key. There are lots of different LED drivers out there but the reason I chose this one was because I needed to supply 12v to my displays and it sounded like some of the others that people where recommending wouldn’t work.
So after a lot of experimenting and researching I was finally able to get the display to turn on and off with Arduino. This tutorial on the Arduino site was the most helpful. And I used the following Arduino sketch which I got from this post on the forums.
int dataPin = 11; int clockPin = 12; int latchPin = 10; //holders for infromation you're going to pass to shifting function byte dataRED; byte dataArrayRED[11]; 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 dataArrayRED[10] = 0x80; //decimal point } void loop() { for (int i = 0; i<11; i++) { dataRED = dataArrayRED[i]; //ground latchPin and hold low for as long as you are transmitting digitalWrite(latchPin, 0); //move 'em out shiftOut(dataPin, clockPin, dataRED); //return the latch pin high to signal chip that it //no longer needs to listen for information 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< { 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); }
And here is a final diagram for connecting it to Arduino.
NOTE: the diagram shows a 15kohm resistor but it may not be bright enough. If you put a 2.2kohm resistor it will be much brighter
And here is a video of the display counting – http://www.viddler.com/explore/julian/videos/14/
I am working on getting more then one display working and will write a new post when I do




Leave a Reply