So you want to record the temperature over time?

So you want to record temperature measurements over time?

I have used the Adafruit guides to teach myself how to log the weather.  They're fairly easy to follow and the guides are updated regularly.

See this Adafruit guide on how to publish temperature and humidity readings to Google docs - https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging

The Adafruit guide uses a DHT11 sensor that can measure temperature and humidity.  My advice is to use the slightly more expensive DHT22 sensor as it's more accurate, has higher and lower humidity sensing, and is more stable.

You can add multiple DHT sensors to a Pi but each sensor requires one dedicated pin on the pi (26 pins are usable of the 40 available).  You can also use DS18B20 1-Wire Temperature sensors to record the temperature.  These can be "networked" together requiring just one pin on the Pi.

Adafruit guide on DS18B20 temperature sensors - https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing

You might wish to record the ar pressure.  Adafruit again has a guide but it looks out of date - https://learn.adafruit.com/using-the-bmp085-with-raspberry-pi/using-the-adafruit-bmp085-python-library?view=all

My Setup

I have 2 Raspberry Pi's running 24 x 7 x 365 days a year measuring the weather.  The data is dumped to a MySQL database running on a website.

Pi 1 (at rear of property) - 2  DHT22 sensors (one inside, one outside), 20 DS18B20 temperature sensors, 2 Light sensors (inside and out), pressure sensor, Pi camera

Pi 2 (at front of property) - 2  DHT22 sensors (one inside, one outside), 5 DS18B20 temperature sensors, 2 Light sensors (inside and out), rain sensor, wind sensor, pressure sensor

 

Notes

Raspberry pi 3 chosen as it has built in wifi and low energy Bluetooth.  Cheaper older models are available but you'll have to buy Wifi adapter.  Most guides are written for Pi 3.  This would run on a Pi Zero (£5) but you then have extra problems with things like 1 usb port, soldering on the headers etc.

You can run a Raspberry Pi 3 from a normal USB power supply (mobile phone charger) as long as it can supply at least 2 amps.  The Pi will run on power adapters supplying less than 2 amps but you may run in to problems.

Sometimes you can buy higher capacity memory cards cheaper.  You need at least a 4gb memory card and I currently use 8gb cards.  I backup my cards every time I make a major change, so backing up 16gb card's would require more space.  The Pi supports up to 64gb micro SD cards.

Equipment Required (total about £60)

 

Optional

 

Other Stuff

Using Energenie Power Plugs

Forget Energenie's own sample.  See http://bennuttall.com/whats-new-gpio-zero-v1-2/

https://pypi.python.org/pypi/energenie

 

from energenie import switch_on, switch_off
from time import sleep

# turn all plug sockets on and off
switch_on()
switch_off()

# turn a plug socket on and off by number
switch_on(3)
switch_off(3)

sudo apt-get install python-pip
sudo pip install energenie

sudo apt-get install mysql-client python-mysqldb -y

 

 

 

General Update – 1st December 2015

I've produced version 2.1 of the WeatherPi and now have 4 in long term test.  They seem to be doing well.  It looks like the MCP23017 chip can't keep up with the wind speed detector, so that's sensor is now going through an arduino nano, and in to the pi via the serial connection.  If an Arduino Nano is being used, might as well use it for the analogue sensors as well.

Possible changes to the Weather Pi? Remove 2 x I2C Analogue converters and replace with an Arduino Nano. Add 2 headers dedicated to running servos direct from the pi for Pan and Tilt Camera. Add header for serial I/O. Possibly pre-route some GPIO ports to the breakout section of the board.

On a separate subject I've moved the 433mz receiver from a dedicated Pi to the Weather Display Pi.  This seems to be working well.

I've removed the aircraft tracking facility from Pi 7 as I never seemed to actually use the data.  I did have it feeding in to the Flight24 website but again they never seemed to use the data.

My test Pi is currently testing PL9823 RGB Addressable LED's which are similar to Neopoxles / WS2811 / WS2812.  Testing seems to be going well, although I can only get them displaying Red, Green, Blue, Yellow, Purple, Pink and White.  I can't get them to "dither" other colours.

I received a Pi Zero on the front cover of my Magpi Magazine, and at this stage not sure what I'll do with it.

WeatherPi Version 2 PCB issues

WeatherPi version 2 has been assembled and I have attempted to test. And that's when I hit some issues.

I'd assembled the board with new 40pin extended headers to fit to a A+, B+ or 2. Unfortunately my test Pi was an old style model A, and the 40 pin header get's in the way of the Audio port on the classic A.  I tried it on a B+ that I have but the PC can't clear the USB and ethernet socket.  Major fail.  I'd soldered the extended header too close to the PCB rather than at the full extent.

2015-04-15 10.53.22Thankfully I came up with the idea of using an additional header to "stand off" the PCB from the Pi.  This worked but left a 10cm square board hanging in mid air.  Once populated with cables the entire thing tips over.  Another reason the next version must have mounting holes for both forms of Pi.

Once I'd worked that out I turned on the Pi. I had a power light but nothing happening. I'd already tested the Pi and it was fully networked, but I couldn't connect.  I gave in and connected a monitor to find it wasn't booting up.

To cut a very long story short I spent a very annoying two days trying to figure it all out.  I discovered that despite spending 2 weeks on the PCB design and checking it for a further 5 days, that I'd wired up the IC chips incorrectly.

On the MCP23017 digital input output IC I'd wired up the i2c and power wrongly.  Basically I'd wired up from the bottom upwards, but should have missed a pin at the start which is not used.

On one of the PCF8591 analogue chip I'd missed out an SCL connection for i2c. On both chips I'd mistakenly wired up the address pins to positive instead of negative. This isn't a big issue as the chips appear successfully on different port numbers.  I'd also connected the VSS pin to positive instead of negative.At this stage I'm ready to give up.