Category Archives: Home Automation

Home Automation projects

RasPi Weather Station

Some time ago I tripped across the adafruit temperature & humidity sensing page  for Raspberry Pi and Beaglebone black, showing you how to build your own weather station which recorded details in a Google Docs sheet online.

At the time here in the UK I couldn’t get hold of a sensor so I put the project on hold. Recently I found a sensor available from ModMyPi in the UK for only £8.49 + VAT so I bought it.

Brilliant. With only a little soldering, I should be up and running with a weather station that can record temperature & humidity, and upload to a Google Docs sheet. Now that I had the sensor I re-read the instructions. They looked more detailed than my initial perusal, so I put the sensor on the shelf for a week or two.

Two weeks later I remembered about it, and thought ‘how hard can this really be?

Revisiting the instructions I thought they were actually very clear, and now I was getting down to the build, seemed quite simple and straightforward.

AM2302The instructions showed the connections made through a breadboard, but I wanted to connect direct to the GPIO pins on the Pi, so on each of the 3 sensor output wires, Red, Yellow and Black, I soldered a corresponding Red, Yellow and Black male to female jumper lead. (I soldered the Male pin to the sensor wire – the female pin connects to the Pi.)  I also put some heatshrink around the joint to protect the connection.

So I now have a sensor with long wires which can connect directly to the Pi.  Which I did.

Then I followed the software installs. Straightforward. Ran the test program. It surprised me, but the Temperature and Humidity were displayed straight away – yeah!

The next task was to follow the instructions to run the program and output the readings to a Google Docs sheet.  This was a little harder for the following reasons:

  1. I had to change the sensor pin value from 23 to 4. The diagram showed wiring into GPIO pin 4, but for some reason the code had pin 23.
  2. I struggled to name my Google Docs sheet correctly. Just a standard typo. I thought I had removed the spaces in the file name but I hadn’t.

Then it worked.  I was even more amazed, so I took a picture.  And yes, everything looks a bit Heath Robinson’ish, and so it should.  This is a prototype. I made a stand from a wire coat hanger. I still have to fix the heatshrink.  Put the sensor on a different Pi with a full enclosure case. And I have to amend the software so that it runs automatically on boot, and checks that the internet is present before trying to write out to the Google Docs sheet.  Then it will be a stand alone device that I can leave in situ working as a weather station.

I will update this post when I have completed the device, and post a finished picture for comparison. Just to say for now that if you want to build yourself a temperature & humidity sensing device ,and want to see the output on the internet from anywhere in the world, it will take you about 4 hours work and cost you less than £15 (that is assuming you already have a Raspberry Pi).


As I finish writing this the Pi is in another room in the house and I am viewing the spreadsheet on-line watching the temperature slowly go down overnight, and that gives me a real sense of achievement.
There are however a few blank lines being written out to the spreadsheet, and there is a note about this in the instructions, so I will also have to modify the code to overcome that. But it in no way diminishes the warm glow and in fact means more fun coding a solution 🙂


I made a couple of edits to the code, found some excellent new features in Google Docs sheets, and here is a ‘live‘ link to my Test WeatherStation data as a chart (Data No Longer Updated). This will be up actively updated for a few days or so whilst I fine tune the operation. [ And I have now added a Low Temperature alert messages direct to my Pebble watch via Pushover following these instructions. ]