7digit display common anode. Can I have a single resistor

Silly question perhaps.
I connected 7 segments common anode display.
Works perfectly but as you can see I used single resistor between the common pin and Arduino 5V.
I am aware the brightness would change depending on how many segments would lit.

Is it fundamentally wrong. Or is it ok, as long as we accept the brightness different issue.

Silly question perhaps.
I connected 7 segments common anode display.
Works perfectly but as you can see I used single resistor between the common pin and Arduino 5V.
I am aware the brightness would change depending on how many segments would lit.

Is it fundamentally wrong. Or is it ok, as long as we accept the brightness different issue.

It isn't fundamentally wrong, and you don't even have to have a brightness difference. But you would have to multiplex the display by segment. The library SevSeg will do this for you if you set things up correctly - setup as common anode with resistors on the digits, not on the segments.

The idea is that you drive the segments one at a time. If the character you are displaying has that segment lit, you turn on the driver pin for that segment. Otherwise you leave it off. Then on the next refresh you turn off that segment, and do the same for the next one. Since at most only one segment is ever lit at the same time, the single resistor on the common anode will always source the same current, if any at all, so the brightness will be the same for each lit segment whether you are displaying "1" or "8". You would add the refresh function to your loop(). Calling it whenever millis() changes should be often enough to prevent flicker.

If you want to know the details on segment multiplexing:


OP image.

Posting images so we do not have to download them:
How to post an image.
Another page on posting images.


Well, we can live with it if you don't care that "1" is brighter than "8". But we feel bad if we know you are damaging an Arduino and you don't understand why/how.

It won't do any harm. If you can live with the variation in brightness then go ahead. However, really, 1 resistor per LED is what you should have and having just 1 resistor shared among all the LEDs is a bodge.

Dziubym:
I am aware the brightness would change depending on how many segments would lit.

Would change or does change?

Funny how that image squashed!

In case you missed it, I replied to your duplicate post in the other section with a way to use one resistor without uneven brightness.

Would change or does change?
Or no change.
Two bright segments or seven dim segments produce about the same light :slight_smile:
Leo..

Sure, even some commercial display modules have that problem, because they try to save money by leaving out the resistors. In a much older thread, someone suggested varying the intensity of each digit value by using a different PWM value. In that case you could calibrate every digit to appear at the same intensity, in spite of the current splitting. However, as cheezy as it can be, especially with '1' and '-' characters, which have the fewest ON segments, The percent difference between 2 and 8 segments ('1' and '8') illuminated, is obviously visible but it is the worst case. The logarithmic sensitivity of the human eye makes it seem like less, too.

I built one LED clock face the better way... resistors on each segment LED and a transistor to drive the digit common. It worked extremely well. Now, when I drive raw LED modules, I usually use a LED driver module. Then you don't need any resistors.

@Dziubym, do not cross-post. Threads merged.