Skip to content

Peripheral Configuration ​

This guide consolidates all peripheral configuration content, including peripheral types, pin assignments, parameter configuration, Web configuration steps, and linkage examples.

Before choosing a module, check: Sensors and Modules List.

Table of Contents ​


Peripheral Overview ​

FastBee supports 25+ peripheral types, configured visually through the Web interface without writing code.

The peripheral page abstracts real hardware into objects that can be referenced by rules. When adding a new peripheral, first select the type, then fill in pins and parameters. It is recommended to keep new peripherals disabled on first save and enable them after confirming wiring.

IDNameTypePinsStatusActions
adcADC Analog ConverterADC36DisabledEdit / Enable / Delete
canCAN BusCAN4, 5DisabledEdit / Enable / Delete
i2cI2C BusI2C17, 18DisabledEdit / Enable / Delete
jtagJTAG Debug InterfaceJTAG12, 13, 14, 15DisabledEdit / Enable / Delete
modbus_rtuModbus RTU-Industrial DeviceUART16, 17DisabledEdit / Enable / Delete
oled_ssd1306_c3OLED Display-SSD1306LCD5, 6DisabledEdit / Enable / Delete
gpio_pwmPWM OutputPWM Output21DisabledEdit / Enable / Delete
sdioSD Card SDIO InterfaceSDIO14, 15, 2, 4, 12, 13DisabledEdit / Enable / Delete
swdSWD Debug InterfaceSWD13, 14DisabledEdit / Enable / Delete
uartUART Serial PortUART16, 17DisabledEdit / Enable / Delete

Add Peripheral Dialog

When selecting, first determine the peripheral type by hardware signal form: digital signals go to GPIO, analog signals go to ADC, bus devices go to I2C/SPI/UART, RS485 slaves go to Modbus sub-devices, and display peripherals should first pass static text tests.

Peripheral Type Quick Reference ​

type valueType NameDescriptionDetailed Documentation
11GPIO_DIGITAL_INPUTDigital inputgpio-input.md
12GPIO_DIGITAL_OUTPUTDigital outputgpio-output.md
13GPIO_DIGITAL_INPUT_PULLUPPull-up input (buttons)gpio-input.md
15GPIO_ANALOG_INPUTADC analog inputadc-input.md
17GPIO_PWM_OUTPUTPWM outputpwm-output.md
36LCDDisplay (SSD1306/SH1106)oled-usage-guide.md
38SENSORSensor (DHT/DS18B20 etc.)See individual sensor docs
41PWM_SERVOServoservo.md
42STEPPER_MOTORStepper motorstepper-motor.md
43ENCODERRotary encoderencoder.md
44ONE_WIREOne-Wire (DS18B20)sensor-ds18b20.md
45NEO_PIXELWS2812B RGB LED stripneopixel.md
47SEVEN_SEGMENT_TM1637TM1637 seven-segment displaydisplay-tm1637.md
51MODBUS_DEVICEModbus slave devicemodbus-device.md
55IO_EXPANDERI2C IO expander (logical GPIO via shared I2C)PCF8574 IO Expander

SENSOR_GENERIC (type 38) selects a registered I2C driver via params.driver, or a local sensor via the numeric params.sensorType; sensorCategory belongs to the read action parameters. For INA226 voltage/current/power acquisition, see INA226; for NTC thermistor temperature measurement, see NTC Thermistor.


1. GPIO and PWM Peripherals ​

1.1 GPIO Output (type:12) ​

Applications: LEDs, relays, buzzers, laser sensors

Detailed Documentation: gpio-output.md

JSON Configuration:

json
{
  "id": "led_01",
  "name": "LED Indicator",
  "type": 12,
  "enabled": true,
  "pinCount": 1,
  "pins": [26, 255, 255, 255, 255, 255, 255, 255],
  "params": {
    "initialState": 0
  }
}

1.2 GPIO Input (type:11/13/14) ​

Applications: Buttons, PIR motion sensors, vibration sensors, reed switches

Detailed Documentation: gpio-input.md

1.3 ADC Input (type:15/26) ​

Applications: Light sensors, soil moisture, smoke, raindrop, voltage, current sensors

Detailed Documentation: adc-input.md

1.4 PWM Output (type:17) ​

Applications: LED dimming, motor speed control, servo control

Detailed Documentation: pwm-output.md


2. Motor Control Peripherals ​

2.1 Servo (type:41) ​

Applications: SG90, MG996R servo angle control

Detailed Documentation: servo.md

2.2 Stepper Motor (type:42) ​

Applications: 28BYJ-48 stepper motor precision positioning

Detailed Documentation: stepper-motor.md


3. Display Devices ​

3.1 OLED Display (type:36) ​

Applications: SSD1306, SH1106 OLED screens

Detailed Documentation: oled-usage-guide.md

Features:

  • I2C interface, address 0x3C or 0x3D
  • Supports text, numbers, graphics display
  • Can display sensor data and system status

3.2 TM1637 Seven-Segment Display (type:47) ​

Applications: 4-digit 7-segment display

Detailed Documentation: display-tm1637.md

Features:

  • CLK/DIO two-wire control
  • Supports number, temperature, humidity display
  • Can rotate display of multiple parameters

3.3 LCD1602 (type:36, placeholder) ​

Status: Driver to be extended

Detailed Documentation: display-lcd1602.md


4. Temperature and Humidity Sensors ​

4.1 DHT11/DHT22 (type:38) ​

Detailed Documentation: sensor-dht.md

Features:

  • One-Wire communication
  • DHT11: Temperature 0-50°C, Humidity 20-90%
  • DHT22: Temperature -40-80°C, Humidity 0-100%
  • Sampling interval ≥2 seconds

4.2 DS18B20 (type:38/44) ​

Detailed Documentation: sensor-ds18b20.md

Features:

  • OneWire bus
  • Temperature -55-125°C
  • Multiple sensors can be connected in parallel (distinguished by address)

4.3 AHT20 (type:38) ​

Detailed Documentation: sensor-aht20.md

Features:

  • I2C interface, address 0x38
  • Temperature -40-85°C, Humidity 0-100%
  • Lightweight I2C; requires the corresponding runtime feature

4.4 SHT31 (type:38) ​

Detailed Documentation: sensor-sht31.md

Features:

  • I2C interface, address 0x44 or 0x45
  • High-precision temperature and humidity
  • Lightweight I2C; requires the corresponding runtime feature

5. Environmental Sensors ​

5.1 Ultrasonic HC-SR04 (type:38) ​

Detailed Documentation: sensor-ultrasonic.md

Features:

  • Distance measurement 2-400cm
  • Requires two pins for trigger and echo
  • Sampling interval ≥100ms

5.2 BMP280 Barometric Pressure (type:38) ​

Detailed Documentation: sensor-bmp280.md

Features:

  • I2C interface
  • Temperature, barometric pressure, altitude
  • Requires active i2cSensors

5.3 MPU6050 Gyroscope (type:38) ​

Detailed Documentation: sensor-mpu6050.md

Features:

  • I2C interface, address 0x68
  • Six-axis posture (accelerometer + gyroscope)
  • Requires active i2cSensors

5.4 BH1750 Light Sensor (type:38) ​

Detailed Documentation: sensor-bh1750.md

Features:

  • I2C interface, address 0x23 or 0x5C
  • Light intensity 1-65535 lux
  • Lightweight I2C; requires the corresponding runtime feature

6. Electrical Sensors ​

6.1 Current Sensor ACS712 (type:15) ​

Detailed Documentation: sensor-current.md

Features:

  • ADC collection
  • Range 5A/20A/30A
  • Requires calibration parameters

6.2 Voltage Sensor (type:15) ​

Detailed Documentation: sensor-voltage.md

Features:

  • ADC + voltage divider circuit
  • Measurement range 0-25V
  • Requires divider ratio parameters

7. Communication Devices ​

7.1 Modbus Device (type:51) ​

Detailed Documentation: modbus-device.md

Features:

  • RS485 interface
  • Modbus RTU master
  • Supports multi-slave scanning

7.2 IR Remote Control (type:38) ​

Detailed Documentation: ir-remote.md

Features:

  • NEC/RC5 decoding
  • Requires active irRemote; esp32s3-F8R8 excludes the driver

7.3 RFID Reader MFRC522 (type:38) ​

Detailed Documentation: rfid-mfrc522.md

Features:

  • SPI interface
  • Read RFID card UID
  • Requires active rfid

8. Other Peripherals ​

8.1 NeoPixel WS2812B (type:45) ​

Detailed Documentation: neopixel.md

Features:

  • Single-wire control RGB LED strip
  • Supports multiple LEDs in series

8.2 Rotary Encoder (type:43) ​

Detailed Documentation: encoder.md

Features:

  • A/B phase counting
  • Supports rotation and button press

8.3 SD Card (type:37, placeholder) ​

Detailed Documentation: storage-sd-card.md

Status: SPI mode is partially implemented and file actions need extension; production use requires a validated custom build

8.4 Device Event (type:60) ​

Detailed Documentation: device-event.md

Features:

  • Logical event source
  • Used for rule linkage

Pin Assignment Principles ​

Safe Pins ​

  • ✅ GPIO34-39: Input-only, suitable for ADC/digital input
  • ✅ GPIO32-39: ADC1, available after WiFi is enabled (preferred)
  • ❌ GPIO6-11: Connected to Flash, not recommended
  • ❌ GPIO4,12-15,25-27: ADC2, unavailable after WiFi is enabled
  • ⚠️ GPIO0: BOOT button, use with caution
  • ⚠️ GPIO5: STATE indicator LED, occupied by default

I2C Devices ​

  • SDA: GPIO21/22 (recommended)
  • SCL: GPIO22/21 (recommended)
  • Multiple I2C devices can share SDA/SCL, but addresses must not conflict

Web Configuration Process ​

Step 1: Add Peripheral ​

  1. Navigate to Web interface → Peripheral Configuration
  2. Click Add Peripheral
  3. Select peripheral type
  4. Fill in peripheral ID and name
  5. Assign pins (refer to pin assignment principles)
  6. Fill in parameters (e.g., I2C address, initial state, etc.)

Step 2: Enable Peripheral ​

  1. Confirm pin wiring is correct
  2. Check Enable
  3. Click Save
  4. Check serial log to confirm successful initialization

Step 3: Create Execution Rules ​

  1. Navigate to Peripheral Execution
  2. Add rule and configure trigger
  3. Configure actions (e.g., GPIO control, sensor read, display, etc.)
  4. Save and enable rule

Step 4: Configuration Backup ​

  1. Navigate to Device Configuration > Advanced Configuration
  2. Export peripherals.json for backup
  3. Save as local file

After visual configuration, keep the exported peripherals.json with the board model and firmware version so it can be reused on identical hardware or restored after a field change.


FAQ ​

Q1: Peripheral not responding? ​

  • Check if the peripheral is enabled
  • Check if pin configuration is correct
  • Check if wiring is secure
  • Check serial log to confirm initialization status

Q2: I2C device initialization failed? ​

  • Check if SDA/SCL are reversed
  • Check if I2C address is correct
  • Check if pull-up resistors are present
  • Confirm power supply is 3.3V

Q3: ADC values abnormal? ​

  • Check if voltage exceeds 3.3V
  • Confirm using ADC1 pins (GPIO32-39)
  • Check ADC attenuation and calibration parameters

Q4: Sensor readings inaccurate? ​

  • Check if sampling interval is too short (DHT ≥2 seconds)
  • Check if sensor power supply is stable
  • Confirm sensor type configuration is correct


FastBee | fastbee.cn