A New Project
I've embarked on a new project, one that actually ties in very nicely with the weather system and keeps me marching in the right direction development-wise.
I'm working on a way to synchronize the hosts file amongst various machines on a network, as well as Google-Chrome bookmarks (and, in future, files to be backed up). There are various kludges to make this happen; I just said screw it and have begun writing myself a couple of programs.
The first is the server. It will respond to XML requests on the server's CGI-bin interface. The server is (at least for now) designed only to run when queried.
The second is the client. It will send XML queries to the CGI-bin interface, and listen to the results.
I've decided upon XML as the way to do this, simply because it's good at encapsulating string information, and just a bit more precise than the typical query of key1=value1&key2=value2&etc.
So, for now I'm working on the skeleton of the server and in particular the XML module.
In the meantime, I'm still also working on my weather system, plus on my Comedy Radio Show.
-Bill
Sunday, 16 March 2014
Monday, 10 February 2014
Getting Ready to Open Source
2014-02-10
My weather system is starting to mature - it's at Version 3.10 now, and I frankly can't think of much to add to it, apart from an expanded environmental dataset - Snow-on-Ground, that sort of thing. I recently added queries and a data-extant flag, which tidies things up a bit.
So, I'm getting ready to open-source the whole works. It turns out that's taking some time.
First, I've got to document what I have. It's no easy proposition, but it has to be done. I've been at it for two days, now, and have some 22 pages complete. It's gonna be one of those projects.
Next, I'll have to tidy things up a bit and include a sample dataset. That'll take only a little work.
Thirdly, I've got to document the install procedure. That's a little bit involved but, again, a necessary evil.
All that, not just for the weather system, but for all of the support programs as well.
Once I've got all that together, then I've got to upload the works to sourceforge.
Bleah.
-Bill
2014-02-10
My weather system is starting to mature - it's at Version 3.10 now, and I frankly can't think of much to add to it, apart from an expanded environmental dataset - Snow-on-Ground, that sort of thing. I recently added queries and a data-extant flag, which tidies things up a bit.
So, I'm getting ready to open-source the whole works. It turns out that's taking some time.
First, I've got to document what I have. It's no easy proposition, but it has to be done. I've been at it for two days, now, and have some 22 pages complete. It's gonna be one of those projects.
Next, I'll have to tidy things up a bit and include a sample dataset. That'll take only a little work.
Thirdly, I've got to document the install procedure. That's a little bit involved but, again, a necessary evil.
All that, not just for the weather system, but for all of the support programs as well.
Once I've got all that together, then I've got to upload the works to sourceforge.
Bleah.
-Bill
Monday, 4 November 2013
A Raspberry Pi Security Camera
2013-11-04
I'd been looking for uses for my raspberry pi, and it finally hit me: a security camera!
Given I already had the pi, and a charger, all else I needed was a webcam. For this, I chose the Nexxtech HD Webcam; it's a decent little unit, with a 1280x720 CMOS sensor and plenty of low-level light pickup, and a relative bargain for $29 at The Source.
I rigged up a case for the pi from an empty cigarette pack; the new 25s are perfect for this. With that, I just had to rig a little shelf, in the window beside the door, on top of which went the webcam, and away I went. Perhaps the most technically challenging moment came in figuring out a way to run power to the downstairs entrance!
Now, you know me; I don't do things the easy way; I do them the efficient way. I didn't want some GUI setup to worry about; everything would have to be done from the command line. With that in mind...
The preliminaries: I had to install a few things that weren't in the default Raspbian setup:
- Apache2
- fswebcam
- ImageMagick (just in case)
- Possibly others
The capture portion was easy enough to set up, with the proviso that the brightness be adjusted for day and night. The image should be in two sizes, and should be saved to /var/www. I put it into a shell script:
nano /home/pi/webcam.sh
#!/bin/bash
time=$(date "+%H%M")
if ((630 < 10#$time && 10#$time < 1700)); then
fswebcam -D 1 -f 2 --set brightness=20% -r 1280x720 --jpeg 95 /var/www/door.jpg --scale 320x180 --jpeg 95 /var/www/door-sm.jpg
else
fswebcam -D 1 -f 2 --set brightness=100% -r 1280x720 --jpeg 95 /var/www/door.jpg --scale 320x180 --jpeg 95 /var/www/door-sm.jpg
fi
chmod +x /home/pi/webcam.sh
I wanted to capture four frames per minute from the camera (the relevant modules were already installed in Raspbian).
The other issue was the with the WiFi dongle setup, the pi was unstable; so I'd throw in a reboot every hour; it takes just seconds. The easiest way to do all this was through cron jobs, as follows:
crontab -e
# m h dom mon dow command
0 * * * * /sbin/reboot
* * * * * /home/pi/webcam.sh
* * * * * sleep 15; /home/pi/webcam.sh
* * * * * sleep 30; /home/pi/webcam.sh
* * * * * sleep 45; /home/pi/webcam.sh
And that, literally, is all I needed to do.
The rig handles day- and nighttime illumination levels very well; attached is a jpeg. I access it locally through the network at http://pi/door.jpg. Works like a charm!
2013-11-04
I'd been looking for uses for my raspberry pi, and it finally hit me: a security camera!
Given I already had the pi, and a charger, all else I needed was a webcam. For this, I chose the Nexxtech HD Webcam; it's a decent little unit, with a 1280x720 CMOS sensor and plenty of low-level light pickup, and a relative bargain for $29 at The Source.
I rigged up a case for the pi from an empty cigarette pack; the new 25s are perfect for this. With that, I just had to rig a little shelf, in the window beside the door, on top of which went the webcam, and away I went. Perhaps the most technically challenging moment came in figuring out a way to run power to the downstairs entrance!
Now, you know me; I don't do things the easy way; I do them the efficient way. I didn't want some GUI setup to worry about; everything would have to be done from the command line. With that in mind...
The preliminaries: I had to install a few things that weren't in the default Raspbian setup:
- Apache2
- fswebcam
- ImageMagick (just in case)
- Possibly others
The capture portion was easy enough to set up, with the proviso that the brightness be adjusted for day and night. The image should be in two sizes, and should be saved to /var/www. I put it into a shell script:
nano /home/pi/webcam.sh
#!/bin/bash
time=$(date "+%H%M")
if ((630 < 10#$time && 10#$time < 1700)); then
fswebcam -D 1 -f 2 --set brightness=20% -r 1280x720 --jpeg 95 /var/www/door.jpg --scale 320x180 --jpeg 95 /var/www/door-sm.jpg
else
fswebcam -D 1 -f 2 --set brightness=100% -r 1280x720 --jpeg 95 /var/www/door.jpg --scale 320x180 --jpeg 95 /var/www/door-sm.jpg
fi
chmod +x /home/pi/webcam.sh
I wanted to capture four frames per minute from the camera (the relevant modules were already installed in Raspbian).
The other issue was the with the WiFi dongle setup, the pi was unstable; so I'd throw in a reboot every hour; it takes just seconds. The easiest way to do all this was through cron jobs, as follows:
crontab -e
# m h dom mon dow command
0 * * * * /sbin/reboot
* * * * * /home/pi/webcam.sh
* * * * * sleep 15; /home/pi/webcam.sh
* * * * * sleep 30; /home/pi/webcam.sh
* * * * * sleep 45; /home/pi/webcam.sh
And that, literally, is all I needed to do.
The rig handles day- and nighttime illumination levels very well; attached is a jpeg. I access it locally through the network at http://pi/door.jpg. Works like a charm!
Monday, 2 September 2013
Records
2013-09-02
Seems the all-time records are getting screwed up.
It's not a tough one to catch; everything happens in just two routines. Problem is, everything looks okay to me. Every programmer goes through this eventually and, after much pulling of hair and gnashing of teeth, fixes it. I will, too - it's just a matter of seeing how the code performs in real life.
I'm really pleased with the rest of the system; it's running really well, now, which is why I've been dragging my heels on fixing it.
All in good time.
-Bill
2013-09-02
Seems the all-time records are getting screwed up.
It's not a tough one to catch; everything happens in just two routines. Problem is, everything looks okay to me. Every programmer goes through this eventually and, after much pulling of hair and gnashing of teeth, fixes it. I will, too - it's just a matter of seeing how the code performs in real life.
I'm really pleased with the rest of the system; it's running really well, now, which is why I've been dragging my heels on fixing it.
All in good time.
-Bill
Tuesday, 13 August 2013
Sunday, 2 June 2013
Beaten!
(2013-06-02)Solved.
Turns out I had forked the build on the stats-capture program, and been careless with my code. I hang my head in shame.
Not only is it now delivering forecasts acceptably, the forecast is also now appearing on the main page!
Everything's ticking along at about 95%.
-Bill
Sunday, 19 May 2013
Compiler Bug
2013-05-19
My weather system has had difficulty in recent days with delivering regional stats. The capture program was to read through a list of .ini data and process accordingly. Unfortunately, it was running about five iterations and then crapping out.
Turns out it was a compiler bug.
At times, it just worked; at other times, it wouldn't work at all. The compiler itself was generating bad code.
In the end, I unravelled the loop, so to speak: the program now accepts command-line parameters and iterates just once for each location. It works!
Now I can go back to figuring out why the forecast isn't appearing for CTO.
-Bill
2013-05-19
My weather system has had difficulty in recent days with delivering regional stats. The capture program was to read through a list of .ini data and process accordingly. Unfortunately, it was running about five iterations and then crapping out.
Turns out it was a compiler bug.
At times, it just worked; at other times, it wouldn't work at all. The compiler itself was generating bad code.
In the end, I unravelled the loop, so to speak: the program now accepts command-line parameters and iterates just once for each location. It works!
Now I can go back to figuring out why the forecast isn't appearing for CTO.
-Bill
Subscribe to:
Posts (Atom)
