Skip to main content

lcd_i2c

I2C LCD display module for text output with HD44780-compatible controller.

Overview

The lcd_i2c node drives HD44780-compatible LCD displays through an I2C backpack (typically PCF8574-based). These character LCD modules are popular for displaying status messages, sensor readings, and simple menus in IoT projects. The I2C interface reduces wiring from 16 pins down to just 4 (VCC, GND, SDA, SCL).

I2C
Interface
4
Wires Only
20x4
Max Characters
5V
Operating Voltage

Properties

Property Type Default Options Description
i2cBus select "/dev/i2c-1" /dev/i2c-0, /dev/i2c-1 I2C bus device path
address select "0x27" 0x27, 0x3f I2C address of the LCD backpack
rows select "2" 1, 2, 4 Number of display rows
cols select "16" 16, 20 Number of display columns
backlight boolean true - Enable LCD backlight on startup
cursorBlink boolean false - Enable blinking cursor at write position

Input

msg.payload (text to display)
// Simple string - displays on line 1
msg.payload = "Hello World!";

// Multi-line with array
msg.payload = [
  "Temperature: 23C",
  "Humidity: 65%"
];

// Advanced: specify line and column
msg.payload = {
  "line1": "Temp:  23.5C",
  "line2": "Humid: 65.2%",
  "backlight": true
};

Output

Confirmation
{
  "payload": true,
  "topic": "lcd/status",
  "_lcd": {
    "address": "0x27",
    "rows": 2,
    "cols": 16,
    "backlight": true
  }
}

Wiring / Connection Diagram


  Raspberry Pi              I2C LCD Module
  +-----------+            +------------------+
  |           |            |  PCF8574 Backpack |
  |  5V   (2) +------------+ VCC              |
  |           |            |                  |
  |  SDA  (3) +------------+ SDA              |
  |           |            |                  |
  |  SCL  (5) +------------+ SCL              |
  |           |            |                  |
  |  GND  (6) +------------+ GND              |
  |           |            |                  |
  +-----------+            |   +----------+   |
                           |   | HD44780  |   |
                           |   |  16x2 or |   |
                           |   |  20x4    |   |
                           |   +----------+   |
                           +------------------+

  Address selection (solder jumpers on backpack):
  - A0, A1, A2 all open:  0x27 (default)
  - A0, A1, A2 all closed: 0x20
  - Some modules default to 0x3F
        

Tip: Run i2cdetect -y 1 to confirm the LCD address. Common addresses are 0x27 and 0x3F depending on the PCF8574 variant used.

Example Use Cases

Sensor Data Display

Show live temperature and humidity readings on a 16x2 LCD.

bme280 -> function -> lcd_i2c
// Function node: format sensor data for 16x2 LCD
var temp = msg.payload.temperature.toFixed(1);
var humid = msg.payload.humidity.toFixed(1);

msg.payload = [
  "Temp:  " + temp + "C",
  "Humid: " + humid + "%"
];
return msg;

System Status Dashboard (20x4)

Display system information on a 20x4 character LCD.

// Function node: build 4-line status display
var ip = flow.get("ipAddress") || "No Network";
var uptime = flow.get("uptime") || "0h";
var cpu = flow.get("cpuTemp") || "--";
var nodes = flow.get("activeNodes") || 0;

msg.payload = {
  "line1": "EdgeFlow v2.1.0   ",
  "line2": "IP: " + ip,
  "line3": "Up:" + uptime + " CPU:" + cpu + "C",
  "line4": "Nodes: " + nodes + " active"
};
return msg;

Alert Notification with Backlight Control

Flash the backlight and display alert messages when thresholds are exceeded.

// Function node: alert with backlight flash
var temp = msg.payload.temperature;
var threshold = 35;

if (temp > threshold) {
  msg.payload = {
    "line1": "!! WARNING !!",
    "line2": "Temp: " + temp.toFixed(1) + "C HIGH",
    "backlight": true
  };
} else {
  msg.payload = {
    "line1": "System Normal",
    "line2": "Temp: " + temp.toFixed(1) + "C",
    "backlight": true
  };
}
return msg;

Common Use Cases

Sensor Readouts

Display live temperature, humidity, and pressure values

System Status

Show IP address, uptime, and device health on a local display

Alert Notifications

Visual warnings with backlight flashing for threshold alerts

Menu Interfaces

Simple selection menus with button navigation on 20x4 displays

Related Nodes