Skip to content

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 LabelGPIO PinConnected Device
SDAGPIO21OLED SDA (data line)
SCLGPIO22OLED SCL (clock line)

I2C standard wiring, SSD1306 default address 0x3C.

JSON Configuration Example ​

json
{
  "peripherals": [
    {
      "id": "oled_display",
      "name": "OLED Display",
      "type": 36,
      "enabled": false,
      "pins": [21, 22],
      "params": {
        "width": 128,
        "height": 64,
        "interface": 2
      }
    }
  ]
}

Parameter Description ​

ParameterDescriptionOptions
widthScreen width (pixels)128
heightScreen height (pixels)32, 64
interfaceInterface type2=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

  1. Click Peripheral Execution in the left menu
  2. Click New Rule button
  3. Fill in basic configuration:
    • Rule Name: OLED Display Info
    • Report Data: ✅ Enable
    • Enabled: ✅ Enable

Step 2: Configure Trigger

  1. Click Add Trigger button

  2. Fill in trigger configuration:

    FieldValueDescription
    Trigger TypeSelect Platform TriggerReceive cloud platform commands
    OperatorSelect Set ModeReceived data as action parameters

Step 3: Configure Action

  1. Click Add Action button

  2. Fill in:

    • Action Type: Select Display Text
    • Target Peripheral: Select oled_display
    • Line 1: FastBee IoT
    • Line 2: Temp: 25.3°C
  3. 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 ​

  1. Create rule, name: OLED Display Temp/Humidity
  2. Trigger configuration:
    • Trigger Type: Select Timer Trigger
    • Timer Mode: Select Fixed Interval
    • Interval Time: 3000 (3 seconds)
  3. 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}
  4. Click Save

OLED Display Reference ​

ParameterValueDescription
Screen Size0.96 inchCommon size
Resolution128x64Pixels
Display Lines~4 lines16px font
Interface TypeI2CAddress 0x3C
Refresh Recommend1-3 secondsAvoid frequent refresh

Notes ​

  1. I2C Address: SSD1306 default 0x3C, some modules may be 0x3D
  2. Pin Order: pins[0]=SDA, pins[1]=SCL
  3. Display Lines: 128x64 screen can display ~4 lines of text (16px font)
  4. Chinese Support: Current version does not support Chinese display, ASCII characters only
  5. Refresh Rate: Recommend 1-3 second refresh, frequent refresh affects performance
  6. Burn-in: OLED displaying fixed content for long periods will cause burn-in, recommend periodic off or content changes

FastBee | fastbee.cn