• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help - Dual 7 Segment Display

Status
Not open for further replies.

Budman231

New Member
I was hoping someone could help me. I have been controlling 2 separate 7-segment displays from a raspberri pi. I purchased a dual seven segment display but it only has 10 pins (not 18 like I would have expected).

Pin Schematic (about half way down) :
https://wxjsinfo.en.alibaba.com/pro..._4_inch_Dual_Digit_7_segment_LED_Display.html

How do I display 2 separate digits on this device ?

Pin 10 = Digit 1
Pin 5 = Digit 2

The rest of the pins are for the 7 different segments, and the decimal points.

I tried to bring pin 10 high/pin 5 low, display a digit, then bring pin 10 low/pin 5 high, display second digit. That doesn't work...

Bud
 

Les Jones

Well-Known Member
Most Helpful Member
Hi Bud,
The segments will be in parallel. Both A segments will be connected together and connected to one pin. Both B segments will be connected together and connected to one pin. and so on. So that accounts for 8 pins (7 segments and a decimal point.) If it is a common cathode display then all the cathodes of one digit will be connected to one of the two remaining pins. All of the cathodes for the other digit will be connected to the final pin. They are designed like this for use in a multiplexed display. To use this display you would only need 10 I/O pins instead of 16 you would only dive each digit for half of the time. You would switch between them at a frequency of greater than about 100 HZ. You would not know they where being multiplexed by looking at then.

Les.
 

Budman231

New Member
Thanks Les.

Very helpful indeed. I also found the following article that helps a lot too..

http://www.studentcompanion.co.za/multiplexing-of-7-segment-displays-with-pic-microcontroller-xc8/

Thanks again. Onto the code..

Hi Bud,
The segments will be in parallel. Both A segments will be connected together and connected to one pin. Both B segments will be connected together and connected to one pin. and so on. So that accounts for 8 pins (7 segments and a decimal point.) If it is a common cathode display then all the cathodes of one digit will be connected to one of the two remaining pins. All of the cathodes for the other digit will be connected to the final pin. They are designed like this for use in a multiplexed display. To use this display you would only need 10 I/O pins instead of 16 you would only dive each digit for half of the time. You would switch between them at a frequency of greater than about 100 HZ. You would not know they where being multiplexed by looking at then.

Les.
 

Rich D.

Active Member
That's a good explanation, quite likely better than anything I could have written. What it doesn't go into is the electrical design.
Let's say you figured out the right resistor to use to make sure that the current is limited in each LED. 220 ohms is a common value, that will make the LEDs bright enough and not allow too much current to flow thru the LEDs.
By switching back and forth between two digits, each digit is on only 1/2 the time, so effectively the average current is 1/2 and the brightness is about 1/2. (Roughly...there are other minor factors to consider.)

Not a problem usually, but if your device will be used in the sunlight and if brightness is an issue, you can re-calculate the series resistors and return the digits to full brightness.
Basically run them at twice the current (since it is on for only 1/2 the time), and the overall power level remains within the limits.
This works for more than two digits of course. If you have 3, drive the LEDs with 3X the normal DC current, if 4, drive with 4X...etc.
There is a practical limit though. LEDs normally have a DC limit of about 20mA, but they also have a peak current limit of usually 100mA.
This means that if you run them at 5X the normal 20mA you will burn out the LED while it is on and before it has a chance to cool off during the off cycle.

This same principle can be used for dimming. If run from a microprocessor, you can program in an adjustable off time and that will directly correspond to the brightness seen on the digits.

There are all sorts of factors to consider when calculating the current limiting resistor values, including the Vf of the LEDs, the Vce saturation and Vbe saturation of the transistor drivers, and the output voltage & current of the 7 segment drivers.
I can't give you all the formulas here but if you give me the data I can figure it out for you.

In the real world though, calculating isn't perfect and sometimes just experimenting with a resistor value from 100 to 470 or even 1K ohms can do just as good to set the brightness levels.
 

Budman231

New Member
Hi Rich.

Thank you for the reply. I got it all working with some tweeks of my number display code. I have it switching fast enough between the 2 digits to effectively show both even though it is displaying one at a time (Thanks to Les). I did notice that the brightness is down and your explanation makes perfect sense and is well timed. they are ON half the time..

Interestingly, I display a constant Letter, then display a 2 digit number so the letter is bright, and the digits dim a bit. Not sure what I can do about that except use the same wait technique with the letter, then change out the resistors for a lower value so that all of them get brighter due to the increased current from my Pi.

Sound reasonable to you ? Any other techniques I could use to increase brightness for a constant ON letter, and 2 multiplexed digits ?

Bud
 

Rich D.

Active Member
Whoa, we might have something else going on here. Sounds like the power to the LEDs may be a little starved. In a perfectly working system, all segments would be equally bright, no matter if one or all sixteen segments are lit. So I have a few questions:
1) are you using NPN transistors to drive the two cathodes (5,10) to ground? If so, what is the resistor value on the bases of those resistors?
2) are you using a power supply with an excess of available current? What is the maximum it can deliver, and are there sufficiently large electrolytic capacitors on it?
3) do you know if the raspberry is able to drive the current required by the LED segments, or are there any buffers/drivers for the outputs from the raspberry to the LEDs?
It would be helpful to see a schematic drawing of the circuit with part details, even if just drawn on a napkin.

My understanding of the raspberry is that the DIO pins are driven from 3.3 volts (not a lot), and is limited to 50mA for all outputs at most. (50/16=3mA each if all are on).
Furthermore, I think each output pin is limited to about 15mA. I could be wrong here, but if that's close to the truth then the raspberry isn't a very good current source.

If any of the above is the source of the varying brightness, we (humans) have the technology to correct that.
 

Budman231

New Member
Let me explain a bit more..

I am displaying Temperature on a 2 digit display. for example t 67

I am not driving the dual seven segment display directly from the Pi. I have an SN74LS47N (BCD Decoder) between the Pi and display to save output pins on the Pi.

1. I send a "t" to the decoder (High,High,High,Low), it displays a "t" on the digit 1 (nothing on digit 2) of the dual segment display for 2 seconds. This is bright ..
2. I then send the 2 digit temperature using the method (fast switching) you guys helped me with. This is dimmer than the "t" above ..
3. This repeats infinitely.

The "t" is brighter than the "67" I suspect because it is displaying a constant current letter for 2 seconds. Then the "67" is dimmer I think because of the multiplexing of the 2 digits through the decoder.

I am also using COMMON ANODE display. So I do not use any transistors to connect to ground. I send a high to the digit that I an setting directly from the Pi.

Does that make sense ?

Bud

Whoa, we might have something else going on here. Sounds like the power to the LEDs may be a little starved. In a perfectly working system, all segments would be equally bright, no matter if one or all sixteen segments are lit. So I have a few questions:
1) are you using NPN transistors to drive the two cathodes (5,10) to ground? If so, what is the resistor value on the bases of those resistors?
2) are you using a power supply with an excess of available current? What is the maximum it can deliver, and are there sufficiently large electrolytic capacitors on it?
3) do you know if the raspberry is able to drive the current required by the LED segments, or are there any buffers/drivers for the outputs from the raspberry to the LEDs?
It would be helpful to see a schematic drawing of the circuit with part details, even if just drawn on a napkin.

My understanding of the raspberry is that the DIO pins are driven from 3.3 volts (not a lot), and is limited to 50mA for all outputs at most. (50/16=3mA each if all are on).
Furthermore, I think each output pin is limited to about 15mA. I could be wrong here, but if that's close to the truth then the raspberry isn't a very good current source.

If any of the above is the source of the varying brightness, we (humans) have the technology to correct that.
 

Rich D.

Active Member
Makes a buncha' sense in that I know what you have there. It also makes sense that the t is brighter than the 67 because the t apparently is on 100%, while the 6 and the 7 are only on 50%.
I assumed wrong that you set up a full-time multiplexing situation in software where the t is alternately displayed with the " " on the other digit, " " meaning nothing on.
Your method is more efficient code-wise, but "professionally" one would normally set up a multiplexing algo and then just feed it a variety of characters - the advantage is that it can be reprogrammed at any time.
But if you are simply making a thermometer then it makes sense not to program the thing to do something it would never need to do.

So... good choice using the '47 to save pins. That is an open-collector device that will do well to drive LED cathodes low.

The potential weakness in the design is that the other side of the LEDs are driven from the pi's output pins directly.
Now when I say "potential weakness" that is not meant to be a criticism in any way. If you are not driving a lot of current out of the pi then you will not have any current heating problems, so it's best to keep it simple.
The pi should deliver no more than 16mA per pin and only up to 50mA combined before one needs to worry about over-heating. Worst case of an '8' would be about 2.3 mA per segment and that's not a lot of current to see a LED in sunlight.
The more segments on the more current will be drawn, and the more likely the +3.3 output will "sag" a bit lower and not produce as much brightness as a '1' which only uses 2 segments. You would still see a little brightness difference between the 1 and 8,
but basically, you will be able to read the number and that's all that's needed. That's a more common problem that I figure most engineers would assume is going on.

If you did want to make the circuit more ideal, you could use two 5-cent PNP transistors (say 2N3906's) with a base resistor. The emitter connects to +V and the collector to the LED's anodes.
The transistor would be driven by the pi so when the pi's output went low the transistor turns on and delivers the full V+ to the anode of the LEDs. That way there would be very little 'sag' in the anode voltage of the LEDs.
V+ can be 3.3 volts, but if +5 is available it would be brighter. 3.3 volts would be fine for typical red, green, or yellow LEDs, but blue or white would require more V+ to be able to turn on the LEDs.

So... just ignore all of that and program a 50% on / 50% off cycle to the 't' and it will work perfectly. That's the simplest thing to do. Then if you want, adjust your resistors to run at about 40mA for 1/2 the time...but don't let the software die and leave a segment on continuously! Eventually, that will burn out an LED segment or two or eight or a Pi output...whichever is the weakest link.
 

Budman231

New Member
Thanks again Rich for your insight an willingness to help. This is a great forum and I appreciate the time you took to explain all that.

Bud
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top