BMP280 Pressure Sensor
BMP280 Pressure Sensor
Overview
BMP280 is a high-precision pressure/temperature sensor that communicates via I2C bus, capable of measuring atmospheric pressure, ambient temperature, and estimating altitude. Suitable for weather stations, drone altimeters, indoor navigation, and other scenarios.
Firmware Requirement: Standard / Full firmware enables
FASTBEE_ENABLE_I2C_SENSORSby default; Lite has it disabled by default.
Supported Peripheral Types
| Type | type Value | Description |
|---|---|---|
| SENSOR | 38 | I2C sensor (BMP280) |
Hardware Wiring
| BMP280 Pin | ESP32 GPIO | Description |
|---|---|---|
| VCC | 3.3V | Power supply |
| GND | GND | Ground |
| SDA | GPIO 21 | I2C data line |
| SCL | GPIO 22 | I2C clock line |
Most BMP280 modules have built-in pull-up resistors; no external pull-up needed.
Configuration
Method 1: Web Interface Configuration (Recommended)
Before saving BMP280 configuration, verify I2C bus, device address, and supply voltage.
Step 1: Navigate to Peripheral Management Page
- Open a browser and navigate to the ESP32 IP address
- After logging in, click Peripheral Configuration in the left menu
Step 2: Add BMP280 Peripheral
Click the Add Peripheral button
Fill in the configuration:
Field Value Description Peripheral ID bmp280_1Unique identifier Name BMP280 Pressure SensorDisplay name Peripheral Type Generic Sensor (type: 38) I2C sensor SDA Pin 21I2C data pin SCL Pin 22I2C clock pin Driver Name BMP280Fixed value I2C Address 0x760x76 or 0x77 Sampling Interval 50005 seconds (≥2000ms) Click Save
Step 3: Verify Configuration
- Find the newly added peripheral in the peripheral list
- Click the Enable toggle
- Wait 5 seconds and check pressure, temperature, and altitude data
⚠️ Important: Requires
FASTBEE_ENABLE_I2C_SENSORS=1; Lite firmware does not include this driver by default.
Method 2: JSON Configuration File Import
Add the following configuration to the peripherals array in data/config/peripherals.json:
{
"id": "bmp280_1",
"name": "BMP280 Pressure Sensor",
"type": 38,
"enabled": false,
"pins": [21, 22],
"params": {
"driver": "BMP280",
"i2cAddress": "0x76",
"interval": 5000
}
}Parameter Description
| Parameter | Description |
|---|---|
| driver | Driver name, fixed to "BMP280" |
| i2cAddress | I2C address, usually 0x76 (SDO to GND) or 0x77 (SDO to VCC) |
| interval | Sampling interval (ms), recommend ≥ 2000 |
pins[0] = SDA pin, pins[1] = SCL pin
Data Report Format
Sensor data is reported via MQTT, containing multiple measurements:
[
{"id": "bmp280_1", "value": "temperature:25.3,pressure:101325,altitude:10.5"}
]| Field | Description | Unit |
|---|---|---|
| temperature | Ambient temperature | °C |
| pressure | Atmospheric pressure | Pa |
| altitude | Estimated altitude | m |
Driver Registration Mechanism
BMP280 uses the ISensorDriver + DriverRegistry mechanism for registration:
- Enabled at compile time via
FASTBEE_ENABLE_I2C_SENSORSmacro - Driver automatically registers to the global registry
- The
driverfield in configuration is used to match the specific driver implementation
Peripheral Execution Integration
Web Interface Configuration Steps
Create Pressure Display Rule
- Switch to the Peripheral Execution Management tab
- Click the Add Rule button
- Configure timer trigger:
- Trigger Type: Timer Trigger
- Execution Interval: 10 seconds
- Add actions:
- Action 1: Read sensor data
- Action Type: Sensor Read
- Target Peripheral: bmp280_1
- Action 2: Display on OLED
- Action Type: OLED Display
- Target Peripheral: oled1
- Action Value:
#Weather Station P:${bmp280_1.pressure}Pa Alt:${bmp280_1.altitude}m
- Action 1: Read sensor data
- Click Save
💡 Tip: Use
${peripheralID.fieldName}to reference sensor data
JSON Configuration Example
Temperature Threshold Alarm
{
"name": "High Temperature Alarm",
"enabled": true,
"triggers": [
{
"type": "poll",
"params": {
"periphId": "bmp280_1",
"field": "temperature",
"operator": ">",
"threshold": 35
}
}
],
"actions": [
{
"type": "gpio_write",
"params": {
"periphId": "buzzer1",
"value": "1"
}
}
]
}Pressure Display on OLED
{
"name": "Display Pressure",
"enabled": true,
"triggers": [
{
"type": "timer",
"params": { "interval": 5000 }
}
],
"actions": [
{
"type": "sensor_read",
"params": { "periphId": "bmp280_1" }
},
{
"type": "display_write",
"params": {
"periphId": "oled1",
"template": "P:{bmp280_1.pressure}Pa\nAlt:{bmp280_1.altitude}m"
}
}
]
}Notes
- Firmware Version: Standard / Full firmware includes BMP280 driver; Lite does not support it by default
- I2C Address Conflict: Cannot have two devices with the same address on the same I2C bus; multiple BMP280s need different SDO levels
- Altitude Accuracy: Altitude is an estimate based on standard atmospheric pressure (101325 Pa); actual use requires calibrating reference pressure
- Sampling Frequency: BMP280 internal conversion takes time; interval recommend ≥ 2000ms
- Wiring Length: I2C cable should not be too long (recommend < 50cm); reduce clock frequency or add repeater for longer runs
