A different TM1628 7-segment display

 Posted by:   Posted on:   Updated on:  2017-11-18T21:36:12Z

TM1628 LED display controller - library for Arduino

TM1628 is an LED controller IC that's used mostly at DVD players front panels. The IC can control up to 7 sets of segments (separate digits) and can also process input from up to 16 individual keys. It is controlled via SPI compatible serial interface.

The only Arduino compatible library I was able to find for TM1628 is developed by Vasyl Yudin and is available on GitHub. But, I couldn't get any readable output on display. That happened because my front panel had a different segment assignment to the controller than what I found on YouTube (the display with disc icon on it).

My front panel came from TeleSystem TS5.9RX DVD Recorder and it has 7 digits and some other indicator LEDs. The PCB also contains 5 keys - but I can expand it by adding more buttons. Below is a sketch example for this front panel. It is 5V compatible so it can be connected directly to 5V levels development boards like Arduino and compatible.
A different TM1628 7-segment display
This is an example sketch that prints on display the value read from key presses.
#include <tm1628ts.h>

TM1628ts disp(9, 7, 8);

void setup() {
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  disp.init(0); // start with lowest intensity
  delay(1000);
  digitalWrite(13, LOW);

  for (int i = 7; i > 0; i--) {
    disp.putDigitAt(16, i);
    disp.writeBuffer();
    delay(150);
  }

  delay(300);

  for (int i = 7; i > 0; i--) {
    disp.clearBuffer(i);
    disp.writeBuffer();
    delay(150);
  }
}

void loop() {
  byte rcv = disp.getKeyboard();

  digitalWrite(13, rcv > 0 ? HIGH : LOW);
  disp.clearBuffer();
  disp.putNumberAt(rcv, 1, false, 10);
  disp.writeBuffer(); // command 3
  delay(100);
}
You can see the basic usage. Declare a TM1628ts object and specify pins (Clock, Data, Strobe). Use init() with a value between 0 and 7 to initialize and turn on the display with specified intensity. Use init() without arguments and the display gets initialized but remains turned off. You will have to use turnOn() thereafter to start it. Only writeBuffer() writes local stored data to controller so don't forget to call it after setting status LEDs or setting numbers/digits. Check often if a key has been pressed using getKeyboard().

This is how segments are assigned to the buffer array that is sent to the controller.

TM1628 segment assignments
TM1628 segment assignments
Here is the display turned on and the entire front panel.

Arduino TM1628 panel showing HEX number 4bb807f
TM1628 panel showing HEX number 4bb807f
TM1628 front panel from TeleSystem TS5.9RX DVD
TM1628 front panel from TeleSystem TS5.9RX DVD
You can download my TM1628 Arduino library on GitHub.

No comments :

Post a Comment

Please read the comments policy before publishing your comment.