Skip to content

Example 39: LCD1602 Display ​

Experiment Overview ​

LCD1602 is a 16-column × 2-row character LCD display. With an I2C adapter board (PCF8574), it can be connected using only 2 wires. FastBee includes a dedicated LCD1602 peripheral type (type: 52), supporting 16x2 and 20x4 character LCDs via PCF8574/PCF8574A I2C expander.

Enable the FASTBEE_ENABLE_LCD1602=1 compile option to use this feature.

Hardware Wiring ​

Board LabelGPIO PinConnected Device
SDAGPIO21I2C adapter SDA
SCLGPIO22I2C adapter SCL

I2C adapter address is typically 0x27 or 0x3F.

JSON Configuration Example ​

json
{
  "peripherals": [
    {
      "id": "lcd1602",
      "name": "LCD1602 Display",
      "type": 52,
      "enabled": false,
      "pins": [21, 22],
      "params": {
        "width": 16,
        "height": 2,
        "interface": 2
      }
    }
  ]
}

Peripheral Execution Linkage ​

⚠️ Note: LCD1602 character display driver is pending implementation; below is the expected configuration structure

Future Scenario: Display Sensor Data (Timer Trigger) ​

Feature: Periodically display temperature and system status on LCD1602

Expected Web UI Configuration Steps ​

Step 1: Ensure Sensor Peripheral is Configured

  • DHT11: dht_01 (Temperature & Humidity Sensor)

Step 2: Create Rule

  1. Click Peripheral Execution in the left menu
  2. Click New Rule button
  3. Fill in basic configuration:
    • Rule Name: LCD Status Display
    • Report Data: ❌ Disabled
    • Enable: ❌ Disabled (pending firmware support)

Step 3: Configure Trigger (Timer Trigger)

  1. Click Add Trigger button

  2. Fill in trigger configuration:

    FieldValueDescription
    Trigger TypeSelect Timer TriggerPeriodic display
    Timer ModeSelect Fixed IntervalSecond interval
    Interval55 seconds

Step 4: Configure Action (Display Control)

  1. Click Add Action button

  2. Fill in:

    • Action Type: Select Display Control
    • Target Peripheral: Select lcd1602
    • Display Content:
    Line 1: FastBee IoT
    Line 2: T:${dht_01.temperature}C
  3. Click Save button

LCD1602 Specifications ​

FeatureDescription
Display Capacity16 characters × 2 rows
I2C Address0x27 or 0x3F
Character SetASCII only, no Chinese support
Refresh Rate≥1 second recommended
Backlight ControlSupported via I2C adapter

Notes ​

  1. I2C Address: Commonly 0x27 (PCF8574) or 0x3F (PCF8574A)
  2. Backlight: Backlight on/off can be controlled via I2C
  3. Contrast: Adapter board has a potentiometer for contrast adjustment
  4. Character Limit: Only supports ASCII characters, no Chinese
  5. Refresh Rate: LCD response is slow; 1 second+ interval recommended
  6. Current Status: LCD1602 driver implemented (FASTBEE_ENABLE_LCD1602=1); for graphical OLED, refer to Example 23

FastBee | fastbee.cn