# Electrical – How to calculate the segment array resistors in a multiplexed display array

microcontrollermultiplexer

The situation:

Four seven segment displays are multiplexed by a 16F648A. Now I need to calculate the required value for the segment resistors.

Supply voltage 5V.

Datasheet:
Segment voltage 1,8V.
Segment current 30 mA cont.
Segment peak current 80 mA (1/10 duty cycle, 1mSec pulse width).

Circuit:
Segment array resistors 180 ohm.
When displaying 4×8 supply current 60 mA
When displaying 1×8 supply current 15 mA (cathode removed from the other 3)

Assumptions not sure:
Display duty cycle 25% (4 displays).
Display segments all on at once. ( one instruction in the pic)
Actual segment current 60 mA/7 = 8,6 mA.

How to calculate the segment resistors value for the max. permissible current.?
The 80 mA peak might be to high for the pic. But first I need to find out how to calculate.

While multiplexing still active I selected only one digit to be active and connected the oscilloscope over one segment resistor. The outcome of this was that the voltage drop over the resistor is between 1,7 and 1,9 V. So let us take 1,8 V over a resistor of 180 ohm. Resulting in an I/O current of 10 mA. Far within the reach of the 16F648A. I decreased the resistor to 68 ohm and found that the voltage dropped to about 1,2V resulting in an I/O current 17,6 mA. The brightness of the display only increasing very little.

I measured also the duty cycle and it is indeed 25%.

Your minimum value will cause a current of 4x the desired average current to flow, while not exceeding the maximum peak current (both constraints must be applied). Since the peak current is less than 4x the average current, that is the limiting constraint.

So 20mA is your maximum average segment current (that's a heck of a lot of current for a modern display unless you require sunlight visibility). That's the display limitation. For reliability, you should not run the LEDs too close to the maximum, and you should take ambient temperature into account.

That means your whole display will take 8 * 4 * 0.02 = 640mA when the display itself is driven to maximum brightness.

Now you need the driving circuit voltage drops and capability to determine the resistor value. If you are driving directly with the 16F648, you will not be able to get anything like 80mA * 7 (or 8 with the decimal point) from the digit driving output. The digit driver has to drive all the segments simultaneously, preferably without changing voltage drop too much, otherwise you'll see an '8' as much dimmer than a '1' or '-'.

If you limit the digit current to 20mA (read the MCU data sheet for port pin limitation and resulting voltage drop) that means you can only have 20mA/8= 2.5mA per segment peak (625uA average), and your resistors work out to about 1.3K, ignoring the driver drops. The whole display draws 20mA or 1/32 of the maximum. The minimum resistor value is just (5V - 1.8V)/0.0025A = 1.28K

If that display brightness is insufficient, you can add digit drivers only (4 of them) and drive the segments with the MCU. There is a maximum current limitation of the entire chip to sink (or source for common cathode) current in the data sheet which will come into play. Probably 150mA or something like that. So if 150mA is correct, you could have 150mA/64 = 4.6mA/segment average tops without adding segment drivers as well as digit drivers. Your display would then draw 150mA maximum (displaying 8.8.8.8.)

Visual brightness is determined by log(average current). Some displays are much brighter than others at the same current. Driving a 4-digit display to acceptable brightness with just resistors and a PIC requires a fairly good display.

Edit: Thank you for adding the schematic. Now it is clear that you have digit drivers and are using a common-cathode display type. Assuming the transistors are properly saturated they should drop perhaps 0.15V. The absolute maximum current sourced by all ports is 200mA so we should stay well away from that. Pick 150mA for the sake of argument. That's 18mA per segment. The output characteristics of the PIC pins when sourcing are not guaranteed above 3mA (8.5mA when sinking). This is parameter D090 in the datasheet. So if you are going to approach the maximum allowable current you will be at the mercy of the PIC variation from unit-to-unit. Not even 'typical' numbers are given. Older PICs sometimes gave the typical curves.. 15mA would drop about a volt, but it's going to be much worse at high temperatures. PICs sink current much better than they source it.

So if you want to stay within guaranteed characteristics for a conservative design you would use 3mA peak (0.75mA average) and the resistor would be (5V - 0.15V - 0.7V - 1.8V)/0.003 = 1.3K. If you want to go into the nether world of typical performance but guaranteed not damaging (it's just a display after all) you could try 15mA peak (3.5mA average) and a resistor of 130 ohms. The worst-case current should still be less than 20mA.

It would be better to switch to a common anode display and use PNP transistors as digit drivers.