Example 39: LCD1602 Display
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 Label | GPIO Pin | Connected Device |
|---|---|---|
| SDA | GPIO21 | I2C adapter SDA |
| SCL | GPIO22 | I2C adapter SCL |
I2C adapter address is typically 0x27 or 0x3F.
JSON Configuration Example
{
"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
- Click Peripheral Config in the left menu → Switch to Peripheral Execution tab
- Click New Rule button
- Fill in basic configuration:
- Rule Name:
LCD Status Display - Report Data: ❌ Disabled
- Enable: ❌ Disabled (pending firmware support)
- Rule Name:
Step 3: Configure Trigger (Timer Trigger)
Click Add Trigger button
Fill in trigger configuration:
Field Value Description Trigger Type Select Timer Trigger Periodic display Timer Mode Select Fixed Interval Second interval Interval 55 seconds
Step 4: Configure Action (Display Control)
Click Add Action button
Fill in:
- Action Type: Select Display Control
- Target Peripheral: Select
lcd1602 - Display Content:
Line 1: FastBee IoT Line 2: T:${dht_01.temperature}CClick Save button
LCD1602 Specifications
| Feature | Description |
|---|---|
| Display Capacity | 16 characters × 2 rows |
| I2C Address | 0x27 or 0x3F |
| Character Set | ASCII only, no Chinese support |
| Refresh Rate | ≥1 second recommended |
| Backlight Control | Supported via I2C adapter |
Notes
- I2C Address: Commonly 0x27 (PCF8574) or 0x3F (PCF8574A)
- Backlight: Backlight on/off can be controlled via I2C
- Contrast: Adapter board has a potentiometer for contrast adjustment
- Character Limit: Only supports ASCII characters, no Chinese
- Refresh Rate: LCD response is slow; 1 second+ interval recommended
- Current Status: LCD1602 driver implemented (FASTBEE_ENABLE_LCD1602=1); for graphical OLED, refer to Example 23
