ohmio

Circuits / Microcontrollers

Arduino UNO: a 7-segment display counts 0 to 9

Seven LEDs to one common pin, each with its own resistor: a digit is the set of segments the program lights

Arduino UNO: a 7-segment display counts 0 to 9, simulated on a breadboard

Tap a part to see its voltages and currents. It is a model, not a measurement.

What do you need?

How does an Arduino show a number on a 7-segment display?

A 7-segment display is seven LEDs shaped like bars, named a to g, plus a decimal point this circuit leaves unused. In the 5161AS all the cathodes meet at a common pin, which goes to GND, so a HIGH on a pin lights its segment. Pins D2 to D8 each drive one segment through its own 220 Ω resistor, giving about 11.5 mA. A digit is just a set of segments, and the program stores each set as a number whose bits say which ones light: 63 is binary 0111111; from the right, segments a to f, the digit 0. Every second it writes the seven bits of the next digit. The digit 1 lights two segments and draws about 23 mA; the digit 8 lights all seven and draws about 80 mA, all of it through the common pin. One shared resistor on that pin would be cheaper, but the segments would split its current, so an 8 would look dimmer than a 1.

Values from the Protoboard ISO simulation: a model, not a bench measurement.