Illustration: Raspberry Pi weather station with BME280 and SQLite history

AI-generated illustration

Updated 24 October 2026 By Emmanuel SAUVAGE

Raspberry Pi weather station with BME280 and SQLite history

Indoor or sheltered outdoor temp, humidity and pressure on Pi 4/5: I2C wiring, Python logger, daily min/max and CSV export.

Also available in French.

The BME280 reports temperature, humidity and barometric pressure. With a Raspberry Pi you log every five minutes to SQLite, print daily summaries and export CSV—falling pressure often hints at worsening weather locally.

Goal

  • Sample every 5 min → ~/meteo.db.
  • --resume for 7-day min/max/mean.
  • --csv for spreadsheets.

Parts

Pi 4/5, Bookworm. BME280 I2C module (not BMP280—no humidity): UK · US.

BME280Pi
VCC3V3 (pin 1)
GNDGND (pin 6)
SDApin 3
SCLpin 5

i2cdetect -y 1 → 0x76 or 0x77.

pip install adafruit-circuitpython-bme280

Script: meteo_bme280_sqlite.py.

ALTITUDE_M=150 python meteo_bme280_sqlite.py
python meteo_bme280_sqlite.py --resume
python meteo_bme280_sqlite.py --csv > meteo.csv

ALTITUDE_M converts station pressure to sea-level equivalent for comparison with forecasts.

systemd

station-meteo.service with Environment=ALTITUDE_M= and BME280_ADDR= if needed.

3-hour pressure trend

sqlite3 ~/meteo.db "SELECT ROUND((SELECT pression FROM mesures ORDER BY ts DESC LIMIT 1) - (SELECT pression FROM mesures WHERE ts <= strftime('%Y-%m-%dT%H:%M:%S', 'now', '-3 hours') ORDER BY ts DESC LIMIT 1), 1);"

Negative → falling pressure locally; interpret as a hint, not a forecast.

Troubleshooting

  • Chip ID 0x58 → BMP280, wrong part.
  • High temp → move sensor ≥10 cm from Pi.
  • Outdoor: use a ventilated radiation shield, not sun on the chip.

ESP alternative: ESPHome BME280. CO₂ sibling project: SCD41 MQTT.

All smart-home guides

Have a question about this guide or need advice? Ask us here

Torn between two models or stuck on a build? Drop us a line and we will get back to you by email.