As a circuit neophyte I thought for a circuit to conduct current it had to be grounded.
2 Answers
The Uno is grounded. Current flows into the A-G and DP pins (that is: D2, D3, D4, D5, D6, D6, D8, and D9 on the Uno) when one of those pins is LOW
and one of the display's digit pins is also low.
There is one "Common" pin for each of the 4 digits, labeled D1, D2, D3, and D4 on the display. Those common pins are connected to the Anodes (positive pin) of all segments in the specified digit. When 5V is applied to the base of the transistor, the NPN transistor is off. When 0V is applied to the base of the NPN transistor, current flows from the 5V source, through the transistor, and into the Anode of the digit.
When a segment pin (A-G, DP) is HIGH
, it is at 5V. The Anode is also at 5V, so no current flows. When a segment pin in LOW
, it s at 0V, and current flows from the Anode to Ground through the segment pin into the Uno.
This kind of display is meant to be multiplexed by digit. To light the first digit, The D1 transistor is turned on, and the segments to light up are set to LOW
. All other transistors are off. Then, the first digit transistor is turned off and the 2nd digit transistor is turned on, and the segment pins are re-adjusted so that the desired output on the 2nd digit is displayed. Each digit is only on for a fraction of a second, but they are rotated through all 4 so quickly, that it gives the appearance of all 4 digits being on at the same time, without requiring 8x4=32 IO pins. Multiplexing means you only need 8+4=12 IO pins.
Search "multiplexed common anode 7-segment display" for more info.
-
Wonderful. Thank you for answering my question in such detail. You have added to my understanding on how the 4 digit seven segment display interfaces with the Arduino.– EricFeb 15, 2019 at 12:57
Current limit resistors are needed, one for each segment (A-G, DP) to avoid burning out the LEDs or uC IO pins:
(5V - Vce of transistor - Vf of the LED)/current = resistor value
So making some assumptions:
Vce = 0.7V in saturation (full on)
Vf = 2.5V (approx. for Red, check your datasheet)
10mA (so not blinding bright to start)
Then
(5V - 0.7V - 2.5V)/.01 = 180 ohm
dititalWrite(<pinNr>, LOW)
.