 Segmented LED displays look kind of old school and are a fun way to add a readout display to your project.

7 segment displays which can display numbers and some letters, and 16 segment displays can display the full alphabet. Displays can be either Common Cathode (shared – or ground) or Common Anode (shared + or power). On a regular LED, the shorter leg is the cathode and goes to ground, and the longer leg is the anode and goes to power. In these displays, you can’t see that, so you need to find the datasheet or google the part #, or just try both and see which works.

### Common Cathode 7-segment Display

In the Common Cathode (CC) display, all the cathode connections of the LED segments are joined together to ground. The individual segments are illuminated by sending positive voltage or HIGH signal via a current limiting resistor (with an Arduino this would be +5V).

### Common Anode 7-segment Display

In the Common Anode (CA) display, all the anode connections of the LED segments are joined together to power (with an Arduino this would be +5V). The individual segments are illuminated by applying a ground or LOW signal via a current limiting resistor to the Cathode of the particular segment (a-g).

In general, common anode displays are more popular because many logic circuits can sink more current than they can source. Also note that a common cathode display is not a direct replacement in a circuit for a common anode display and vice versa, as it is the same as connecting the LEDs in reverse, so they won’t light up.

If you’re sending +5V to the segments, you can use the same Ohm’s Law calculation you use for regular LEDs. So a 220 to 330 ohm resistor should be fine.

### Pinouts

Note that the pin diagram of the display above is shown schematically, i.e. abstracted and clean and neat, and may have no correspondence to where the actual pins are on your display. Here is an example of a pinout diagram, where pins 3 and 8 are either the Common Anode or Common Cathode pins, depending on your display type (for convenience only one of those pins needs to be connected): Here is another example, the one on the left is the same as above, just drawn a different way. The one on the right shows a style with pins on top and bottom instead of left and right: ### Lighting them up

To display the numerical digit 3, for example, we will need to light up six of the LED segments corresponding to a, b, c, d, and g. Then the various digits from 0 through 9 can be displayed using a 7-segment display as shown. You can also display a few letters with a 7 segment display: You could do this on a breadboard with switches, for example with a common anode display: But most likely you will want to do this with an Arduino turning those segments on and off. With a common anode display, you would make each pin LOW to turn it on; with a common cathode display you would make high pin HIGH to turn it on.

Here is an example schematic showing an Arduino with a Common Cathode display: On a breadboard that might look like one of these:  ### Programming

For convenience, and eventual to program nice functions, we can produce a truth table giving the individual segments that need to be illuminated in order to produce digits 0 through 9:

 Decimal Digit Individual Segments Illuminated a b c d e f g 0 × × × × × × 1 × × 2 × × × × × 3 × × × × × 4 × × × × 5 × × × × × 6 × × × × × × 7 × × × 8 × × × × × × × 9 × × × × ×

Try writing your own arrays or functions to display each digit. Here is some help: http://www.hacktronics.com/Tutorials/arduino-and-7-segment-led.html – this is just one way to do it, there are many methods, google for more.

Here is a library someone wrote that extends that idea to work with any kind of display: http://playground.arduino.cc/Main/SevenSegmentLibrary