Build a Portable Arduino Weather Station in a Weekend
Ever looked out the window and thought, “I could know exactly how hot it is, how fast the wind is blowing, and whether it will rain – without pulling out my phone?” A tiny weather station that fits in your backpack can give you that data, and you can have it up and running before Saturday night. Let’s dive in.
Why a Portable Weather Station?
Most hobbyists start with a breadboard and a few LEDs, but real‑world data is way more satisfying. A weather station lets you see the world in numbers, helps you plan a bike ride, and gives you a solid project to show off at the next maker meetup. Plus, building it in a weekend proves you can turn a pile of parts into something useful without pulling an all‑nighter.
Parts List – Keep It Simple
I like to keep my kits small so I can carry them on a train. Here’s everything you’ll need, all of which you can find on a typical electronics store or online marketplace.
- Arduino Nano – tiny, cheap, and has enough pins for our sensors.
- Breadboard (mini) – for quick wiring before we solder.
- Micro‑USB cable – to power the Nano and upload code.
- DHT22 sensor – measures temperature and humidity with good accuracy.
- BMP280 sensor – gives pressure and altitude; also works as a temperature sensor (we’ll use it for pressure only).
- Anemometer (mini) – a small cup‑type wind speed sensor; it outputs pulses.
- Rain gauge (tipping bucket) – optional, but fun if you live where it rains.
- Li‑Po 3.7 V 2000 mAh battery – powers the whole thing for a day.
- TP4056 charging module – lets you charge the battery via USB.
- Mini OLED display (0.96", 128×64) – shows the data at a glance.
- Push button – to toggle between screens.
- Solderless jumper wires – for the prototype.
- Heat shrink tubing & electrical tape – for a tidy finish.
- Small project box (around 10 cm × 6 cm × 3 cm) – to house everything.
If you already have a few of these lying around, great! The total cost stays under $30.
Tools You’ll Need
- Soldering iron with a fine tip
- Wire cutters/strippers
- Small Phillips screwdriver (for the box)
- A laptop with Arduino IDE installed
Wiring Overview
Before you start soldering, lay everything out on the mini breadboard. This helps you catch mistakes early.
- Power – Connect the 3.3 V pin of the Nano to the VCC of the BMP280 and the OLED. The DHT22 can run on 5 V, so hook it to the 5 V pin.
- Ground – Tie all GND pins together (Nano, sensors, display, button, battery module).
- Data lines –
- DHT22: Data pin to D2 (use a 10 kΩ pull‑up resistor to 5 V).
- BMP280: SDA to A4, SCL to A5 (I²C bus).
- OLED: Same SDA/SCL lines as BMP280.
- Anemometer: One lead to D3 (interrupt pin), the other to GND.
- Button: One side to D4, the other to GND with a 10 kΩ pull‑up to 5 V.
- Battery – Connect the TP4056’s OUT+ to the Nano’s VIN, OUT‑ to GND. The module’s micro‑USB port will be your charging point.
Once you’re happy with the layout, move the wires to the project box. Use heat shrink on any exposed solder joints and tape the battery securely so it doesn’t shift while you’re walking.
Code Walkthrough
Below is a compact sketch that reads all sensors, updates the OLED, and puts the Nano to sleep between readings to save power. Feel free to copy‑paste into the Arduino IDE.
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_BMP280.h>
#include "DHT.h"
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Adafruit_BMP280 bmp; // I2C
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
#define ANEMO_PIN 3
volatile unsigned long windCount = 0;
unsigned long lastWindCheck = 0;
float windSpeed = 0.0; // m/s
#define BTN_PIN 4
bool showTempHum = true;
void IRAM_ATTR windPulse() {
windCount++;
}
void setup() {
pinMode(ANEMO_PIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(ANEMO_PIN), windPulse, FALLING);
pinMode(BTN_PIN, INPUT_PULLUP);
Serial.begin(9600);
dht.begin();
if (!bmp.begin()) {
Serial.println(F("BMP280 init failed"));
while (1);
}
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("OLED init failed"));
while (1);
}
display.clearDisplay();
display.display();
}
void loop() {
// Button debounce
static unsigned long lastBtn = 0;
if (digitalRead(BTN_PIN) == LOW && millis() - lastBtn > 200) {
showTempHum = !showTempHum;
lastBtn = millis();
}
// Wind speed calculation (pulses per second)
if (millis() - lastWindCheck >= 1000) {
windSpeed = (float)windCount * 2.4; // factor depends on anemometer spec
windCount = 0;
lastWindCheck = millis();
}
// Read sensors
float h = dht.readHumidity();
float t = dht.readTemperature();
float p = bmp.readPressure() / 100.0; // hPa
// Update display
display.clearDisplay();
if (showTempHum) {
display.setTextSize(1);
display.setCursor(0,0);
display.print("Temp: "); display.print(t,1); display.println(" C");
display.print("Hum : "); display.print(h,1); display.println(" %");
} else {
display.setTextSize(1);
display.setCursor(0,0);
display.print("Press: "); display.print(p,0); display.println(" hPa");
display.print("Wind : "); display.print(windSpeed,1); display.println(" m/s");
}
display.display();
// Sleep for 5 seconds to save battery
delay(5000);
}
How the Code Works
- Libraries –
Adafruit_SSD1306drives the OLED,Adafruit_BMP280talks to the pressure sensor, andDHT.hhandles temperature/humidity. - Interrupt – The anemometer sends a pulse each time a cup passes the sensor. The ISR (
windPulse) just increments a counter; we calculate speed once per second. - Button – A simple pull‑up button toggles between a “Temp/Humidity” screen and a “Pressure/Wind” screen.
- Power saving – A
delay(5000)isn’t the most efficient, but it’s easy for a weekend build. You can replace it withLowPower.sleep()later.
Upload the sketch, open the Serial Monitor, and you should see numbers appear. If the OLED stays blank, double‑check the I²C address (0x3C is common for 0.96" displays) and wiring.
Assembling the Final Box
- Mount the OLED – Glue it to the inside of the lid so you can see the screen without opening the box.
- Secure the sensors – Drill tiny holes in the box’s side for the anemometer and rain gauge. Seal with silicone to keep water out.
- Battery placement – Tape the Li‑Po flat against the bottom; the TP4056 board can sit beside it.
- Cable routing – Run all wires through a small slit, then seal with heat shrink. Keep the USB port accessible for charging.
- Final test – Power on, watch the display, spin the anemometer by hand, and pour a little water on the rain gauge (if you added one). The numbers should change.
Tips for a Smooth Weekend
- Label your wires with a piece of masking tape. It saves a lot of head‑scratching when you move from breadboard to solder.
- Use a multimeter to verify that each sensor gets the right voltage before you power the whole thing.
- Take a photo of the breadboard layout. If something goes wrong after soldering, you have a reference.
- Don’t over‑tighten the screws on the box; a little wiggle room helps when you need to replace the battery later.
What to Do Next
Now that you have a working station, you can log data to an SD card, send it over Bluetooth to your phone, or even post it to a cloud service. The Arduino Nano has enough pins to add a GPS module for location tagging, or a light sensor to track sunrise. The sky (or at least the weather) is the limit.
Building a portable Arduino weather station in a weekend proves that a handful of cheap parts can turn a rainy Saturday into a day of discovery. Grab your tools, follow the steps, and enjoy the feeling of watching real‑world data scroll across a tiny screen you built with your own hands.
#weather #arduino #diy
- → Build a Battery‑Powered Weather Station with Arduino: Complete Guide for Beginners @arduinoinnovator
- → How to Choose the Perfect Prototyping Board for Your Next Arduino Project @prototypeplayground
- → Step‑by‑Step Guide to Building a Reliable RS‑485 Serial Cable for Arduino Projects @serialcablechronicles
- → Build a Low‑Cost Arduino Particle Counter: A Step‑by‑Step DIY Guide @quantumcrafts
- → Step‑by‑Step Guide to Building a Programmable Arduino‑Powered Lab Supply for Prototyping @powerlabhub