Skip to content

TM1637 Seven-Segment Display ​

Overview ​

TM1637 is a 4-digit 7-segment display driver chip that communicates via a 2-wire serial interface (CLK + DIO). Suitable for displaying numbers, time, and simple text.

Supported Peripheral Types ​

Typetype ValueDescription
SEVEN_SEGMENT_TM163747TM1637 4-digit display

Hardware Wiring ​

TM1637 PinConnectionDescription
VCC3.3V / 5VPower supply
GNDGNDGround
CLKGPIO (any)Clock line
DIOGPIO (any)Data line

Configuration ​

Before saving TM1637 configuration, verify CLK/DIO pins, digit count, and default brightness.

For TM1637 debugging, first display a fixed number to confirm CLK/DIO pins and brightness, then connect to sensor readings or peripheral execution actions.

Step 1: Navigate to Peripheral Management Page ​

  1. Open a browser and navigate to the ESP32 IP address
  2. After logging in, click Peripheral Configuration in the left menu

Step 2: Add TM1637 Seven-Segment Display Peripheral ​

  1. Click the Add Peripheral button

  2. Fill in the configuration:

    FieldValueDescription
    Peripheral IDtm1637_1Unique identifier
    Name4-Digit DisplayDisplay name
    Peripheral TypeSeven-Segment Display (type: 47)TM1637 driver
    CLK Pin18Clock pin
    DIO Pin19Data pin
    Brightness40-7 (0=dim, 7=brightest)
  3. Click Save

Step 3: Verify Configuration ​

  1. Find the newly added peripheral in the peripheral list
  2. Click the Enable toggle
  3. The display should show default content

💡 Tip: Recommend using 5V power supply for optimal brightness


Method 2: JSON Configuration File Import ​

Add the following configuration to the peripherals array in data/config/peripherals.json:

json
{
  "id": "tm1637_1",
  "name": "4-Digit Display",
  "type": 47,
  "enabled": false,
  "pins": [18, 19],
  "params": {
    "brightness": 4
  }
}

Parameter Description ​

ParameterDescriptionRange
brightnessDisplay brightness0-7 (0=dim, 7=brightest)

pins[0] = CLK pin, pins[1] = DIO pin

Peripheral Execution Integration ​

Web Interface Configuration Steps ​

Create Display Rule

  1. Click Peripheral Execution in the left menu
  2. Click the Add Rule button
  3. Configure trigger (e.g., timer trigger, 5-second interval)
  4. Add actions:
    • Action 1: Read sensor data
      • Action Type: Sensor Read
      • Target Peripheral: dht1
    • Action 2: Display on seven-segment display
      • Action Type: Display Number
      • Target Peripheral: tm1637_1
      • Enable Use Received Value (display temperature value)
  5. Click Save

💡 Tip: Can use "Display Number", "Display Text", or "Clear Screen" actions


JSON Configuration Example ​

Display Number (ACTION_DISPLAY_NUMBER = 24) ​

json
{
  "targetPeriphId": "tm1637_1",
  "actionType": 24,
  "actionValue": "12.34",
  "useReceivedValue": false,
  "syncDelayMs": 0,
  "execMode": 0
}

Supported number formats:

  • "1234" — Display 1234
  • "12.34" — Display 12.34 (with decimal point)
  • "12:34" — Display 12:34 (with colon, suitable for clock)

Display Text (ACTION_DISPLAY_TEXT = 25) ​

json
{
  "targetPeriphId": "tm1637_1",
  "actionType": 25,
  "actionValue": "PLAY",
  "useReceivedValue": false,
  "syncDelayMs": 0,
  "execMode": 0
}

Only some displayable characters are supported: 0-9, A-F, H, L, P, U, b, d, o, n, r, t, -

Clear Screen (ACTION_DISPLAY_CLEAR = 26) ​

json
{
  "targetPeriphId": "tm1637_1",
  "actionType": 26,
  "actionValue": "",
  "useReceivedValue": false,
  "syncDelayMs": 0,
  "execMode": 0
}

Display with Received Value ​

When useReceivedValue: true, the sensor data received at trigger time is displayed directly:

json
{
  "id": "exec_show_temp",
  "name": "Display Temperature on Seven-Segment",
  "enabled": false,
  "execMode": 0,
  "triggers": [
    {
      "triggerType": 1,
      "triggerPeriphId": "",
      "operatorType": 0,
      "compareValue": "",
      "timerMode": 0,
      "intervalSec": 5,
      "timePoint": "",
      "eventId": "",
      "pollResponseTimeout": 1000,
      "pollMaxRetries": 2,
      "pollInterPollDelay": 100
    }
  ],
  "actions": [
    {
      "targetPeriphId": "dht1",
      "actionType": 19,
      "actionValue": "",
      "useReceivedValue": false,
      "syncDelayMs": 0,
      "execMode": 0
    },
    {
      "targetPeriphId": "tm1637_1",
      "actionType": 24,
      "actionValue": "",
      "useReceivedValue": true,
      "syncDelayMs": 100,
      "execMode": 0
    }
  ],
  "protocolType": 0,
  "scriptContent": "",
  "reportAfterExec": false
}

Notes ​

  1. Pin Order: In configuration, pins[0] is CLK, pins[1] is DIO; do not reverse
  2. Character Limit: Only 4 digits displayed; numbers/text exceeding 4 digits will be truncated
  3. Brightness Adjustment: 0-7 brightness levels adjustable via Web interface or configuration
  4. Power Supply: Recommend 5V power supply for optimal brightness; 3.3V also works but dimmer
  5. Refresh Rate: Display updates immediately when content changes; no need to worry about refresh rate

FastBee | fastbee.cn