Skip to content

The code behind a custom weather station build for gathering and uploading data to Wunderground and a database

License

Notifications You must be signed in to change notification settings

dirtchild/weatherPi

Repository files navigation

weatherPi

About

This is the software behind the second prototype of a personal weather station based around a raspberry pi zero w. This is a complete restart of the code from the first prototype. I was going to reuse that code but it was ugly, needed an overhaul, I didn't like the structure of it and I didn't want to mess with an existing repo. The weather station itself uses a few adafruit sensors along with a four channel ADC attached to external senors (which are sold as weather station spare parts). It has a custom case built around a water bottle and an embedded solar fan to negate heat fluctuations from direct sunlight. Its all very specific to my build, but would be a good starting point for reuse for others attempting to build something similar.

Purpose

The code should be relatively well documented and easy to follow. The main funciton is to:

  1. Read all attached sensors
  2. Send the gathered data to
    • weather underground
    • Metoffice WOW service (UK)
    • a remote database (I use this to generate a basic current conditions page).

Python Module Dependencies

  • Adafruit_DHT
  • Adafruit_Python_ADS1x15
  • MySQLdb
  • RPi.GPIO
  • smbus
  • urllib2
  • WeatherSensors (in this repo)

Hardware

The hardware used in this project, in no particular order:

Design

Various design diagrams are in the DesignDocs directory, they may help someone. All sensor data passing is carried out using a custom data structure, SensorData. For consistency (and because data is uploaded to Wunderground), I use the labels set out in the Weather Underground PWS API when dealing with labeled sensor readings e.g. baromin for barometric pressure. The units defined by the wunderground API are also used for consistency if nothing more (even though it feels wrong to be using imperial measurements it's easy enough to convert things to something more sensible on display).

Note that there are two temperature sensors in use here (not by design - the humidity and barometric pressure sensors came with extras). These are mounted in the enclosure with the rPi/rest of the internals. Although there is a fan and all endeavours have been made to equyalise the temperature inside the casing with the outside air (venting, painted white, fan etc), both readings are averaged and then normalised against the CPU temperature to try and get an actual air temperature.

About

The code behind a custom weather station build for gathering and uploading data to Wunderground and a database

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published