TM1638 LED controller (80 LEDs max), Keyboard scan (24 keys max)
Titan Microelectronics TM1638 LED controller supports 8 Digits @ 10 Segments. Also supports a scanned keyboard of upto 24 keys. SPI bus interface.
Test program for TM1638 LED controller. Supports LED&KEY, QYF-TM1638 and JY-LKM1638 module.
TM1638 LED controller. Max 80 LEDs, Max 24 Key scan. Supports LED&KEY, QYF-TM1638 and JY-LKM1638 module.
This LED driver is found in frontpanel controllers of consumer electronics such as DVD players. The added features such as the matrix keyboard scanning are useful in these applications. The typical application schematic is shown below.
The TM1638 has a single pin for Data input (commands, LED segments) and Data output (key status). This pin can be connected to mbed SPI MOSI and MISO using a series/pull-up resistor.
The example code was tested on the LED&KEY module (less than $3 on Aliexpress). This modules has 8 seven segment displays with decimal point, 8 LEDs and 8 switches.
The library supports printf style methods to display int, hex and float. Icons may be set and cleared, cursor locate, display clear and brightness setting are available, keys can be read back and tested. Segment displays are available in different formats. The best known is 7-Segment, which is supported by the TM1638. Displays with more segments per digit are more suited to show characters and symbols. These are available with 14 or 16 segments.
However, with some compromising even a 7 segment display can represent most characters reasonably well.
The device is widely available on several modules that are sold on ebay or Aliexpress. Here are some other modules that are also supported by the library:
QYF-TM1638 (8 seven-segments + DP, 16 switches)
JY-LKM1638 (8 seven-segments + DP, 8 Bi-Color LEDS, 8 switches)
Select the target module by enabling one of the #defines in TM1638_Config.h
// Select one of the testboards for TM1638 LED controller #define TM1638_TEST 0 #define LEDKEY8_TEST 1 #define QYF_TEST 0 #define LKM1638_TEST 0
Note that the TM1638 is very similar to LED (eg PT6964) and VFD controllers (eg PT6312) by the same and other vendors. See here.