Not that it was a case of installing the code, plugging the weather station into the Raspberry Pi and watching the data flow, mind. Seemingly I had to battle every single step and it made me realise just how easy we have it with Windows or Mac OS. An alternative view is that Linux is kept deliberately abstruse by geeks who want to look good.
I was going to produce a step-by-step guide as I had been frustrated by gaps in so-called tutorials. These often left me scratching my head as I tried to match the information to my situation. And there, of course, is the problem: a detailed guide wouldn't necessarily be of great benefit if you're not me (and you wouldn't want to be). So here instead are a few tips for the bits that caused me the greatest misery.
Mounting Drives
If you want to store or retrieve data that's not on the SD card that contains the operating system you're going to have to mount a drive. Simon the Pi Man's guide to setting up the RasPi as a NAS contains information on finding the name the Linux gives the drive (which is, of course, different...) and how to mount it every time the RasPi reboots.
Permissions
Oh wow, I found this a real difficulty. Every time I wanted to create a directory or copy a file onto the usbstick I had to use sudo to give myself sufficient privileges. Fine for setting things up but useless when expecting pywws (the weather station software) to add data files. Eventually I stumbled across the Ubuntu Documentation site that sort of pointed me to the answer. In fstab add the line:
/dev/sda1 /mnt/usbstick vfat defaults,dmask=0000,fmask=0000 0 0Probably gives too much access, but it works.
pywws
Jim Easterbrook has clearly spent much time creating and honing this software that pulls off, processes and uploads the data from the Fine Offset USB weather station. His pages on GitHub are full of useful information and a nearly useful tutorial. I say nearly - it is detailed, but being a halfwit there's questions I had that weren't fully explained. I got there in the end using an excellent tutorial on the Dragontail site with added bits and bobs from Yfory.
php
Hmm, I still haven't got my head around getting the data uploaded by pywws into a website using php. In the end I cheated and used the pre-built templates from the Weather by You site. These are teetering on twee and I will eventually change them.
So now I have local weather updated every hour that I can connect to from where ever I am. Not at the moment, though; I think my external IP address has changed and Dyndns hasn't updated itself. Seems to do that a lot recently. Shouldn't take too long to sort out...
Congratulations on making a Raspberry Pi do something useful. The other people I know who have them just seem to spend their time telling you how clever they are without actually producing anything.
ReplyDeleteIt really sounds like the old days of Spectrum/ZX81 programming, with the joy being in the act of programming rather than any of the actual output.
BTW I may be missing the point here, but I can get my weather updated to my smartphone hour by hour by putting in my post code. :-)
I certainly felt a sense of achievement making the damned thing work and learnt stuff too. Connecting a webcam to it and making that available on the web was almost trivial.
ReplyDeleteAnd, no, there's little value of knowing what the temperature was in my back garden at 3am, but since when did having fun need to have a point?
Are you going to post the webcam link?
ReplyDelete