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.
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 dimThis 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); // queued, like the level
display.showNumberDec(value); // now it is dark
display.setBrightness(4, true);
display.showNumberDec(value); // and lit againThe second argument is the display-on bit. The chip itself can switch its outputs off and keep its digits, but this library never sends the on/off bit on its own: like the level, it goes out with the next lot of digits. So off is a write, and on again is another.
That is still the clean way to blink a whole display (an alarm, a value that has gone stale), because your sketch keeps writing the real number and only the bit changes. Blanking it with four empty digits instead means remembering what was there to put it back.
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
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.
Level 0 is one sixteenth: dim, but clearly lit in a dark room. Off is the second argument, setBrightness(n, false), and like the level it only reaches the chip with the next write. So call it, then show the same number again, and the panel goes dark.
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.
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.
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
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.