Best way to wire my 3 digits 7 segment display ?


This is my first post on this forum. Usually I find answers to my questions by googling and searching through the forum but this time I'm too confused. Sorry if the answer is too obvious...

Well, I want to connect a 3-digit 7 segment display to my Uno. I tried it using the SevSeg library and it worked perfectly good (although I've read that putting resistors on the anode isn't the best practice). The only problem is that it requires a lot of pins and don't have many left with my current project.

I already have a few parts at home and would like to know if I can manage to make it work without having to buy new stuff.

I have a few 74HC595, PNPs and NPNs transistors, diodes, capacitors and resistors of many values.

So here's the final question : how should I wire my 3-digit 7 segment display in order to use the minimum pins on my Uno and without buying new chips ?

Codewise, I should add that I don't care using a library or not. I used SevSeg just to test the display.

I hope I made myself understood ! English isn't my mother tongue.
Thanks in advance and I'm prepared anyway for the answer "that's actually not possible" ;D

It depends on if you have a common anode or common cathode display but both are shown on this thread Problem in analog inputs with solar tracking and voltmeter project - #28 by Grumpy_Mike - Project Guidance - Arduino Forum

Do not put resistors in the common connections.

You should be able to do this with 3 Arduino pins.

Two 595s, daisy chained. One drives the segments via 8 resistors (don't forget the 595 has an overall 70mA limit when you calculate the resistor values). The other drives 3 transistors for the digit commons. For common cathode display, use npn with a base resistor (around 1K - 4K7). For common anode, 3 PNP with base resistors. Or you might be able to use 3 npn in emitter follower configuration, in which case you would not need the base resistors. That depends on the forward voltage of the segments, but should be ok for red/amber/yellow, but maybe not green/blue/white.

First of all, thank you both for your answers. That sounds very promising & encouraging !

I forgot to say in my first post that the display is a common anode/green segments.

Grumpy_Mike, I didn't see this thread throughout my research, I'll check it out with great care.

PaulRB I think I got what you tell me. The second option (emitter follower configuration) may be impossible since the segments on my display are green. Anyway, 3 pins on the Arduino would be perfect :slight_smile:

I'll try to draw a proper schematic and I'll post it here when it's done.

The second option (emitter follower configuration) may be impossible since the segments on my display are green

It depends on the forward voltage of the green segments. Do you know what that is for your displays? Green leds vary a lot in their forward voltage depending on how they were manufactured. Some green leds may be around 2.4V, so using the emitter followers may be ok. But some green leds can be 3.2V or more.

I had a second look at the datasheet and it looks like these green segments work under 3.3V. Sounds like I'm going with the PNP option !

I'm working on the schematic right now :slight_smile:

Here is a schematic of what I've understood so far. I hope I'm on the right track...

Looks OK so far. Don't forget the 0.1uF ceramic capacitor from power to ground on each shift register.

This is how you could calculate the segment series resistors.

Let's suppose we get the full 5V from the 595 outputs. It's probably not true, but if we assume that, we err on the safe side. The PNP will probably drop around 0.3V and the segments drop 3.3V. That leaves 5-0.3-3.3=1.4V for the series resistors to drop.

The max current that the 595 can sink is around 70mA, so that's around 8mA per output.

So the series resistors should be 1.4/0.008=175R. The nearest value above that would be 180R.

Here's an idea.

The base current required for the pnps will be small compared to the digit current, probably only about 2%, so perhaps 3~4mA. And only one of the 3 pnps will be active at any instant. So the left hand 595 in your schematic is not working very hard, especially compared to the right hand 595, which is maxed out with current.

So, if you spread the current load across the two shift registers (ie. driving 4 segments each), you could double the segment current (series resistors of 82R). It would make the code slightly more complex (some bit manipulation needed), but it might be worth it for the extra brightness.

Wow PaulRB, huge thanks ! Maybe you don't realize it but you're helping me a lot revising my basics (V=IR) !
Also, your idea to spread the current needed by the segments between the two 595 is excellent. I wouldn't have thought of that on my own !

Grumpy_Mike, thanks for the reminder. Yes I'll add these capacitors. By the way, I've understood that it has to be ceramic capacitors because of their ability to work fast but does the value of these is crucial ?

I'll post an updated schematic here when I have time to do it. Hopefully it will help the community and fellow beginners users with Arduino like myself.

The ceramic construction is more important than the value, 10 to 100nF will do for the value.

Ok understood, thank you.

Here is an updated schematic which includes everything discussed above.

Here is an updated schematic which includes everything discussed above.

Well, it does not show the actual component values you intend to use, either for the caps or resistors. So you need to add those. But otherwise good.

Thinking about it, it will make the code very slightly simpler if you use QA - QD from one chip and QE - QH from the other chip, for the segments.

Finally, here is the schematic I'm using in my project. It's working like a charm !
Once again, a big thank you for helping me out.