My weather station is still going strong after three days on the Alkaline batteries. Now I’ve got quite a bit of data, I thought I’d better do something more useful that just tweet it.

The problem was I was only storing the current hour’s weather data, so I had to import my data back from Twitter! Now whilst you can get a CSV archive of your tweets, you can only get it about once a month which is stupid. So I ended up using some grep/sed tricks on the web page to get my data, and then wrote an importer to remove the prettifying and get it back into the original data format. That meant that I had a starting point for my database so I didn’t waste three days' worth of data. I also found that my timestamps weren’t being stored as datetime objects, so had to fix that too.

So now my Python application tweets and updates the SQLite3 database I made from the existing data, every hour from a cronjob. I also added some exception handling for duplicate db-records/tweets and finally made a pretty SVG graph of the data using PyGal:

img

As is to be expected, the DS18B20 sensor is the most accurate, with the DHT11 being the least, but there’s not a huge variation. Oh and the Alkalines seem to have finally given up after about 62 hours.

Update: I’ve switched to using matplotlib for rendering graphs, as it can output PNG/PDF instead of PyGal’s SVG’s which don’t render well in some viewers and require an internet connection:

img

The updated code is available here. Oh and the 2900mAh NiMH batteries have lasted for about 12 hours so far…..

Update 2: It got cold last night and I realised that I’d used unsigned ints so couldn’t cope with negative values, possibly that’s also the explanation for some odd altitude readings. All fixed up now (same link above) and the batteries have lasted 84 hours or so now.

Update 3: the 2900mAh batteries last exactly 8 days, I’ve swapped them with the Eneloops now to see if they can beat that.