Posted on

Build a Weather Station with DHT22, BMP280, and OLED

A weather station is the project that uses everything: two sensors, a display, and a microcontroller that ties them together. Build it once on a breadboard, then put it in a box by the window and leave it running.

Parts list

NodeMCU ESP8266 development board with built-in OLED — controller and display in one, plus WiFi. DHT22 / AM2302 temperature and humidity sensor module — temperature and humidity. BMP280 barometric pressure and temperature sensor module — pressure and a second temperature reading. Or use the UNO R3 board with the separate 0.96 inch OLED display if you prefer the Arduino route.

What the sensors measure

The DHT22 measures relative humidity from 0 to 100% RH (plus or minus 2% accuracy) and temperature from -40 to 80 degrees C (plus or minus 0.5 degrees C), with a single-bus digital output that talks to any microcontroller over one data pin. It works on 3.3 to 5.5V and is factory calibrated. The module measures 28 x 12 x 10mm with a 4-pin interface: positive, ground, and Out (data to the microcontroller IO pin).

The BMP280 measures pressure from 300 to 1100 hPa with plus or minus 1 hPa absolute accuracy — good enough to use as an altimeter with about 1 meter accuracy — and temperature from -40 to +85 degrees C with plus or minus 1.0 degree accuracy. It talks over I2C (up to 3.4 MHz) or SPI (up to 10 MHz), runs on 1.8 to 5V, and draws just 2.7 microamps at a 1 Hz sampling rate. Note: the BMP280 is a pressure and temperature sensor only — it does not measure humidity. That is the BME280, a different sensor, sold separately.

Wiring and code approach

The DHT22 needs one data pin. The BMP280 shares the I2C bus with the OLED — same two wires, different addresses. Read both sensors once every few seconds, not continuously: the DHT22 is slow by design and the BMP280 barely sips power at 1 Hz, so there is nothing to gain by hammering them. Show temperature, humidity, and pressure on the OLED, and add a trend arrow for pressure — rising pressure usually means improving weather. On the NodeMCU, the same readings can go to a simple web page over WiFi.

Tips

Keep the sensors out of direct sun and away from the board’s own heat, or the temperature reads high. A small vented enclosure works. If the pressure reading looks wrong, check that you are reading hPa and not Pa. Add the TM1637 4-digit display as a second readout if you want the temperature visible across the room.

All parts in this guide ship from NY, USA. See the full list of guides on the Drone Guides page.

Related guides: NodeMCU ESP8266 with Built-In OLED: WiFi Projects with a Display · Which Display Should You Buy? OLED, TFT, and 7-Segment