Advancedraspberry-pi

Solar-Powered Weather Station

Off-grid weather station powered by solar energy, transmitting data wirelessly to a base station.

8-12 hours
$60-100
Alex Chen
Solar-Powered Weather Station

Parts List

  • Raspberry Pi Zero W (base station)
  • Arduino Nano (remote station)
  • nRF24L01+ Radio Modules (x2)
  • Solar Panel (6V 3W)
  • TP4056 Battery Charger
  • 18650 Battery
  • Weatherproof Enclosure
  • Wind/Rain Sensors

Step-by-Step Instructions

1

Build Remote Station

Assemble the Arduino Nano, nRF24L01+ radio module, and sensors inside a weatherproof enclosure mounted on a pole in an open area away from buildings and trees. Wire the solar panel to the TP4056 battery charger module and connect the charger output to the Arduino's VIN pin for continuous off-grid power. Mount the 18650 battery alongside the charger and seal all cable entry points with silicone to prevent moisture intrusion.

2

Wire Weather Sensors

Connect the DHT22 temperature and humidity sensor to Arduino digital pin 4, the BMP280 barometric pressure sensor to the I2C bus (A4/A5), and the wind speed and rain gauge sensors to interrupt-capable pins 2 and 3. Calibrate the wind sensor by recording pulses per revolution and calculate wind speed using the manufacturer's conversion factor. Mount the wind vane and anemometer at the top of the pole with the rain gauge positioned below to catch precipitation without obstruction.

3

Set Up Base Station

Flash Raspberry Pi OS Lite to the MicroSD card and boot the Raspberry Pi Zero W with the nRF24L01+ radio module connected to its SPI pins. Install the Mosquitto MQTT broker and configure it to accept connections from the remote Arduino node. Set up a Python script that subscribes to incoming radio data, parses the sensor readings, and publishes them to MQTT topics for logging and visualization.

4

Program Data Relay

Write an Arduino sketch for the remote node that reads all weather sensors, packages the data into a compact binary packet, and transmits it via the nRF24L01+ radio every 60 seconds. Implement a low-power sleep mode between transmissions using the Arduino's power-save features to extend battery life during cloudy periods. Add a watchdog timer that resets the Arduino if it hangs, and configure the base station to log all received data to a CSV file for long-term trend analysis.

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <DHT.h>

RF24 radio(9, 10);
DHT dht(4, DHT22);
struct WeatherPacket {
  float temp, humidity, pressure;
  float windSpeed;
  int rainCount;
};

void setup() {
  dht.begin();
  radio.begin();
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.setChannel(108);
  radio.powerDown();
}

void loop() {
  radio.powerUp();
  WeatherPacket data;
  data.temp = dht.readTemperature();
  data.humidity = dht.readHumidity();
  // Read BMP280 pressure, wind, rain...
  radio.write(&data, sizeof(data));
  radio.powerDown();
  // Enter low-power sleep for 60 seconds
  for (int i = 0; i < 60; i++) {
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    sleep_enable();
    sleep_cpu();
  }
}