How to Turn an Old Arduino into a Portable Weather Station

Ever looked at that dusty Arduino board in the back of your drawer and thought, “I could actually use this for something useful”? I’ve been there—mid‑winter, coffee in hand, scrolling through endless gadget forums, wondering why my old microcontroller is just collecting cobwebs. The answer? A pocket‑sized weather station that can tell you if you need an umbrella before you even step outside. It’s a sweet blend of DIY repair, gadget tinkering, and a dash of smart‑home savvy—all things I love.

What You’ll Need

Before we dive in, let’s make a quick inventory. You don’t need a PhD in electronics, just a few common parts and a willingness to get your hands a little greasy.

  • Arduino Uno (or Nano) – The “brain” of the project. If yours is a bit battered, give it a quick visual inspection; a few stray solder blobs are fine.
  • BMP280 or BME280 sensor – Measures temperature, pressure, and (if you pick the BME version) humidity. Think of it as a tiny meteorologist.
  • DHT22 sensor – A backup for humidity and temperature, especially handy if you want redundancy.
  • Anemometer (optional) – For wind speed. You can scavenge one from an old weather vane or buy a cheap kit.
  • Micro‑SD card module – Stores data when you’re off the grid.
  • Li‑Po battery (3.7 V, 2000 mAh) – Powers the whole thing. A small power bank works too.
  • Boost converter – Steps the battery voltage up to 5 V for the Arduino.
  • Breadboard and jumper wires – For prototyping before you solder.
  • Enclosure – A small project box or a 3D‑printed case. I used a recycled plastic container with a clear lid for the sensor window.
  • Soldering iron, solder, heat‑shrink tubing – The usual DIY toolkit.

Wiring the Sensors

BMP280 / BME280

The BMP280 talks to the Arduino over I²C, which means just two wires: SDA (data) and SCL (clock). Connect SDA to A4 and SCL to A5 on an Uno. Power it with 3.3 V (the sensor is picky about voltage) and ground to GND. If you’re using a Nano, the pins are the same.

DHT22

The DHT22 uses a single‑wire digital protocol. Hook the data pin to any digital pin—say D2—then add a 10 kΩ pull‑up resistor between the data line and 5 V. Power it with 5 V and ground to GND.

Anemometer (Optional)

Most cheap anemometers output a pulse each time a cup spins. Connect the pulse line to an interrupt‑capable pin (D3 works well). You’ll count pulses per second to calculate wind speed.

Micro‑SD Card

The SD module also uses SPI, which needs four pins: MOSI (D11), MISO (D12), SCK (D13), and CS (choose D10). Power it with 5 V. Keep the wiring tidy; a messy breadboard can cause intermittent reads.

Power Circuit

Hook the Li‑Po battery to the boost converter’s input, then set the output to 5 V. Feed that 5 V into the Arduino’s VIN pin (or the 5 V pin if you’re confident about the converter’s stability). The boost converter also powers the sensors, so you only need one power source.

Coding the Arduino

Now for the fun part—making the board talk. I keep my code in a single sketch for simplicity, but feel free to split it into libraries.

#include <Wire.h>
#include <Adafruit_BMP280.h>
#include <DHT.h>
#include <SPI.h>
#include <SD.h>

#define DHTPIN 2
#define DHTTYPE DHT22
#define ANEMO_PIN 3
#define SD_CS 10

Adafruit_BMP280 bmp; // I2C
DHT dht(DHTPIN, DHTTYPE);
volatile unsigned long windCount = 0;
unsigned long lastWindTime = 0;

void setup() {
  Serial.begin(115200);
  if (!bmp.begin()) {
    Serial.println("BMP280 init failed!");
    while (1);
  }
  dht.begin();
  pinMode(ANEMO_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(ANEMO_PIN), countWind, FALLING);
  if (!SD.begin(SD_CS)) {
    Serial.println("SD init failed!");
    while (1);
  }
}

void loop() {
  float temp = dht.readTemperature();
  float hum = dht.readHumidity();
  float pressure = bmp.readPressure() / 100.0; // hPa
  float wind = calculateWind();

  // Log to SD
  File dataFile = SD.open("weather.csv", FILE_WRITE);
  if (dataFile) {
    dataFile.print(millis());
    dataFile.print(',');
    dataFile.print(temp);
    dataFile.print(',');
    dataFile.print(hum);
    dataFile.print(',');
    dataFile.print(pressure);
    dataFile.print(',');
    dataFile.println(wind);
    dataFile.close();
  }

  // Quick serial dump
  Serial.print("T: "); Serial.print(temp);
  Serial.print(" C, H: "); Serial.print(hum);
  Serial.print("%, P: "); Serial.print(pressure);
  Serial.print(" hPa, W: "); Serial.print(wind);
  Serial.println(" m/s");

  delay(5000); // log every 5 seconds
}

void countWind() {
  windCount++;
}

float calculateWind() {
  unsigned long now = millis();
  float dt = (now - lastWindTime) / 1000.0; // seconds
  float speed = (windCount / dt) * 0.5; // factor depends on anemometer
  windCount = 0;
  lastWindTime = now;
  return speed;
}

A few notes:

  • Adafruit_BMP280 is a popular library that abstracts the sensor’s registers. Install it via the Library Manager.
  • The DHT library handles the timing quirks of the sensor; it can be a bit flaky, so a short delay(2000) after each read helps.
  • The wind calculation assumes each pulse equals half a meter per second; adjust the factor based on your hardware’s spec sheet.

Power and Portability

A 2000 mAh Li‑Po will keep the station running for roughly 24 hours at a 5‑second logging interval. If you need longer life, stretch the interval to 30 seconds or add a small solar panel to trickle‑charge the battery. I’ve mounted a tiny 5 V solar panel on the top of the enclosure; it adds a few milliamps of charge on sunny days—enough to keep the clock ticking.

Make sure you use a proper battery connector (JST or barrel jack) and secure the boost converter with heat‑shrink tubing. Loose wires are the fastest way to turn a weekend project into a “why does it reboot every minute?” nightmare.

Enclosure and Finishing Touches

A weather station needs to “breathe.” Cut a small window in the case for the BMP280’s sensor chip—clear acrylic works great. Seal the rest of the box with silicone to keep rain out, but leave the DHT22 exposed if you want the most accurate humidity reading (just a tiny vent is enough).

I printed a simple 3‑D mount that holds the Arduino, battery, and SD board in place. It snaps together with no screws, which is perfect for a quick swap if you ever want to upgrade the board.

Don’t forget to label the SD card with a date. I like to start each file with a header row: timestamp,temp,humidity,pressure,wind. It makes importing into Excel or Google Sheets painless.

Testing and Next Steps

Power up the unit and watch the serial monitor. You should see a line of numbers every five seconds. If any sensor returns nan (not a number), double‑check the wiring and pull‑up resistors. Once the data looks sane, unplug the USB, slip the battery in, and take it for a spin.

A few ideas to expand the project:

  • Bluetooth LE: Send data to your phone in real time.
  • MQTT: Push readings to a home‑assistant server for smart‑home automations (e.g., close blinds when wind picks up).
  • OLED display: Show the latest temperature and humidity at a glance.

Turning an old Arduino into a portable weather station is a perfect way to breathe new life into a forgotten board while learning a handful of new skills. It’s also a conversation starter—people love seeing a tiny gadget that can predict rain before you even check the forecast.

Happy tinkering!

Reactions