Monday, 12 February 2018

Cheap display keyboard TM1638

TM1638 led&key

With this module you will get buttons and numeric display in one package.
8 led, 8 7-segment numbers and 8 buttons using only 3 data lines and less than 2$.

You can get one from Here.

Hardware setup

For demo you have to connect following pins
DIO GPIO4 (Wemos D2)
CLK GPIO14 (Wemos D5)
STB GPIO12 (Wemos D6)
VCC +5v
GND GND

Software setup


There are few Arduino libraries that you can use.
This library has most starts in Github, and I will show example about it.
https://github.com/rjbatista/tm1638-library
For information on installing libraries, see: http://www.arduino.cc/en/Guide/Libraries

Library has one bug open, that you should take in to account.
setDisplayToDecNumber should display "0"

If you get error like:

TM16XX.cpp:44:66: error: no matching function for call to 'min(int, byte&)'

You need to add these lines to beginning of file c:\Users\myname\Documents\Arduino\libraries\tm1638-library-master\TM16XX.h
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
More info at: https://github.com/esp8266/Arduino/issues/398
Path to Arduino libraries can be something else, you can see your path, from menu File -> Preferences -> Sketchbook location

Demo

First is example how you can define place of dot.
Next is shown how this library shows alphabets. I think this library and display is not good for showing text.
In the end I will show how to check what buttons are pressed and how to light led on top of module.



No comments:

Post a Comment