Ten segments, one chip
Every pin is comfortably inside its own rating and the bar can still be over the limit, because the ATmega328P budgets its sink current by port group and nine of these ten pins are in the same one. A red bar with all ten segments lit is over it.
The number that is not per pin
Each segment draws about 14 mA on a red bar, and one ATmega328P pin is characterised at 20 mA. So far so comfortable.
The catch is in note 4 of the data sheet's DC characteristics, which does not budget by pin. It budgets by port group, and says the sink currents of all the pins in one group should add up to no more than 100 mA. Ports B0–B5 and D5–D7 are one such group — D5 to D13 in Arduino numbering, which is nine of the ten pins the demo sketch uses.
Nine red segments at 14 mA is about 122 mA into one 100 mA allowance, and every individual pin is still under a third of its own rating.
What going over looks like
Not smoke. The data sheet's own words are that if the sum is exceeded, the LOW-level output voltage "may exceed the related specification" — the pin stops holding a reliable 0 V. It might sit at half a volt instead, and half a volt taken off every segment makes the whole bar slightly dimmer, slightly unevenly, at exactly the moment it fills.
It is a display that misbehaves, not a part that fails, and it is invisible in the code. That is why it is worth knowing before you meet it.
Four ways out
- Light fewer at once. A level meter is usually not full, and dot mode never lights more than one segment. This is the answer most of the time.
- Use a nitride colour. Green, blue and white segments draw about 9 mA instead of 14, which brings ten of them inside the budget.
- Spread the pins. Moving two segments to A0 and A1 puts them in a different group. It helps, and it is fiddly.
- Use a driver. A 74HC595 sinks the LED current on its own supply and costs three pins instead of ten — ten pins, or three.
The other total
All ten segments together is about 136 mA out of the Uno's 5V pin. That is fine on USB, which will give 500 mA, and fine on a barrel jack. The supply is not the constraint here; the chip's own sink budget is.
When it does not work
By the bar dimming slightly and unevenly as the last segments come on, and by nothing in the code explaining it. The data sheet's wording is that beyond the group sum, VOL — the voltage a pin holds when it is LOW — is no longer ensured. A pin that sits at 0.8 V instead of 0.2 V takes that much away from every LED on it.
Not at these numbers. The absolute maximum is 40 mA on one pin and 200 mA through the whole chip's ground pin, and ten red segments is about 136 mA total with no pin over 14. It is outside what the data sheet characterises, not outside what it survives. Treat it as a reason the display misbehaves rather than a hazard.
Do not light all ten at once. A bar meter normally shows a level, and a level is rarely full; dot mode never lights more than one. If you genuinely need ten on together, use a blue, green or white bar — those draw about 9 mA a segment instead of 14 — or drive the bar through a shift register with its own supply.
No. The ESP32's pins are specified individually rather than in port groups, and 14 mA is well inside what one can sink. The rail is the problem there instead, which is the next page.
Note 4 of the data sheet names three: ports C0–C5 with the two spare ADC inputs; ports B0–B5 and D5–D7 with the crystal pins; and ports D0–D4 with RESET. In Arduino numbering that middle group is D5 to D13, which is nine of the ten this sketch uses.
Edit this page — content/books/led-bar-graph/ten-segments-one-chip.mdx
Questions about this product
See what other owners have asked, and read their solutions.
10-Segment LED Bar Graph Kit, 12 Bars in 6 Colours
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.