enter image description hereThe 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 4x8 supply current 60 mA When displaying 1x8 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.

Resulting from the answers and comments I have continued as follows.

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

  • \$\begingroup\$ You have not supplied a schematic. The problem is the digit drive current, not the segment current if you are using direct drive. Digit current is max 7 or 8 times the segment, and equal to the maximum current for the entire display. \$\endgroup\$ Commented Nov 24, 2016 at 16:17
  • \$\begingroup\$ I agree. The peak current for one digit is the same as the average current for the entire display (taking all segments working ) The pic should be able to handle that. 25 mA per I/O and 200 mA in total. Anyway the unit has been running now 2 days and no noticable temperature increase at any component. \$\endgroup\$
    – Decapod
    Commented Nov 24, 2016 at 16:35
  • \$\begingroup\$ There are other failure modes besides bulk temperature, especially electromigration and diffusion on the chip as the current densities get up to stupidly high numbers like tens of thousands of A/cm^2. You approach absolute-maximum ratings at considerable risk in terms of long-term reliability. If your ambient temp is high, then best stay even further away. \$\endgroup\$ Commented Nov 24, 2016 at 16:53
  • \$\begingroup\$ @SpehroPefhany You might be right but I don't understand. Where do I make a mistake in my reasoning? I only look for the correct way of calculating the segment resistors in the matrix situation. \$\endgroup\$
    – Decapod
    Commented Nov 24, 2016 at 17:05

1 Answer 1


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

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.

  • \$\begingroup\$ Not clear. "That means your whole display will take 8 * 4 * 0.02 = 640mA when the display itself is driven to maximum brightness". My thinking: If one digit (8 segments) is driven to 20 mA then the digit current becomes 160 mA peak. Since only one digit is on at the time the total average current would mount up to 160 mA also but then as a total. \$\endgroup\$
    – Decapod
    Commented Nov 24, 2016 at 14:23
  • \$\begingroup\$ Right now I have 180 ohm resistors in use and the system is using only 60 mA in total. When only one digit is operational the current drops to 15 mA average. So the peak would be 60 mA and the peak segment current 60/7 . \$\endgroup\$
    – Decapod
    Commented Nov 24, 2016 at 14:31
  • \$\begingroup\$ @Decapod: if you have 8 LEDs per display and each LED draws 15 milliamperes, then that's 120 milliamperes for the one display. Now, if you have a 4 digit display multiplexed at 25% per digit and you have to increase the current through each led by factor of 4 to get decent brightness, then that's the same as having 60 milliamperes through each segment of a non-multiplexed display, which comes out to \$ 60mA \text{ per segment}\times 8 \text { segments} = 480mA\$ \$\endgroup\$
    – EM Fields
    Commented Nov 24, 2016 at 14:49
  • \$\begingroup\$ Assuming direct digit drive (please add your schematic if you want advice tailored to your exact situation) 60mA is more than one output can supply, 3x more for a PIC probably, so your current is being determined mostly by the PIC output characteristics. Not good at all. You could short the resistors out and the current would not change that much. \$\endgroup\$ Commented Nov 24, 2016 at 14:49
  • \$\begingroup\$ @EMFields You comment is clear and understood. I do however not increase the current so as per your example it would remain 120 mA. See my extended question. \$\endgroup\$
    – Decapod
    Commented Nov 24, 2016 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.