Tutorials
ESP32 + BME280 Dashboard

ESP32 + BME280: Live Dashboard in 10 Minutes

Build a real-time environmental monitoring dashboard. Wire a BME280 sensor to an ESP32, upload a sketch, and see temperature, humidity, and pressure update live in your browser.

What You'll Build

A live-updating dashboard showing:

  • Temperature (°C)
  • Humidity (%)
  • Barometric pressure (hPa)

All data is stored in Plexus for historical analysis, alerting, and sharing.

What You Need

ItemNotes
ESP32 dev boardAny ESP32 with USB (DevKit V1, ESP32-S3, etc.)
BME280 sensorI2C breakout (Adafruit, SparkFun, generic)
4 jumper wiresSDA, SCL, 3.3V, GND
Arduino IDE2.x recommended
Plexus accountFree at app.plexus.company (opens in a new tab)

Step 1: Wire the BME280

Connect the BME280 to your ESP32 using I2C:

BME280 PinESP32 Pin
SDAGPIO 21
SCLGPIO 22
VIN3.3V
GNDGND

Most BME280 breakout boards include pull-up resistors, so no additional components are needed.

Step 2: Install Arduino Libraries

Open Arduino IDE and install two libraries via Sketch → Include Library → Manage Libraries:

  1. Search "Plexus SDK" → Install
  2. Search "Adafruit BME280" → Install (this also installs Adafruit Unified Sensor)

Make sure your board is set to ESP32 Dev Module (or your specific board) under Tools → Board.

Step 3: Get Your API Key

  1. Go to app.plexus.company (opens in a new tab)
  2. Click Add Device
  3. Copy the API key (starts with plx_)

Step 4: Upload the Sketch

Open File → Examples → Plexus SDK → BME280_Dashboard or paste this sketch:

#include <WiFi.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include "plexus.hpp"
 
const char* WIFI_SSID      = "YourWiFiSSID";      // ← Change this
const char* WIFI_PASSWORD  = "YourWiFiPassword";   // ← Change this
const char* PLEXUS_API_KEY = "plx_xxxxx";          // ← Paste your API key
const char* SOURCE_ID      = "esp32-bme280";
 
PlexusClient plexus(PLEXUS_API_KEY, SOURCE_ID);
Adafruit_BME280 bme;
 
bool bmeFound = false;
unsigned long lastReadMs = 0;
 
void setup() {
    Serial.begin(115200);
 
    // Initialize BME280
    Wire.begin();
    bmeFound = bme.begin(0x76) || bme.begin(0x77);
    Serial.println(bmeFound ? "BME280 found!" : "BME280 not found");
 
    // Connect to WiFi
    WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
    Serial.print("Connecting");
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    Serial.printf("\nConnected: %s\n", WiFi.localIP().toString().c_str());
}
 
void loop() {
    if (millis() - lastReadMs >= 2000) {
        lastReadMs = millis();
 
        float temp     = bme.readTemperature();
        float humidity = bme.readHumidity();
        float pressure = bme.readPressure() / 100.0F;
 
        plexus.send("temperature", temp);
        plexus.send("humidity", humidity);
        plexus.send("pressure", pressure);
 
        Serial.printf("T=%.1f°C  H=%.1f%%  P=%.1f hPa\n", temp, humidity, pressure);
    }
 
    plexus.tick();
    delay(100);
}
  1. Update WIFI_SSID, WIFI_PASSWORD, and PLEXUS_API_KEY
  2. Click Upload
  3. Open Serial Monitor at 115200 baud to verify readings

Step 5: See Your Dashboard

Open app.plexus.company (opens in a new tab). Your device esp32-bme280 appears on the Devices page. Click it to see live telemetry.

Add charts for temperature, humidity, and pressure to a dashboard. Data updates every 2 seconds.

How It Works

  1. The BME280 sensor reads temperature, humidity, and pressure over I2C
  2. plexus.send() queues each reading in a local buffer
  3. plexus.tick() checks if 5 seconds have elapsed and sends all buffered data in a single HTTP POST to the Plexus API
  4. Plexus stores the data in ClickHouse and broadcasts it to connected dashboards via WebSocket

The entire payload is a single JSON request — no MQTT broker, no special protocols. Just HTTP.

Troubleshooting

"BME280 not found" — Check your wiring. Try address 0x77 if 0x76 doesn't work (some boards use a different default). Run an I2C scanner sketch to verify the address.

No data in dashboard — Check Serial Monitor for errors. Verify your API key is correct and starts with plx_. Ensure WiFi is connected.

Intermittent data — WiFi signal may be weak. Move closer to your router or add WiFi reconnection logic (see the WiFiReconnect example).

Next Steps