LED bar graph/Why a bar of ten/01. A level you can see
Why a bar of ten · 01 of 11

A level you can see

A bar graph is a number you read without reading. Ten segments is ten steps, which is too coarse for a meter and exactly right for a battery, a volume or a signal — and it is the trade you are making when you spend ten GPIO pins on one.

What the part is for

A number on a screen has to be read. A bar is taken in at a glance, from across the room, by somebody who is doing something else — which is why fuel gauges, volume controls and battery meters have looked like this for fifty years.

The cost is resolution. This part has ten segments, so it can show ten steps and nothing in between.

The same number, printed and drawn
64% · bar mode
Value64%
Mode
Segments lit
6
Step size
10%
Worst error
5%
A bar is read without being read. Ten segments is ten steps, so the most the drawing can be wrong by is half a step — five percent. That is useless for a voltmeter and plenty for a volume, a battery or a signal strength, which is the whole case for spending ten pins on it.

Half a step is five percent, and five percent is useless for a voltmeter and plenty for "how full is it". Decide which one you are building before you wire anything.

Bar or dot

The same ten segments do two different jobs depending on one line of code.

Bar mode lights every segment up to the level, so the display reads as a column filling. Dot mode lights one, so it reads as a needle moving. Dot mode draws a tenth of the current, which matters more than it sounds like it does — that number comes back in ten segments, one chip.

Six ten-segment bar graphs standing in a row on a dark surface, each lit fully: red, yellow, white, green, blue, and one multicolour bar whose segments run red, yellow, green and blue from left to right.
The six bars in the kit, all ten segments lit. Two of each colour, twelve in the box.

What it is not

It is not a display module. There is no driver chip in it, nothing to initialise, no library to install and no address to get wrong. It is ten LEDs in a plastic case, and every one of them needs its own wire and its own resistor.

That is the whole of the good news and the whole of the bad news, and the next page is about the twenty pins it takes to say it.

When it does not work

Ten steps does not sound like much

It is not, and that is the point. Ten segments can be wrong by half a step, so five percent. If the reader needs to know the number, print it; if they need to know whether it is going up, draw it. Most projects want both, on different parts of the screen.

Can a segment be half lit?

Yes, by switching it on and off faster than the eye follows. That is PWM, and on an Arduino only six pins can do it in hardware, so a ten-segment bar cannot dim every segment that way without help. Dot mode and bar mode are the two things you can do with plain on and off.

Should I use bar mode or dot mode?

Bar mode if the quantity is a level — a tank, a battery, a volume. Dot mode if it is a position or a reading, like a tuning needle, and whenever the display will sit lit for hours: one segment is a tenth of the current of ten.

Where this goes next

Twenty pins, no chip, and the one thing about the part that is not printed on it.

Ten LEDs in one package

Edit this page — content/books/led-bar-graph/a-level-you-can-see.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

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.

Browse Modules and blocks on the forum