# 7-segment displays

Discussion in 'Embedded Systems and Microcontrollers' started by KansaiRobot, Jul 31, 2015.

1. ### KansaiRobot Thread Starter Active Member

Jan 15, 2010
318
5
Hello and thanks always...

I have a project where I need to display something. Now I was thinking of using an LCD but I dont have it. Instead I have some 7 segment displays, so instead of spending money I think I would use them...

Now, these 7 segment are kinda mysterious in that I dont know their part number. I found the part number of one and it happens to be the LA-601VB.
So I learned that they are just like any other LED but arranged to have a common anode.. So far so well...

Just in case I searched for some examples and yes there was this

http://circuitdigest.com/fullimage?i=circuitdiagram_mic/Decimal-Counter-Circuit.gif

From the view of the circuit these 7 segments are just any other LEDs and all I have to do is write some driver so as to translate a char value into the appropriate combination of LEDs...

Now my question is:

Normally for a LED you have to put a resistor to limit the current. But in the above circuit there are no resistors for the 7 segment....

Is that ok? aint I gonna burn something?

Thanks for the help

2. ### nerdegutta Moderator

Dec 15, 2009
2,565
805
As a rule of thumb, I allways use a resistor. Use Ohm law to find the correct value => R=V/I

Jul 18, 2013
10,832
2,502
LCD are \$1.80 on ebay.
Max.

4. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,500
511
This is not homework.

5. ### KansaiRobot Thread Starter Active Member

Jan 15, 2010
318
5
Do you think that instead of putting 8 different resistors to each pin, I can put only one resistor of say 1K to the common pin??

6. ### JohnInTX Moderator

Jun 26, 2012
2,393
1,051
Not really. The problem is that each LED segment can have a slightly different Vf which can cause current hogging, making the segments different intensities. You don't say which uC you are using but the ATmega32 shown drives 20ma/pin, more if you pull it making individual segment resistors necessary. I should point out that some folks insist that you can get away without resistors but I would discourage that. So, a resistor on each multiplexed segment and a transistor to drive the digit unless the sum of all lit segments is <the port rating - usually it isn't, especially if you have more than a few digits. To calculate the R value:
R=V/I = [Vdd - Vce_digit_driver - Vf (LED) - Vol(port low voltage)]/segment_current. Note that because the digits are multiplexed, they are only on for 1/digits time so the segment current will have to be increased accordingly. If you like a single digit at 3ma/segment, multiplexing 2 digits will require 6ma/segment, 3 digits 9ma/segment and so on.

The drawing shows common CATHODE displays (the NPN digit select to ground is the giveaway). Common anode can be driven in a similar fashion. With CA, you drive the digit common anodes with a high side driver (usually a PNP transistor) and sink the individual segment cathodes to ground through resistors to turn them on.

Have fun.

Last edited: Aug 3, 2015
7. ### KansaiRobot Thread Starter Active Member

Jan 15, 2010
318
5
I just realized.... since I am using a transistor the transistor base current will be limited (through a resistor) ... therefore the collector emiter current will also be limited , and therefore a resistor is not necessary for the 7seg pins!! am I wrong???

8. ### JohnInTX Moderator

Jun 26, 2012
2,393
1,051
Yep! While collector current is a function of base current * beta (gain of transistor), beta varies greatly between transistors AND with different operating points. Plus, even if you get a constant, known current, you can't control how its divided between the individual LEDs. Just put the resistors in.

9. ### KansaiRobot Thread Starter Active Member

Jan 15, 2010
318
5
Ok I put 1.2K resistance to each pin and a 220Ω to the transistor base.
Results.. they are ok but the brightness of the LEDs are low...

10. ### takao21203 Distinguished Member

Apr 28, 2012
3,578
463
It was always a problem and the amounts of parts and wires you need is quite a disgrace.

Why not use a 16f pic controller wire just 1:1 don't care port bits sort out in software.
No resistors needed either.

11. ### JohnInTX Moderator

Jun 26, 2012
2,393
1,051
At Vdd=5V, Vf=1.5Vtypical, Vol=.4Vtypical gives a voltage across any dropping resistor as 5-1.5-.4=3.1V. At 10ma/segment, you get 3.1/.01 = 310ohms per individual segment resistor, call it 300.

The driver transistors will see 8 * 10ma = 80ma. Most small signal transistors clock in at a min beta of 80-100 so 80ma collector current / 80beta = 1ma base current. Your base current for a PNP is is Vdd - Vbe - Vol/220 = (5-.6-.4)/220 (first order) = 18ma. Since that's about 18 times more than you need, you could make the resistor bigger. At 1K you get a base current of 4ma. Plenty to saturate even a lazy transistor.

@takao21203 : Stop saying that. @tshuck and I have been over this with you, with real math and everything. With a strong port like PIC or ATmega, not using resistors overloads the port way past spec.

tshuck likes this.
12. ### takao21203 Distinguished Member

Apr 28, 2012
3,578
463
OK your overloading and IC damage set in stone, I have run circuit from small batteries for days and weeks. And I mean very small batteries.

If you move away from early 1980s 5V supply (also set into stone), you'll see the LEDs even without resistors arent too bright.

LEDs always have some internal resistance and the ICs too.
Talking about multiplex, looking at this total resistance, its not really a point to add resistors.

Your LED forward voltages also might not be correct, as modern LEDs are all around 2v except blue, UV and white.

3v to 3.5v is pretty standard for controllers, many run at 2.5v and less.

Working a 768 LED matrix from 5V, using 16f59, the main switching IC just gets warm moderately. Current is about 1A or less than that, including 8 PICs and 4 crystal OSC modules.

If you want to modulate the brightness of each these LEDs in software, additional resistors just dont make sense.

Otherwise you can also modulate the display, when the software fails well then it fails and your device needs a replacement. But the displays also dont burn out from that actually.

I did use resistors 2005 or so, saw very low brightness, then decided its nonsense to use them.

Arduino, the current into a single LED is about 60mA.

13. ### ian field Distinguished Member

Oct 27, 2012
4,447
791
Some of the CMOS logic chips can drive 7-segment LEDs without a resistor because the outputs approximate closely enough to current limiting.

That may or may not be the case with the chip you show, the only thing to do is study the datasheet - some have a cumulative output dissipation limit, that is the outputs have a pretty decent output current - but if they all do it at the same time, it'll get too hot.

14. ### JohnInTX Moderator

Jun 26, 2012
2,393
1,051
As we went through the discussion way back when, we arrived at yes, 4000 CMOS is frequently used without resistors. We ALSO arrived at the conclusion, again driven by the datasheets, that PIC (and by extension ATmega since the ports are similar) will operate past the absolute max ratings for the port unless segment resistors are used.

If I could find the thread in the archives, I'd link to it but that's what the numbers said, for this kind of application - not matrices, not blue LEDs - this one, red 7 segments, 20ma port with a cumulative power limit. The fact that in 2005 someone had dim LEDs when using resistors of an unstated value and that makes resistors non-necessary in all applications is non-sequitur.

That's all I have to say on the matter.

15. ### ian field Distinguished Member

Oct 27, 2012
4,447
791
I had more to say - but you snipped it........................

That may or may not be the case with the chip you show, the only thing to do is study the datasheet

tshuck and JohnInTX like this.
16. ### JohnInTX Moderator

Jun 26, 2012
2,393
1,051
Sorry, was finishing the thought.
Agreed - study the datasheet for the part(s) in use and for the specific application.

17. ### KansaiRobot Thread Starter Active Member

Jan 15, 2010
318
5
I just read (actually just took a peek) about the MAX7219 which apparently drives several 7segs leaving a main microprocessor free to do other things. The interface seems to be SPI.

My question. This MAX7219 chip. Do I have to program it? Or do I just program the master side (a PIC) as a SPI master and voila!

I am not sure that I am going to follow this path now that I have a working LCD but it would be good to know for future projects

18. ### ian field Distinguished Member

Oct 27, 2012
4,447
791
There's a small family of those chips with similar but distinct functions.

The ones I found (in that device number vicinity) were driving dot matrix LED modules in a running message display - the general idea seems to be; they're basically shift registers - I think the different part numbers relate to different serial data interfaces.

AFAIK: they're pretty universal, you just send a stream of bits to light the dots/segments. Its not like sending BCD nibbles, you have to program your micro to construct tables of bits to light specific dots/segments. The driver chip doesn't need programming in the sense that a micro does, you just have to observe the correct serial protocol and clock the bits in so they line up with the outputs.

KansaiRobot likes this.