Serial at 115200 baudTap a part to see what it does.
Tap the parts to see what each one does. A teaching simulation, not a circuit simulator.
Build it step by step
0 of 4 doneWire the BME280
SDA 21, SCL 22, 3V3, GND.
Wire the SD module
CS 5, SCK 18, MOSI 23, MISO 19.
Prepare the card
Format FAT32 and insert.
Run and collect
Leave it for a day, then open log.csv on a computer.
How do you build an offline sensor recorder?
An ESP32 logs temperature, humidity and pressure from a BME280 to a microSD card every minute, with no Wi-Fi needed, ready to open in a spreadsheet. You need ESP32 DevKit V1, BME280 Environmental Sensor, MicroSD Card Module and Breadboard 830 Tie Points. It takes 4 steps and about 50 minutes.
- Level
- Intermediate
- Time
- About 50 min
- Parts
- 4
Parts list
- Development BoardsBuyESP32 DevKit V1 × 1
- SensorsBuy
- InterfacesBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| BME280 SDA / SCL | GPIO21 / GPIO22 | I2C |
| BME280 VIN / GND | 3V3 / GND | Power |
| SD CS / SCK / MOSI / MISO | GPIO5 / 18 / 23 / 19 | SPI |
| SD VCC / GND | 5V (VIN) / GND | Power |
Code
Libraries: Adafruit BME280 and the built-in SD. The first column counts minutes since power-on; add a DS3231 clock module if you need real dates.
Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Adafruit_BME280.h>
#include <SD.h>
Adafruit_BME280 bme;
const int CS = 5;
unsigned long n = 0;
void setup() {
Serial.begin(115200);
if (!bme.begin(0x76)) Serial.println("BME280 not found");
if (!SD.begin(CS)) { Serial.println("SD card not found"); return; }
if (!SD.exists("/log.csv")) { File f = SD.open("/log.csv", FILE_WRITE); f.println("minutes,temp_c,humidity,pressure_hpa"); f.close(); }
}
void loop() {
File f = SD.open("/log.csv", FILE_APPEND);
if (f) {
f.printf("%lu,%.2f,%.1f,%.1f\n", n, bme.readTemperature(), bme.readHumidity(), bme.readPressure() / 100.0);
f.close(); // closing flushes to the card, so a power cut loses at most one line
Serial.println("logged");
} else Serial.println("write failed");
n++;
delay(60000);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual ESP32 Dev Module with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
logged
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| After 5 minutes | log.csv has a header and 5 lines |
| Pull power mid-run | File still opens; at most the last line is missing |
| Breathe on the sensor | Humidity jumps in the next line |
If it does not work
"SD card not found"
Card not FAT32, wrong CS, or a 3.3 V-only module on 5 V.
Temperature a few degrees high
Sensor too close to the ESP32: move it away on wires.
Lines missing
Long delays while writing are normal; check the card is not full.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the offline sensor recorder?
ESP32 DevKit V1, BME280 Environmental Sensor, MicroSD Card Module and Breadboard 830 Tie Points.
How long does the offline sensor recorder take to build?
About 50 minutes for a intermediate maker, in 4 steps.
How do I know the offline sensor recorder works?
After 5 minutes: log.csv has a header and 5 lines. Pull power mid-run: File still opens; at most the last line is missing. Breathe on the sensor: Humidity jumps in the next line.
SD card not found: what should I check?
Card not FAT32, wrong CS, or a 3.3 V-only module on 5 V.
Temperature a few degrees high: what should I check?
Sensor too close to the ESP32: move it away on wires.
Lines missing: what should I check?
Long delays while writing are normal; check the card is not full.
