TM1637 display/How it shows a number/08. Eight steps of brightness
How it shows a number · 08 of 13

Eight steps of brightness

Eight levels, and they are not eight equal steps: the bottom three are 1, 2 and 4 sixteenths and the top five are 10 to 14. Level 0 is dim rather than off, and off is a different bit entirely.

Eight levels, unevenly spaced

Brightness on this chip is not a voltage or a current — it is how much of each digit's turn the segments are actually lit for. The datasheet calls it the pulse width and gives eight of them: 1, 2, 4, 10, 11, 12, 13 and 14 sixteenths.

Eight steps, unevenly spaced
10/16
setBrightness3
And the on/off bit
Pulse width
10/16
Of the time
63 %
Byte sent
0x8B
Level 0 is dim, not dark. The eight steps are 1, 2, 4, 10, 11, 12, 13 and 14 sixteenths of each digit’s turn, so most of the range sits at the top and the one real jump is from level 2 to level 3. If you want a night mode, 0 to 2 is where it lives. One catch: the brightness is only sent with the next lot of digits, so calling setBrightness() on its own appears to do nothing until something is shown.

Those numbers are worth looking at twice. Levels 0, 1 and 2 are a quarter of the range between them, levels 3 to 7 share the rest, and the jump from level 2 to level 3 is bigger than the whole distance from 3 to 7.

Which is exactly backwards from how the control feels. Somebody turning brightness up a step at a time sees almost nothing happen between 3 and 7, and then finds the only real dimming available is down at the bottom of the range.

For a bedside clock, level 0 or 1 is the night setting. For a display that has to be read across a lit room, anything from 3 up, and the difference between 3 and 7 is mostly how much current it draws.

It is sent with the digits, not on its own

setBrightness() only changes a variable inside the library. The value reaches the chip as part of the next write, tacked on to the end of the digits.

display.setBrightness(1);
// nothing has changed on the display yet
display.showNumberDec(value);   // now it is dim

This trips people up in setup(), where a setBrightness after the last showNumberDec appears to be ignored. It is not ignored, it is queued, and it will appear the next time anything is written — possibly minutes later, which makes it look intermittent.

Off is a separate bit

display.setBrightness(4, false);   // dark
display.setBrightness(4, true);    // and back, same number still there

The second argument is the display-on bit, and the digits survive it. The chip keeps its four bytes; only the output is switched off.

That is the clean way to blink a whole display — an alarm, a warning, a value that has gone stale — without re-sending anything or losing what was on it. It is also lower effort than blanking and rewriting: two bytes on the wire instead of seven.

And brightness is current

Each step up is more time with the LEDs conducting, and a panel showing 8888 at level 7 is the most current this board will ever draw. One display on a USB port is nothing to worry about. Six of them at level 7, powered through an Uno's 5V pin, is worth measuring before you trust it — more than one display picks that up.

When it does not work

setBrightness does not change anything

The brightness is only sent alongside a lot of digits, so calling it on its own does nothing visible until the next showNumberDec or setSegments. Change the level, then write the number again.

setBrightness(0) does not turn it off

Level 0 is one sixteenth — dim, but clearly lit in a dark room. Off is the second argument: setBrightness(0, false) clears the display-on bit. The four digits stay in the chip's memory and come back when you turn it on again.

Levels 3 to 7 all look much the same

They are: 10, 11, 12, 13 and 14 sixteenths, which is a total range of about 40 percent. Every large change in brightness is down at levels 0 to 2. If you want a noticeably dimmer night mode, that is where it lives.

The display flickers at low brightness

At level 0 a digit is lit for one sixteenth of its own quarter of the scan, which is a very short pulse repeated at the chip's own rate. Some people see that as flicker, particularly out of the corner of the eye, and there is no way to slow or speed the scan.

Where this goes next

Which colours need which supply, and why a 5 V display next to an ESP32 is a problem.

3.3 V or 5 V

Edit this page — content/books/tm1637-display/eight-steps-of-brightness.mdx

Community

Questions about this product

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

This page covers several products. Choose yours to see the right 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