Saturday, 17 November 2012
A small contribution to the Internet of Things: My Kitchen Temperature using a Raspberry Pi
Today I took a second step in my Raspberry Pi journey and did some instrumentation of my home. For those that haven't yet heard about the Raspberry Pi, it is a small, cheap hobbyist computer that has captured the imagination of young and old. Check out the Raspberry Pi Foundation for all the details and how to get your own.
I got my Raspberry Pi a while ago now and the first thing I did was create an XBMC media centre for my TV. This was one of the reasons why I wanted a Pi and it was really straight forward to set it up. I didn't really use it much because to be honest, my harddisk recorder on Freeview had more than enough TV for me to digest and if I wanted to catch a TED talk or check out Khan Academy I would use the iPad. So the Pi lay behind the TV for a good few weeks undisturbed until today.
A few weeks ago I started planning to make my first homebrew craft beer at home and I wanted to find out what the temperature would be in my kitchen overnight. I understood that you need to keep beer fermenting between about 20 and 25 degrees Celsius and I didn't want to come down in the middle of the night once the central heating had gone off to find out what the ambient temperature of the kitchen was.
That was when I discovered the awesome Adafruit website. I imagined that someone had already built a temperature sensor on a Raspberry Pi and as if by magic I found this DHT humidity and temperature project created by LadaAda! I ordered the breadboard, Cobbler kit, sensor and a pack of resistors and then days later (i.e. today) it all turned up in the mail.
After soldering the cobbler kit together I assembled the kit, downloaded a fresh Debian Linux image for my SD card, then plugged everything in and started on the software. I didn't have to write anything but I had a lot of trouble getting the C code to work until I realised I hadn't followed the full instructions and compiled the code! There is also a Python program that takes the output from the C Program and uploads a record into a Google spreadsheet for me.
I now have a lovely Google Spreadsheet which gets updated every 3 seconds with the temperature and humidity in my kitchen. I took a sample of the log and copied into a lovely little website called Datawrapper which is like an online version of Excel charts but you can embed the charts in your blog as I have done! You might notice a discontinuity in the humidity figures. This is because I stopped logging for a while during making dinner. The humidity was rising in the kitchen due to the cooking but I wasn't measuring it!
So, what have I learned and what's next? Well I've learned that despite the simplicity of the project there are always little challenges along the way. I thought I would need to become a blackbelt in Python as well as brushing up on my C. As it happened I just needed to follow the instructions more clearly. Secondly it got me thinking about how instrumenting our world and sharing the results online is going to become a really big thing in the future. The Internet of Things is definitely going to be a reality. When it does, we will need a lot more than Google Spreadsheets and Datawrapper to make sense of it all but that is where Big Data comes into its own ...