Getting started with 7-segment LED displays
Posted by Lance | Posted in Beginner | Posted on 05-05-2010-05-2008
0
I’ve done many of the Arduino tutorials. (The few I haven’t done is because I don’t have all the components–yet–to build them.) As I have been acquiring the parts, there are other projects I’ve seen online that have caught my eye. One that I got the parts to while waiting for others to arrive were some 7-segment LEDs.
7-segment LEDs are actually 8 LEDs (counting the decimal point as LED #8) arranged in that recognizable calculator-esque format. They have 10 pins, one for each segment plus 2 common cathode grounds.
On eBay I found 4 Siemens HD 1133 7-segment red LEDs along with a socket for mounting them, however, the socket is nice to have but is not required for mounting the LEDs on my breadboard.
With so many connections (9 to the Arduino) required to get it working, I was going to have to start with only a single display. However, just to test out the display, a quick search revealed an excellent beginner’s post in the Arduino.cc forum that had an easy to put together circuit & code for 7-segment LED displays. If nothing, I verified that I had made all the proper connections & that the displays were fully functional with the 2 code samples posted.
Moving on to something a little more challenging, I wanted to make the display show numbers, perhaps as a basic counter. That lead me to a tutorial from Hacktronics. I felt that the article was helpful, but I was left to my own devices to write the code other than a big hint as to how to get Arduino to display numbers. Some trial & error came in to play here as I discovered that the documentation for my displays, aside from being hard to read, was completely incorrect with the pinout data. Also, I realized the difference between a LEDs with a common cathode vs. a common anode: the digitalWrite values (HIGH & LOW) are opposite for which ones you are using. With my common cathode LEDs, on is HIGH & off is LOW. (Also, here is an explanation of the difference between a common anode vs. common cathode.)
Code:
From here I am waiting on an order with some 74HC595s. That will allow me to build a circuit with multiple 7-segment LED displays, of course after some initial testing with LEDs. Next time…

