Using common anode 7-segment display with Arduino

I happen to have a common anode 7-segment display that I want to control using my Arduino Uno.

With a common cathode I get that I simple via resistors connect a digital pin to the pin on the segment display. Bringing the output HIGH turns on the segment, bringing it LOW turns it off.

My question is how do to this with a common anode?

I get that if I bring the pin LOW, then the segment is now on. Do I just bring the pin HIGH then to turn it off? (I am obviously still using resistors on all pins.)

The reason I ask is that it feels strange to connect positive to positive if that makes sense.

Common Anode receives the Vcc, all the segment cathodes will have resistors which connect to individual controller pins. Each pin will receive a LOW to enable each segment to turn ON.

Thank you. My question then is, do I just set the pin HIGH to turn it off?

Yes, a HIGH on each CATHODE pin will turn each segment of a 7seg Common Anode OFF.

HIGH anode -->LED|-- cathode LOW  = ON <--
LOW  anode -->LED|-- cathode LOW  = OFF
HIGH anode -->LED|-- cathode HIGH = OFF <--
LOW  anode -->LED|-- cathode HIGH = OFF

Ok thank you. I had been a bit worried that setting an output to high would somehow be an issue with the 5v on the common anode.

Use a power supply for the anode, share ground with power supply and the Arduino.

Enable the segments with a LOW.
Disable the segments with a HIGH.

https://randomnerdtutorials.com/tag/common-anode/

The Fig-1 should clarify to you that there is no issue if you assert LOW on DPin-5 while there is 5V on the CA-pin of the display device.

caDisplay
Figure-1:

Thank you. My concern was more with the setting of HIGH on the pins. That way I have 5v going in both directions if that makes sense.

@GolamMostafa - Should a power supply ever be used in 7seg, like 4x7seg?

You may also operate your CA-display device in the following way (Fig-1). Your assert HIGH on DPin-6 and LOW on DPin-5, the sement-a will turn on.


Figure-1:

No, it doesn't make sense. Volts don't go anywhere. Current flows from higher voltage to lower voltage, like a ball rolling downhill. On flat ground, the ball doesn't move. If both terminals of a component are at the same voltage, current doesn't flow through it.

3 Likes

caDisplay

If you look at the above diagram.
If pin 5 is LOW, then the potential difference between pin 5 and Vcc will be 5V and current will flow.

If pin 5 is HIGH, then the potential difference between pin 5 and Vcc will be near 0V and no current will flow.

Tom.... :smiley: :+1: :coffee: :australia:

2 Likes

Where would the current flow? And how much current would flow along that path? If you work this out, you'll see it's not a concern.
If it does bother you, set the pin to INPUT instead of OUTPUT, HIGH. That way it can't source current to begin with.

Hi, @wanttoknow2000

Pin 5 and the 5V pin get their potential from the same source with respect to gnd.

Tom... :smiley: :+1: :coffee: :coffee::coffee: :australia:

Now, you have introduced the term potential that essentially belong to Physics. How do we correlate it with the term voltage of Electrical Engineering?

Voltage is electrical potential.

Tom... :smiley: :+1: :coffee: :australia:

In Electrical Engineering, voltage is a value that refers to the difference of two potentials.

The reference zero potential is considered to be located at far infinite distance.

For practical purposes, the 0V-point of Arduino UNO is taken as zero-potenntial point; accordingly, 5V-pin of Arduino UNO has a voltage value of 5 Volt (5V).