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 Rescued

Following my disastrous testing I decided to try rescuing my WeatherPi version 2 PCB.  In summary I'd designed the PCB wrongly, and the three IC chips had the wrong connections.

Ver-2-front-breaksOn the top of the PCB I had to break 3 tracks.  I tried a mixture of tools from a drill bit, counter sinc, and eventually ended up with a scalpel blade.  Working very carefully I was able to scratch away first the green coating, then the copper track, and to be safe some of the actual board material. I was surprised how thick the copper layer was.

On the bottom of the board I had to make 6 breaks.  I'd tried to place as many tracks on the bottom side where possible so that I could see them when troubleshooting!

2015-04-15 10.52.07I carefully solder wires to the bottom of the board using the existing pins of the IC's and headers.  I had started to use one of the unused header socket pins at the top of the board but then realized it was running at 5 volts rather than 3.3 volts.  Hence why 3 wires run to one section and one to another.

I also attempted to unsolder the 40 pin header to replace with a 24 pin header but despite using a desolder iron and desolder braid, I could not release the header.  In the end I gave in and resolder it again.

Once complete I checked there were no short circuits in the design and powered it up.

The Pi powered up and could see the three IC's, and also the temperature sensor.

So the PCB version 2 has been rescued but I don't think I'll use the other 9 boards.  At this stage I think I'll work on the design and fix the issues and make another attempt at the PCB.  Meanwhile I can work on the code to make it all work.