Continue to Site

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.

  • 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.

Advice on multiplexing ten 7-segment display

Status
Not open for further replies.
Nigel Goodwin said:
ljcox said:
When the resistor is on the emitter side, you do not need a base resistor.

But there's a difference between 'need' and 'good practice', while the base resistor won't affect the performance of the circuit, it's there to protect the PIC if the transistor goes S/C.

As an added bonus, the resistors also probably simplify PCB layout, avoiding the need for wire links or double sided boards.
The point, Nigel, is that he does not have much voltage to play with. So the voltage dropped across the base resistor further reduces it.

I really think that a PNP common emitter driver would be better anyway.
 
ljcox said:
Nigel Goodwin said:
ljcox said:
When the resistor is on the emitter side, you do not need a base resistor.

But there's a difference between 'need' and 'good practice', while the base resistor won't affect the performance of the circuit, it's there to protect the PIC if the transistor goes S/C.

As an added bonus, the resistors also probably simplify PCB layout, avoiding the need for wire links or double sided boards.
The point, Nigel, is that he does not have much voltage to play with. So the voltage dropped across the base resistor further reduces it.

Yes, but not by very much - I'd sooner have the resistor in place!. Assuming a gain of 100, and a 470 ohm resistor (as I suggested) you only lose about 0.2V.

I really think that a PNP common emitter driver would be better anyway.

So do I, which is why I mentioned it, but he would need NPN pre-drivers as well to feed the PNP off 9V. I wouldn't ever design a circuit using NPN drivers to feed positive to the display - yet it's so commonly done!.
 
ljcox said:
I suggest that you do a static test (ie. steady current, no pulsing) and measure the current through a segment that is necessary to give the required brightness and then measure the voltage across the segment at that current. Report the figures to us so we can calculate the resistor value for you.

Hi ljcox,
The current through a segment is 6-7mA to achieve considerable brightness, while the forward biase voltage is approx 1.75v.
How do you actually calculate the resistor value? Is it R=[Vcc - 1.75]/6mA ??

Oh, so the simulation is using MPLAB....I should've explored earlier. Thanks for sharing.


Nigel Goodwin said:
however your positive driving method is very poor - it's best if you use PNP transistors from the positive rail, but that would require NPN's to drive them (due to your 9V supply rail).

Hi Nigel,
1. Do you mean that the way I drive the segment is not efficient?

Nigel Goodwin said:
the maximum voltage to the displays is only 4.3V, so you're wasting your 9V supply anyway

2. I don't understand how you come up with the maximum voltage = 4.3v? Where did the rest 4.7v go? is it consumed by CE of BJT?

Nigel Goodwin said:
Also the 140 ohm resistor in the collector isn't a very good idea, and will make it difficult to calculate the current to the display - moving it to the emitter would make more sense.

3. I thought Ic is obtained by assuming how much current we required, then we calculate the resistance required to give Ic? R= [9Vcc - 1.7v(one segment)]/Ic

Nigel Goodwin said:
I would suggest you use something like 470 ohm resistors between the PIC pins and the bases, to give better base drive.


4. May I ask how do you come up with this resistance value. I really wanna learn. Also placing a diode on base doesn't provide protection for PIC?


Thanks William At MyBlueRoom for the suggested diagram. Unfortunately, I have everything soldiered on the common cathode side. So the only way to improve it is on the segment side. :(

BTW, hereby are my latest schematics based on all your advices. Correct me if I misintepret your meaning


Schematic A [try1.jpg diagram]. -segment connected to collector. which I have to invert the display pattern on the software.
Schematic B [try.jpg diagram]. -segment connect to emitter


One more question: Will the current flow out from common cathode to 7404 and 4017 eventually burned those IC? (based on my design). I have tried once connecting using Schematic A with base resistor 10k and no collector resistor. When connecting all 7 segment using this way, all my ICs burned...at first I thought those BJT are in breakdown region due to high Ib, but they still ok. So I wonder if the Ic may be to high or
something.

Thanks for your patience and feedback.
 

Attachments

  • try_125.jpg
    try_125.jpg
    31.7 KB · Views: 496
  • try1.jpg
    try1.jpg
    30.7 KB · Views: 532
taengi said:
Nigel Goodwin said:
however your positive driving method is very poor - it's best if you use PNP transistors from the positive rail, but that would require NPN's to drive them (due to your 9V supply rail).

Hi Nigel,
1. Do you mean that the way I drive the segment is not efficient?

That's right, it's VERY wasteful.

Nigel Goodwin said:
the maximum voltage to the displays is only 4.3V, so you're wasting your 9V supply anyway

2. I don't understand how you come up with the maximum voltage = 4.3v? Where did the rest 4.7v go? is it consumed by CE of BJT?

The emitter of an NPN transistor is 0.7V lower than the base, as the base is fed from the PIC with 5V, the emitter can't be any higher than 4.3V (5-0.7).

Nigel Goodwin said:
Also the 140 ohm resistor in the collector isn't a very good idea, and will make it difficult to calculate the current to the display - moving it to the emitter would make more sense.

3. I thought Ic is obtained by assuming how much current we required, then we calculate the resistance required to give Ic? R= [9Vcc - 1.7v(one segment)]/Ic

See the reply above, the maximum emitter voltage is governed by the base voltage, so using a resistor in the collector won't do anything until there's not enough current available.

Nigel Goodwin said:
I would suggest you use something like 470 ohm resistors between the PIC pins and the bases, to give better base drive.


4. May I ask how do you come up with this resistance value. I really wanna learn. Also placing a diode on base doesn't provide protection for PIC?

Maximum current from a PIC pin is about 20mA, 500 ohms with 5V gives 10mA - so 470 ohms is about that, IF the resistor went to ground, as it stands the current will be far less, but plenty of base drive for the transistor.

Thanks William At MyBlueRoom for the suggested diagram. Unfortunately, I have everything soldiered on the common cathode side. So the only way to improve it is on the segment side. :(

BTW, hereby are my latest schematics based on all your advices. Correct me if I misintepret your meaning


Schematic A [try1.jpg diagram]. -segment connected to collector. which I have to invert the display pattern on the software.



That's even more wasteful, you need PNP transistors - check my 7 segment tutorial..

Schematic B [try.jpg diagram]. -segment connect to emitter
One more question: Will the current flow out from common cathode to 7404 and 4017 eventually burned those IC? (based on my design). I have tried once connecting using Schematic A with base resistor 10k and no collector resistor. When connecting all 7 segment using this way, all my ICs burned...at first I thought those BJT are in breakdown region due to high Ib, but they still ok. So I wonder if the Ic may be to high or
something.

I don't know what current they will sink?, I'd have used NPN transistors fed from the PIC for the bottom, and PNP's for the top.
 
The 74LS04 is not suitable since it can only sink a max of 8 mA.

This is how I would do it.

The 74HC4511 can source a max of 35 mA. So you need 2 of them.

The PIC applies the data for displays 1 and 5 via portx and applies a high to Q1 via porty,
then displays 2 & 7 and Q2 etc.

Since the muxing is x5, there needs to be about 25 mA through each segment, thus giving an average current of about 5 mA per segment.
 

Attachments

  • muxing.gif
    muxing.gif
    56.9 KB · Views: 497
taengi said:
ljcox said:
I suggest that you do a static test (ie. steady current, no pulsing) and measure the current through a segment that is necessary to give the required brightness and then measure the voltage across the segment at that current. Report the figures to us so we can calculate the resistor value for you.

Hi ljcox,
The current through a segment is 6-7mA to achieve considerable brightness, while the forward biase voltage is approx 1.75v.
How do you actually calculate the resistor value? Is it R=[Vcc - 1.75]/6mA ?? I assume that you mean Vcc = 9 V, so the answer is no. Note that it will be 60 mA because of the x 10 muxing.

You need to calculate the voltage that will be across the resistor and then divide by 6 mA. I'll draw a diagram and post it later to show you how to do it.


Oh, so the simulation is using MPLAB....I should've explored earlier. Thanks for sharing.


Nigel Goodwin said:
however your positive driving method is very poor - it's best if you use PNP transistors from the positive rail, but that would require NPN's to drive them (due to your 9V supply rail).

Hi Nigel,
1. Do you mean that the way I drive the segment is not efficient?

Nigel Goodwin said:
the maximum voltage to the displays is only 4.3V, so you're wasting your 9V supply anyway

2. I don't understand how you come up with the maximum voltage = 4.3v? Where did the rest 4.7v go? is it consumed by CE of BJT? The CE voltage will be 4.7 V.

Nigel Goodwin said:
Also the 140 ohm resistor in the collector isn't a very good idea, and will make it difficult to calculate the current to the display - moving it to the emitter would make more sense.

3. I thought Ic is obtained by assuming how much current we required, then we calculate the resistance required to give Ic? R= [9Vcc - 1.7v(one segment)]/Ic See my answer above

Nigel Goodwin said:
I would suggest you use something like 470 ohm resistors between the PIC pins and the bases, to give better base drive.


4. May I ask how do you come up with this resistance value. I really wanna learn. Also placing a diode on base doesn't provide protection for PIC? He chose the lowest resistance value consistent with limiting the max current that the PIC can withstand if the transistor developed a short circuit fault


Thanks William At MyBlueRoom for the suggested diagram. Unfortunately, I have everything soldiered on the common cathode side. So the only way to improve it is on the segment side. :(

BTW, hereby are my latest schematics based on all your advices. Correct me if I misintepret your meaning


Schematic A [try1.jpg diagram]. -segment connected to collector. which I have to invert the display pattern on the software.
Schematic B [try.jpg diagram]. -segment connect to emitter


One more question: Will the current flow out from common cathode to 7404 and 4017 eventually burned those IC? (based on my design). I have tried once connecting using Schematic A with base resistor 10k and no collector resistor. When connecting all 7 segment using this way, all my ICs burned...at first I thought those BJT are in breakdown region due to high Ib, but they still ok. So I wonder if the Ic may be to high or
something. Schematic A is inefficient from a power consumption point of view as the transistors shunt the current. Also, as I wrote in the previous post, the 74LS04 can sink a max of 8 mA. So it would have failed and presumably caused the failure of the 4017.

Thanks for your patience and feedback.
 
Here are the calculations promised in the previous.

If you wish to use this configuration, then you will need to find a suitable driver. It could be an IC or a Darlington transistor.

If the latter, you need to study the data sheet and determine the saturation voltage at 350 mA (or 420 mA if you wish to have an average current of 6 mA per LED ie. 7 segments x 60 mA x 10).

There are Darlington arrays available, 8 Darlingtons in a DIL package and I think there are some that include the base resistors (for a 5 Volt drive) internally.

Note that the first line should read 50 mA, not 5 x 50 mA
 

Attachments

  • mux_calc.gif
    mux_calc.gif
    112.8 KB · Views: 461
taengi said:
Thanks ljcox for your sharing. I need study through it first before I response to you.

You're welcome.

I have realised that my muxing.gif attachment has an error. I did not look at the data sheet for the 74HC4511 before posting. So tell me if that configuration is suitable for you and I'll revise it.
 
alright, now I understand how to calculate the value for the resistor.

One thing I'm not too sure.
If I don't use 4511 and directly connect the base transistor to PIC output, will it still be ok?

base upon the calculation, does it mean that 7404 not able to sink the current of 50mA?
 
taengi said:
alright, now I understand how to calculate the value for the resistor. Good

One thing I'm not too sure.
If I don't use 4511 and directly connect the base transistor to PIC output, will it still be ok? As Nigel wrote, if the transistor develops a short circuit, it could destroy your PIC. The PIC data sheet indicates that the max current it can source or sink is 25 mA. So you need to limit the max current to that level in case a transistor fails. I would use PNP transistors with their emitters connected to +5 Volt and resistors from their bases to the PIC. Their collectors would go to the display segments via resistors.

This will prevent any problems with the PIC if a transistor fails and it gives you more voltage for the displays.


base upon the calculation, does it mean that 7404 not able to sink the current of 50mA? Correct. If you look at the 7404 data sheet it cannot sink more than 8 mA.

There is also another problem with your circuit. You used a 4017 to sequence the muxing. But I don't see how you can synchronise the 4017 with the PIC. The PIC needs to apply the right data to the 7 seg lines at the right time, so it needs to know the state of the 4017.

I'll post an alternative later.
 
Here are 2 options. Your problem is that you want to mux 10 displays.

I have assumed an average LED current of 6 mA.

If you use the 1 x 10 option, then you need 60 mA current pulses through each LED.

If you use the 2 x 5 option, then you need 30 mA current pulses through each LED.

There are many other possible options.

I'll leave you to calculate the R values. If you need assistance, just ask.

For the 1 x 10 option, the PIC applies the relevant data to port x and the appropriate address to port y, eg. to display 4 on D1, port y is set to 0000 and port x to 0110011. After a suitable delay, it sets port x to the next data and port y is incremented by 1 (or alternatively it could be decremented).

For the 2 x 5 option, the PIC applies the relevant data to port y and the appropriate address to port x, eg. to display 4 on D1 and 7 on D6, port y is set to 0100 0111 and port x to 000.

There is a minor error in muxing 2.gif. The base of Q5 is driven by output 4 not output 5.
 

Attachments

  • muxing_2.gif
    muxing_2.gif
    37.2 KB · Views: 596
  • muxing_1.gif
    muxing_1.gif
    31.9 KB · Views: 602
thanks ljcox. I think 1X 10 mux would be a better choice for me but i still need digest the two options first. :wink:
 
Here is my third and final option.

The 74HC4511 has a latch capability. So IC1, IC2 & IC3 can all be set via 4 lines from port x.

The cycle is as follows:-

The data for IC1 is set first, LE1 is then set high to latch this data into IC1.

The data for IC2 is set next, LE2 is then set high to latch this data into IC2.

The data for IC3 is set next, LE3 is then set high to latch this data into IC3.

The transistor Q1 is turned on for the mux period and then the cycle is repeated for D2, 5 & 8, etc.

You could also consider a minor variant on this theme. It could be configured as a 3 x 3 + 1 arrangement. D1 ~ D9 would be muxed and D10 would be directly driven by another 74HC4511. The advantages of this option are:- the current pulses would be 18 mA rather than 24 mA and Q4 is not required. The disadvantages are that you need an extra IC and a net increase of 6 resistors. Note that the current into D10 would be 6 mA (not pulsed)
 

Attachments

  • muxing_3.gif
    muxing_3.gif
    37.9 KB · Views: 565
I offer yet another option for the display scanning.

It has a duty cycle of 1/7 so the pulse current magnitude is not too high to give good LED brightness. This arrangement is attractive as more and more digits are used.

All Q1 to Q10 are off initially. The segment is selected via the ABC input of 74LS138 and one of its open collector output pins(edited: this is not true, 74LS138 is NOT open-collector, use 7445 instead) will go LOW. This would turn ON and saturate the corresponding seqment drive PNP transistor. One do not need to use a darlington PNP type as a normal PNP will do. The LED supply voltage can be any voltage higher than +5V if a suitable current limiting resistor value R is choosen.

Then in the software you decides which digit(s) should have that particular segment turn ON and setup the data on the output port. So in effect zero to ten segments(albeit all the same segment for each digit) will light up. After a suitable time later, you turn them all off and move on to the next segment.

Edited: As pointed out by Nigel, 74LS138 is not open-collector, 7445 BCD-to-Decimal decoder is.
 

Attachments

  • muxing_3_106.gif
    muxing_3_106.gif
    23.6 KB · Views: 555
MAJOR ERROR!.

You can't have +10V feeding the PNP's, it MUST be 5V - the bases are driven to either logic 0 (0V) or logic 1 (5V), in both cases ALL the PNP's are permanently switched on if the supply is over 5V.

I mentioned this previously, stating you need an NPN open collector driver to feed the PNP's.

Check the Hardware Extras section of my tutorials!.
 
Nigel Goodwin said:
MAJOR ERROR!.

Yes. I was looking at the datasheet of 74LS47 when I typed the reply. :D

LS138 is not open-collector output. The 3 to 8 decoder needs to be a BCD-to-Decimal decoder 7445, which is open-collector, for the circuit to work.
 
That is an interesting idea, eblc1388.

Nigel is right about the 10 Volt, but it should work on 5 Volt. The 74LS138 will sink 4 mA.

And yes, Q1 ~ 10 don't need to be Darlingtons as the PIC can source 4 mA for their bases.

Edit, I just saw eblc1388's latest post. The original circuit posted by taengi had a 9 Volt supply, so that would be suitable. Nevertheless, with normal transistors, rather than Darlingtons, the circuit will work on 5V.

Edit 2. I just did the calculations. Assuming that the saturation voltage of the transistors is 0.2 V, then R = 68 Ohm for LED current pulses of 42 mA (ie. 6 mA * 7) I would use the 74LS 138 as it will sink 4 mA.

Edit 3. The PIC programming may be a bit complicated as you are muxing on the segment side
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top