All Projects → jasonacox → TM1637TinyDisplay

jasonacox / TM1637TinyDisplay

Licence: LGPL-3.0 License
Arduino library to display numbers and text on a 4 and 6 digit 7-segment TM1637 display modules.

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to TM1637TinyDisplay

Control Surface
Arduino library for creating MIDI controllers and other MIDI devices.
Stars: ✭ 377 (+1539.13%)
Mutual labels:  display, arduino-library, led
Md parola
Library for modular scrolling LED matrix text displays
Stars: ✭ 282 (+1126.09%)
Mutual labels:  arduino-library, led
Arduino-Blinkenlight
Non-blocking blinking patterns and smooth fade effects for your LEDs.
Stars: ✭ 26 (+13.04%)
Mutual labels:  arduino-library, led
Ws2812fx
WS2812 FX Library for Arduino and ESP8266
Stars: ✭ 1,113 (+4739.13%)
Mutual labels:  arduino-library, led
Lpd8806
Arduino library for LED strips and pixels using LPD8806 (and probably LPD8803/LPD8809)
Stars: ✭ 207 (+800%)
Mutual labels:  arduino-library, led
Esp32 Hub75 Driver
A small, simple, passive driver for HUB75 based LED panels
Stars: ✭ 37 (+60.87%)
Mutual labels:  display, led
Md max72xx
LED Matrix Library
Stars: ✭ 186 (+708.7%)
Mutual labels:  arduino-library, led
SevSeg
Seven Segment library for Arduino
Stars: ✭ 75 (+226.09%)
Mutual labels:  display, arduino-library
DL1414
Arduino Library for DL1414 type 4 character miniature screen modules.
Stars: ✭ 14 (-39.13%)
Mutual labels:  display, arduino-library
LiquidCrystal I2C Hangul
아두이노 16x2 LCD 한글 출력 라이브러리
Stars: ✭ 16 (-30.43%)
Mutual labels:  arduino-library
hologram-SIMCOM
Easily use any SIMCOM cellular module with Hologram's cloud.
Stars: ✭ 42 (+82.61%)
Mutual labels:  arduino-library
HomeSpan
HomeKit Library for the Arduino-ESP32
Stars: ✭ 410 (+1682.61%)
Mutual labels:  arduino-library
Electronic-Cheat-Sheet-and-Schematics-MegaCollection
A lot of Files of various Electronic Shit that I have collected over the years. Cheatsheet, Schematics, Pinouts, Pdf, and More... Enjoy it ;)
Stars: ✭ 43 (+86.96%)
Mutual labels:  led
esp-rgb-led-matrix
Full RGB LED matrix, based on an ESP32 and WS2812B LEDs.
Stars: ✭ 91 (+295.65%)
Mutual labels:  display
Amber
Amber-ify LED torch.
Stars: ✭ 26 (+13.04%)
Mutual labels:  led
RF24Ethernet
OSI Layers 4&5 Wireless (not WiFi) TCP/IP networking on Arduino devices using nrf24l01+ radios
Stars: ✭ 97 (+321.74%)
Mutual labels:  arduino-library
MAX31855
Arduino library for 14-bit MAX31855 K-thermocouple to digital converter
Stars: ✭ 20 (-13.04%)
Mutual labels:  arduino-library
CoopThreads
Lightweight, platform agnostic, stackful cooperative threads library.
Stars: ✭ 18 (-21.74%)
Mutual labels:  arduino-library
pwm-pca9685-rs
Platform-agnostic Rust driver for the PCA9685 I2C 16-channel, 12-bit PWM/Servo/LED controller
Stars: ✭ 19 (-17.39%)
Mutual labels:  led
Seeed Arduino UltrathinLEDMatrix
an Ultrathin 32x16 LED matrix Arduino library
Stars: ✭ 47 (+104.35%)
Mutual labels:  arduino-library

TM1637 Tiny Display

arduino-library-badge Build Status

Arduino Library for the TM1637 Based LED Display Module

Description

This is an Arduino library for 4 and 6 digit 7-segment LED display modules based on the TM1637 chip. Connect the TM1637 display CLK and DIO pins to your Arduino GPIO pins, include this library, initialize TM1637TinyDisplay and call easy to use functions like showNumber(), showString(), showLevel() and showAnimation(). Display will scroll text for larger strings. Functions support screen splitting for easy number + text formatting. Library also runs well on tiny controllers including the ATtiny85.

Hardware

TM1637

  • 4-Digit Display modules based on the TM1637 chip are available from HiLetgo, DX and SeeedStudio.
  • 6-Digit Display modules - see here.

TM1637

The display has four connectors:

  • CLK - Clock - attach to any GPIO output
  • DIO - Data - attach to any GPIO output
  • VCC - Power 5v
  • GND - Ground

Power Note: Steady clean power is important for circuit stability. If you are seeing display artifacts during high frequency updates or animation sequences, you may be experiencing power fluctuations that are impacting signal timing and communication with the TM1637. This is especially true with standalone microprocessor applications that lack any power conditioning (e.g. ATtiny85). A polarized 100uF electrolytic capacitor inserted across VCC and GND can help smooth out the spikes.

Decimals and Colons: Some TM1637 displays come equipped with a middle colon LED (as shown above) as used in digital clocks but with no decimal points. Some displays come with decimal point LEDS for each digit. Some come with both but often the decimal point LEDs are not connected. These extra LEDs are activated by setting the upper bit (0x80) for the digit next to the dot. This library will handle setting that for you via the showNumber() function when you specify floating point numbers or via the showNumberDec() function where you can set the decimal point manually.

Installation

This library is available via the Arduino IDE. Install this library via Tools, Manage Libraries, search for "TM1637TinyDisplay" and click Install.

Alternatively, you can install this manually by cloning this repo into your Arduino library folder (e.g. ~/Documents/Arduino/libraries).

Usage

The library provides a single class named TM1637TinyDisplay with the following functions:

  • showNumber - Display an integer and floating point numbers (positive or negative)
  • showNumberDec - Display a number with ability to manually set decimal points or colon
  • showNumberHex - Display a number in hexadecimal format and set decimal point or colon
  • showString - Display a ASCII string of text with optional scrolling for long strings
  • showLevel - Use display LEDs to simulate a level indicator (vertical or horizontal)
  • showAnimation - Display a sequence of frames to render an animation
  • setSegments - Directly set the value of the LED segments in each digit
  • setBrightness - Sets the brightness of the display
  • setScrolldelay - Sets the speed for text scrolling

PROGMEM functions: Large string or animation data can be left in Flash instead of being loaded in to SRAM to save memory.

  • showAnimation_P - Display a sequence of frames to render an animation (in PROGMEM)
  • showString_P - Display a ASCII string of text with optional scrolling for long strings (in PROGMEM)

Example Code

#include <Arduino.h>
#include <TM1637TinyDisplay.h>

// Define Digital Pins
#define CLK 1
#define DIO 2

// Initialize TM1637TinyDisplay
TM1637TinyDisplay display(CLK, DIO);

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

void loop() {
  // Say Hello
  display.showString("HELLO");
  delay(500);

  // Clear Screen
  display.clear();

  // We can count!
  for (int x = -100; x <= 100; x++) {
    display.showNumber(x);
  }

  // Level indicator
  for (int x = 0; x <= 100; x = x + 10) {
    display.showLevel(x, false);
    delay(20);
  }
  for (int x = 100; x >= 0; x = x - 10) {
    display.showLevel(x, false);
    delay(20);
  }

  // Split screen for temperature
  display.showString("\xB0", 1, 3);        // Degree Mark, length=1, position=3 (right)
  for (int x = -90; x < 200; x++) {
    display.showNumber(x, false, 3, 0);    // Number, length=3, position=0 (left)
    delay(10);
  }

  // The end
  display.showString("End");
  delay(1000);
}

Refer to TM1637TinyDisplay.h for information on available functions. See also Examples for more demonstration.

Animation and Animator Tool

The showAnimation() function projects a sequence of frames (patterns) onto the display. This works by defining the animation sequence through a multi-dimensional array of patterns.

You can use the included javascript based interactive 7-Segment LED Animator Tool to help build your animation. The source code is in the Examples folder. This tool will let you set up the LED sequences you want, save each frame and copy the final code (a static array) directly into your sketch to use for the showAnimation(data, frames, timing) function. Here is an example:

// Data from Animator Tool
const uint8_t ANIMATION[12][4] = {
  { 0x08, 0x00, 0x00, 0x00 },  // Frame 0
  { 0x00, 0x08, 0x00, 0x00 },  // Frame 1
  { 0x00, 0x00, 0x08, 0x00 },  // Frame 2
  { 0x00, 0x00, 0x00, 0x08 },  // Frame 3
  { 0x00, 0x00, 0x00, 0x04 },  // Frame 4
  { 0x00, 0x00, 0x00, 0x02 },  // Frame 5
  { 0x00, 0x00, 0x00, 0x01 },  // Frame 6
  { 0x00, 0x00, 0x01, 0x00 },  // Frame 7
  { 0x00, 0x01, 0x00, 0x00 },  // Frame 8
  { 0x01, 0x00, 0x00, 0x00 },  // Frame 9
  { 0x20, 0x00, 0x00, 0x00 },  // Frame 10
  { 0x10, 0x00, 0x00, 0x00 }   // Frame 11
};

  // Display Animation sequence
  display.showAnimation(ANIMATION, FRAMES(ANIMATION), TIME_MS(50));

TM1637 6-Digit Display - TM1637TinyDisplay6

TM1637-6

6-Digit Display modules based on the TM1637 chip are available from Amazon and AliExpress.

TM1637-6-Back

This library now supports the 6-digit display as well as the 4-digit display. The 6-digit display requires additional handling. Specifically, the display digits are not sequential (requires a map) and the 7-segment LED data must be uploaded in reverse order.

TM1637TinyDisplay6 handles this for you but you must initialize the display using the TM1637TinyDisplay6 class:

// Includes
#include <Arduino.h>
#include <TM1637TinyDisplay6.h>       // Include 6-Digit Display Class Header

// Define Digital Pins
#define CLK 1
#define DIO 2

TM1637TinyDisplay6 display(CLK, DIO); // 6-Digit Display Class

void setup()
{
  display.setBrightness(BRIGHT_HIGH);
  display.clear();
  display.showString("digits");
  delay(1000);
  display.showNumber(123456);
  delay(1000);
  display.showNumber(123.456);
  delay(1000);
}

References and Credit

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].