Ramblings of an aging IT geek
← Ramblings of an aging IT geek
hardware

an esp32 weather station that mostly works

A weekend ESP32 build reporting temperature, humidity and pressure to MQTT, honest about the bits that still misbehave.

A soldering iron and electronics on a workbench

The weather station works, mostly, and "mostly" is doing a lot of heavy lifting in that sentence. It's an ESP32 with a BME280 hanging off I2C, reporting temperature, humidity and pressure to my MQTT broker every thirty seconds, where Home Assistant picks it up and draws me a graph I look at far too often.

The build itself was a genuinely pleasant afternoon. The BME280 is a lovely little sensor: three useful readings, sane I2C, and an Arduino library that just works. Wire up SDA and SCL, pull in Adafruit_BME280, and you've got numbers in about ten minutes. The ESP32 connects to WiFi, publishes JSON, and goes back to sleep. No drama.

The "mostly" is the temperature. The BME280 sits a couple of centimetres from the ESP32, and the ESP32, when its radio is busy, gets warm. So my "outdoor" temperature reads a degree or two high whenever it's just transmitted, which makes the graph look like the garden briefly catches fire every thirty seconds. The proper fix is to physically separate the sensor from the board, or to deep-sleep the ESP32 between readings so it cools down. For now I subtract a fudge factor in software, which is exactly the sort of thing I'd tell anyone else off for doing.

It's outside in a 3D-printed Stevenson screen, surviving the British spring, which is to say being rained on constantly. Next: actually deep-sleep it so it isn't cooking its own thermometer. But it works. Mostly.