On 19 June, the USB temperature sensor I ordered from Amazon arrived. This sensor is now hooked up to my Raspberry Pi, which is taking the temperature every 10 minutes, drawing graphs, then uploading them here. Here is a brief outline of how I set this up (I'm writing this nearly two weeks after I did it so if you can't follow any of the steps let me know and I'll try to work out what I've missed out):
Reading the Temperature
I found this code and adapted it to write the date, time and temperature to a text file. I then set cron to run this every 10 minutes. It writes the data to a text file (/var/www/temperature2) in this format:
Plotting the Graphs
I found a guide somewhere on the internet about how to draw graphs with Python using Pylab/Matplotlib. If you have any idea where this could be, comment below and I'll put a link here.
In the end my code looked like this:
If there's anything in there you don't understand, comment below and I'll try to fill in the gaps.
Uploading the Graphs to catsindrag.co.uk
Finally, I wrote a php script to upload the graphs to catsindrag.co.uk/weather: