Test of two other LED display driver libraries
For some of my projects I needed a LED display on the Arduino. This is fairly easy with the library manager in Arduino I could find two libraries supporting the display I wanted (TM1637), but everything was not fine:
TM1637 by Avishay Orpaz (TM1637Display)
Has functions to display integer and hex numbers on any positions of the display, it can also display raw data, but it was a bit slow. I connected my oscilloscope to the communications pins to check.
It needs about 22ms to update the display, it is slow and why do the clock only go to 3V most of the time?
A closer look at the waveforms shows that taking a signal high is rather slow, why is that?
In the datasheet for the TM1637 they suggest using 100pF capacitors on the data and clock line, this will slow the speed down a bit, but not this much. Looking into the code for the library I found the reason, it do not pull the lines high, but turns off the driver and let them slowly drift high (Slow at microprocessor speed, it is about 100us), not the ideal way to do fast communication.
Grove 4-Digit Display by Seed Studio (TM1637)
I decided to look at the other library also, it has functions to show raw data only, this means I would need to write some interface code.
It is much faster, it needs about 5.5ms here, but that is not its fastest mode. Depending on function it will either update one digit or all 4 digits at once, the later being faster:
With all four digits updated at once the time is about 2.3ms, about 10 times faster than the first library.
A closer look at the communication shows it is using clock with less than 10us high time and they are square, this is a much better speed. There is one issue, look at the blue circle, that is drivers fighting about the state of the signal, in this case the Arduino and the TM1637 that tries to bring the data line to high and low at the same time, this is not very good!
My library can update 6 digits in about 0.4ms and there is no bus contention, for this it uses direct IO, when using Arduino IO it takes about 1.5ms or 3.7ms in slowest mode.
Conclusion
I could have searched for more libraries, but decided to do my own, with the two above as examples it could not be very difficult and I could include all the functions I want. As is often the case I made a bit more than I originally planned.
My driver