Arduino and TM1637 display

Zápisník experimentátora

Sometimes we need to display only one number from the Arduino. Then we can fit a small display that displays data using the 7-segment display. The ideal solution is the TM1637 module, which also includes a display driver on the board, which takes care of displaying the data. The Arduino simply sends out what's to be displayed, and you do not need to worry about the rest. You can use Arduino for more important tasks. All you need is only 4 connecting wires.

Connect module according to the following scheme. You need only two data wires to connect.

Board TM1637

Several versions of this module are sold. One version is designed to display time and therefore contains a colon as a time separator. The second version is for displaying numbers and contains a decimal point for each digit.

Library

On the Internet, you will find several different libraries for the module. I have used this library in the examples.

Examples

Because I plan to use this display to display numbers, I just used in the examples library functions to make it easier to display the number on the display. You can find more functions in the library example.

The first example shows a sequence of numbers that change every second.

#include <TM1637Display.h>

// Module connection pins (Digital Pins)
#define CLK 7
#define DIO 6

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   1000
int counter = 0;

TM1637Display display(CLK, DIO);

void setup() {
  display.setBrightness(0x02);
}

void loop() {
  display.showNumberDec(counter, false);
  counter++;
  delay(TEST_DELAY);
}

The second example shows the same number sequence, except that the number is with the leading zeros.

#include <TM1637Display.h>

// Module connection pins (Digital Pins)
#define CLK 7
#define DIO 6

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   1000
int counter = 0;

TM1637Display display(CLK, DIO);

void setup() {
  display.setBrightness(0x02);
}

void loop() {
  display.showNumberDec(counter, true);
  counter++;
  delay(TEST_DELAY);
}

Source code

The source code is located on the GitHub server.

Video

The video is located on YouTube.



Video


21.10.2018


Menu