Example 23: OLED Display
About 2 min
Example 23: OLED Display
Experiment Overview
Drive a 0.96-inch OLED display (SSD1306) via I2C interface to display text, numbers and simple graphics. FastBee has a built-in LCD peripheral type (type: 36) supporting SSD1306/SH1106 OLED display.
Hardware Wiring
| Board Label | GPIO Pin | Connected Device |
|---|---|---|
| SDA | GPIO21 | OLED SDA (data line) |
| SCL | GPIO22 | OLED SCL (clock line) |
I2C standard wiring, SSD1306 default address 0x3C.
JSON Configuration Example
{
"peripherals": [
{
"id": "oled_display",
"name": "OLED Display",
"type": 36,
"enabled": false,
"pins": [21, 22],
"params": {
"width": 128,
"height": 64,
"interface": 2
}
}
]
}Parameter Description
| Parameter | Description | Options |
|---|---|---|
| width | Screen width (pixels) | 128 |
| height | Screen height (pixels) | 32, 64 |
| interface | Interface type | 2=I2C |
Peripheral Execution Linkage
Scenario 1: Display Text Information (Platform Trigger)
Function: Display text on OLED via cloud platform command
Web Interface Configuration Steps
Step 1: Create Rule
- Click left menu Peripheral Configuration → Switch to Peripheral Execution Management tab
- Click New Rule button
- Fill in basic configuration:
- Rule Name:
OLED Display Info - Report Data: ✅ Enable
- Enabled: ✅ Enable
- Rule Name:
Step 2: Configure Trigger
Click Add Trigger button
Fill in trigger configuration:
Field Value Description Trigger Type Select Platform Trigger Receive cloud platform commands Operator Select Set Mode Received data as action parameters
Step 3: Configure Action
Click Add Action button
Fill in:
- Action Type: Select Display Text
- Target Peripheral: Select
oled_display - Line 1:
FastBee IoT - Line 2:
Temp: 25.3°C
Click Save button
Scenario 2: Periodic Sensor Data Display (Timer Trigger)
Function: Display temperature/humidity and IP address on OLED every 3 seconds
Web Interface Configuration Steps
- Create rule, name:
OLED Display Temp/Humidity - Trigger configuration:
- Trigger Type: Select Timer Trigger
- Timer Mode: Select Fixed Interval
- Interval Time:
3000(3 seconds)
- Action configuration:
- Action Type: Select Display Text
- Target Peripheral: Select
oled_display - Line 1:
T: ${dht_01.temperature}C - Line 2:
H: ${dht_01.humidity}% - Line 3:
IP: ${system.ip}
- Click Save
OLED Display Reference
| Parameter | Value | Description |
|---|---|---|
| Screen Size | 0.96 inch | Common size |
| Resolution | 128x64 | Pixels |
| Display Lines | ~4 lines | 16px font |
| Interface Type | I2C | Address 0x3C |
| Refresh Recommend | 1-3 seconds | Avoid frequent refresh |
Notes
- I2C Address: SSD1306 default 0x3C, some modules may be 0x3D
- Pin Order: pins[0]=SDA, pins[1]=SCL
- Display Lines: 128x64 screen can display ~4 lines of text (16px font)
- Chinese Support: Current version does not support Chinese display, ASCII characters only
- Refresh Rate: Recommend 1-3 second refresh, frequent refresh affects performance
- Burn-in: OLED displaying fixed content for long periods will cause burn-in, recommend periodic off or content changes
