an engineering journalShivam Hegadi
workingElectronicsProgramming

ESP32 Weather Station

A small outdoor sensor node that reads temperature, humidity, and pressure, and posts readings over Wi-Fi to a simple dashboard on my local network.

started Dec 5, 2025updated Jan 15, 2026
ESP32 Weather Station

Links

Components

  • ESP32-WROOM-32 dev board
  • BME280 temperature, humidity, pressure sensor
  • 18650 battery with TP4056 charge module
  • Small solar panel (5V, 1W)

Files

What I was trying to make

I wanted actual local weather data instead of relying on a forecast app, mostly to compare against, and I wanted a reason to learn MQTT since I'd been putting it off for a while.

Design process

There's not much mechanical design here beyond the enclosure. I modeled a simple two-part box with a vented lower section for the BME280 (temperature and humidity sensors need airflow, sealing them up defeats the point) and a sealed upper section for the ESP32 and battery electronics.

Electronics and components

BME280 talks to the ESP32 over I2C. Power comes from an 18650 charged by a small solar panel through a TP4056 module, which is really only sized for slowly topping off the battery through the day rather than fully powering the device in real time, so the ESP32 still mostly runs off battery.

Firmware reads the sensor every five minutes, connects to Wi-Fi, publishes the reading over MQTT to a broker running on a Raspberry Pi in my house, then goes back to deep sleep to save power. Deep sleep was the single biggest change to battery life, active Wi-Fi draw was draining the battery in about two days before I added it.

Build process

Assembly was simple, most of the time went into the enclosure. First print had the vent slots too large and let rain in during testing, which I only found out because I checked on it during a storm and found water sitting at the bottom of the lower section.

Problems and failed attempts

The rain intrusion issue meant redesigning the vents as angled louvers instead of straight slots, so air can still get through but water dripping down the outside doesn't have a direct path in. That fixed it through a few storms since.

Early firmware also didn't handle the case where Wi-Fi failed to connect within a reasonable time, so the ESP32 would sit there trying to connect and drain the battery much faster than expected. Added a timeout that gives up after 15 seconds and goes back to sleep if it can't connect, then just retries next cycle.

What changed between versions

  • v1 enclosure: straight vent slots, let rain in during a storm
  • v2 enclosure (current): angled louvered vents, no more water intrusion
  • v1 firmware: no Wi-Fi connect timeout, drained battery fast on connection failures
  • v2 firmware (current): 15 second connect timeout before giving up and sleeping

Final result

It's been running outside for about a month on the same charge cycle with the solar panel keeping it topped up, and readings match closely enough with a nearby weather station that I trust the sensor. Battery life without sun would probably be around two to three weeks based on the sleep current draw, though I haven't tested that directly since the solar panel has kept it charged the whole time.

ESP32BME280MQTTweatherproofing