Main Content

Seven-Segment Display Do it Yourself

By soldering separate LEDs together and using Charlieplexing you can control the display with only four digital pins.

Usually, when you need some numerical output, it takes you at least seven pins of your microcontroller (except you use a display with an internal controller). That is because they have common anodes or cathodes. But when you use single LEDs to form a digit you have separate anodes or cathodes and can connect them in your own style. The method made famous by Charlie Allen enables you to switch a huge number of diodes with a fraction of pins. With only 4 pins you could switch 4*(4-1)=12 diodes on and off in multiplex mode. So there is still the possibilty to add a decimal point. Another advantage is you can have it in any size you want.

In this project, I used two red LEDs sized 7 by 2 mm for each of the segments. The resulting height is 32 mm. Always two LEDs are connected in series. If your microcontroller is working at 3.3 volts or your LEDs are green, blue or white do not use two of them in series for each segment. The current for each pin was only 4 milliamps, so I decided to omit the resistors. Unfortunately, when you are using standard breadboards you can not adjust them in an oblique way. (Commercial displays show figures slanted by 10 degrees.)

The software is presented in two flavours: one version for free selection of your controller pins and a faster one that uses pins of one controller port only.”

Link to article