Arduino Weather Station

Build an Arduino Weather Station with DHT11
Smartphone weather widgets pull data from stations miles away. They don't tell you the humidity in your basement, the temperature in your greenhouse, or the microclimate of your backyard.
The Arduino Weather Station fixes that. It uses an Arduino microcontroller and a DHT11 sensor to measure local temperature and relative humidity. This guide covers the hardware, wiring, code, and common use cases.
What is the Arduino Weather Station?
The Arduino Weather Station is a microcontroller system that measures and displays temperature and relative humidity.
Commercial weather stations cost hundreds of dollars and lock your data in proprietary software. The Arduino version is open, cheap, and modular. The Arduino Uno (or Nano, or Mega) acts as the brain, and the DHT11 handles sensing.
DHT11 Sensor Overview
The DHT11 is a low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor, then outputs a digital signal on the data pin. No analog input pins required.
System Specifications:
- Microcontroller: ATmega328P (via Arduino Uno)
- Humidity Range: 20 to 90% RH
- Temperature Range: 0 to 50°C
- Sampling Rate: 1 Hz (one reading per second)
Key Features
1. Low Cost
Commercial environmental loggers can run $200 or more. The Arduino version uses a few dollars in parts. The components are widely available.
2. Real-Time Local Data
Weather apps show regional averages. This gives you immediate, location-specific readings. Useful for checking if your filament is too damp, or if your terrarium is overheating.
3. Expandable Design
Once the basic setup works, you can add:
- Displays: LCD (16x2) or OLED screen for standalone readout.
- Wireless: Swap to an ESP8266 or add a Wi-Fi shield to push data to the cloud.
- Data Logging: SD card module to record months of readings.
4. Low Power
With sleep modes in code, the DHT11 and Arduino can run on batteries for extended periods.
Build Guide
Phase 1: Hardware
- Arduino Uno R3
- DHT11 Sensor (standalone 4-pin or 3-pin PCB module)
- Breadboard
- Jumper Wires (Male-to-Male)
- 10k Ohm Resistor (for standalone 4-pin sensor; built-in on PCB modules)
- USB Cable
Phase 2: Wiring
Bad wiring causes short circuits or "NaN" errors. Follow these steps:
- Place the Sensor: Insert the DHT11 into the breadboard.
- Power: Connect VCC (Pin 1) to the Arduino 5V pin. Connect GND (Pin 4) to Arduino GND.
- Data: Connect the Data pin (Pin 2) of the DHT11 to Digital Pin 2 on the Arduino.
- Pull-Up Resistor: Connect the 10k resistor between VCC (Pin 1) and Data (Pin 2). If you have the PCB module, skip this step, the resistor is already on the board.
Phase 3: Software
The Adafruit DHT Library handles the single-wire protocol timing.
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries.
- Search for "DHT sensor library" by Adafruit and install it.
- Search for "Adafruit Unified Sensor" and install it (dependency).
Code Logic: In your sketch, initialize the sensor on Pin 2. The void loop() should:
- Wait 2 seconds (sensor sampling limit).
- Read humidity (
dht.readHumidity()). - Read temperature (
dht.readTemperature()). - Check if reads failed.
- Print results to Serial Monitor.
Phase 4: Testing
Open the Serial Monitor (baud rate 9600). You should see:
Humidity: 45.00% | Temperature: 24.50°C
Usage Note: Keep the sensor away from heat sources and direct sunlight. The DHT11's black casing absorbs heat and can skew readings by up to 5°C.
Common Use Cases
1. Home Automation
Connect a relay to trigger a humidifier when humidity drops below 30%, or a fan when temperature exceeds 26°C. This gives you smart home control without cloud dependencies.
2. Greenhouses
Temperature and humidity swings can damage plants. The station monitors microclimate conditions continuously. You can add a soil moisture sensor for full botanical monitoring.
3. Server Rooms
Heat kills hardware. A station in a server rack can monitor ambient temps and trigger a buzzer or LED if the AC fails.
4. Storage
Cigars, cheese, wooden instruments, any humidity-sensitive goods benefit from continuous monitoring.
Optimization Tips
- Upgrade to DHT22: If you need decimal-point precision, swap the DHT11 for a DHT22. Code is nearly identical; accuracy range improves.
- Data Smoothing: Electrical noise can cause spikes. Implement a moving average (e.g. average 10 readings) before display.
- Enclosure: For outdoor use, build a Stevenson Screen, a slatted enclosure that blocks rain and sun while allowing airflow.
FAQ
Q: Is the Arduino Weather Station waterproof? A: No. The DHT11 and Arduino board need a weatherproof enclosure. For outdoor temperature, use a waterproof probe like the DS18B20. Humidity sensing always requires air exposure.
Q: Can it run on battery? A: Yes. A 9V battery on the Vin pin works but lasts 1 to 2 days. For longer life, use Li-Po batteries and put the Arduino into "Deep Sleep" mode between readings.
Q: Why does my sensor return "Failed to read from DHT sensor"? A: Usually a wiring issue. Check the 10k resistor between VCC and Data. Verify the digital pin in your code matches the wiring.
Q: How accurate is the DHT11? A: ±2°C for temperature and ±5% for humidity. Fine for home use and education. For scientific research, upgrade the sensor.
Q: Can I log data to Excel? A: Yes. Use PLX-DAQ on Windows, or write a Python script to read the Serial output and save to CSV.
Summary
The Arduino Weather Station combines affordable hardware with practical environmental monitoring. The Arduino ecosystem and DHT sensor offer a low barrier to entry with room to grow.
Gather your components, open the Arduino IDE, and start measuring your local climate.
