This blog has moved to www.mscroggs.co.uk.
Showing posts with label Cats in Drag. Show all posts
Showing posts with label Cats in Drag. Show all posts

Friday, 26 July 2013

Mathematical Views

Have you ever wondered what you would see if you were sitting at the origin and looking down at some spheres distributed on a logarithmic curve?

Thought not.

But why not take a look anyway? I've made a new page on Cats in Drag which lets you view this and other functions. If you want to suggest any other functions, please comment here and I'll get right on it.

Thursday, 11 July 2013

Raspberry Pi Weather Station

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:


I hope this was vaguely interesting/useful. I'll try to add more details and updates over time. If you are building something similar, please let me know in the comments; I'd love to see what everyone else is up to.

Monday, 31 December 2012

Flags of the World

Have you ever wondered what colour you would get if you mixed all the colours in a flag?

Even if you haven't, have a look at what you would get: I made it and put it on Cats in Drag