Building your own Arduino-based weather station is a fun and educational project that doesn't require expensive or hard-to-find components. With just a few common household items, you can create a fully-functional station that measures temperature, humidity, barometric pressure, and wind speed/direction. In this comprehensive guide, I'll walk you through every step of the process.
What You Will Need
To build the weather station, you will need:
-
Arduino Uno board - The brains of the operation that collects and processes sensor data.
-
DHT11 or DHT22 temperature and humidity sensor - Measures air temperature and humidity.
-
BMP180 barometric pressure sensor - Measures atmospheric pressure.
-
Anemometer - Measures wind speed. Can be purchased or DIY'd.
-
Wind vane - Measures wind direction. Can be purchased or DIY'd.
-
A servo motor - To rotate the DIY wind vane.
-
Jumper wires - To connect the components.
-
Breadboard - To easily prototype circuits.
-
A rotating platform - Like a cake turntable, to mount the wind vane on.
-
Various craft supplies - For building the DIY anemometer and vane. Such as straws, paper cups, cardboard, popsicle sticks, etc.
That's it! These are all very common components that you may already have on hand or can easily purchase online. Now let's start building.
Connecting the Temperature and Humidity Sensor
The DHT sensor measures air temperature and humidity. It provides fairly accurate readings and is easy to connect to an Arduino.
To hook it up:
-
Connect the single data pin on the DHT22 to Arduino pin D2.
-
Connect the sensor's + (VCC) pin to Arduino 5V.
-
The sensor's - (GND) pin connects to Arduino GND.
In your Arduino sketch, include the DHT library and instantiate the sensor:
```c
include "DHT.h"
define DHTPIN 2
define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
```
Call dht.readTemperature()
and dht.readHumidity()
in loop()
to get the values.
That's it for the temperature and humidity part! Pretty simple.
Interfacing the Barometric Pressure Sensor
The BMP180 sensor allows us to measure atmospheric pressure, which can be used to forecast impending weather changes.
Hooking it up just takes 4 jumper wires:
- BMP180 VCC to Arduino 3.3V
- BMP180 GND to Arduino GND
- BMP180 SCL to Arduino SCL (A5 on Uno)
- BMP180 SDA to Arduino SDA (A4 on Uno)
In your code, include the Adafruit BMP085 library and create an instance:
```c
include
Adafruit_BMP085 bmp;
```
Call bmp.readPressure()
and bmp.readTemperature()
to get values.
The barometric pressure sensor is also good to go!
Creating the Anemometer
The anemometer measures wind speed. You can buy one, but let's make a simple DIY version using household materials.
For this, you'll need:
- 3 plastic cups
- 2 straws
- 1 push pin
- Tape
To assemble:
-
Use a push pin to poke holes in the sides of the cups, near the top.
-
Thread the straws through the holes in the cups.
-
Space the cups evenly and tape the ends of the straws so they are fixed in place.
-
Attach one end of the straw assembly to a pivot point like a pencil eraser.
When wind blows across the cups, they will spin. By counting the rotations per minute, you can calculate wind speed.
Use a reed switch to detect when a magnet on the rotor passes by. Connect it to Arduino pin D3. Count the number of times it is triggered per minute to get RPM.
Building the Wind Vane
The wind vane detects wind direction. Here's how to build one from household items:
You'll need:
- Paper or plastic plate
- Thin wood board
- Drill
- Straw or skewer
- Push pin
Construction:
-
Cut a triangle shape out of the plate. This is your vane.
-
Drill a hole in the center of the wooden board. Push the straw through it, and attach the plate to the top.
-
Push pin a small weight, like a paperclip, to the bottom end of the straw. This functions as the counterweight to keep it oriented into the wind.
-
Insert the bottom end of the straw into the rotating platform or cake turntable.
Now you have a working wind vane!
Interfacing the Wind Vane
To detect the orientation of the wind vane, you can use a servo and a small magnet:
-
Glue a small magnet onto the wind vane assembly.
-
Attach a servo with its arm and axis parallel to the vane.
-
On the servo arm, attach a reed switch positioned so that the magnet passes over it each rotation.
-
Connect the servo to Arduino pins D5 (signal) and 5V and GND.
As the wind shifts direction, your code will activate the servo to rotate until the reed switch senses the magnet again. This gives you wind direction!
Reading the Sensor Data
With all the sensors interfaced, read each one in loop() and print the values to the Serial monitor:
```c
void loop() {
float humidity = dht.readHumidity();
float tempC = dht.readTemperature();
float pressure = bmp.readPressure();
float windSpeed = calcSpeedFromRPM(windMillRPM); //based on anemometer RPM
int windDegrees = getWindDirection(); //based on vane servo position
Serial.print("Humidity: ");
Serial.println(humidity);
//Print other values
delay(1000);
}
```
You now have a fully functional Arduino weather station!
Displaying Readings on an LCD
For easier visibility, connect a 16x2 LCD display to your Arduino and have it print the sensor readings. Just wire it up using the liquid crystal library and print the values to the display in your loop.
Assembling the Enclosure
To complete your weather station, mount everything in an enclosure:
-
Use a plastic food storage container or Tupperware. Cut holes for sensors and wires.
-
Place electronics in the base, and sensors/anemometer on top.
-
For the wind vane, run the DC motor power through the side to the rotating platform.
-
Secure the box somewhere outside with good airflow.
Now you can get accurate real-time weather data right from your own backyard! This Arduino weather station makes for a fun and satisfying DIY project that teaches you a ton about interfacing various sensors.