Workaround for RPi's USB webcam problem
- Details
- Last Updated on Saturday, 09 March 2013 17:14
Many people have reported problems with their USB webcams on the Raspberry Pi on various forums. The symptom is that the webcam software 'hangs' after shorter or longer periods of time. When the software is restarted everything is fine again, until the next lock-up.
My RPi exhibits this problem as well. When it occurs, the following message is printed to /var/log/messages:
raspberrypi kernel: [1354871.530013] uvcvideo: Non-zero status (-5) in video completion handler.
And then the webcam stream (created by motion) stops.
This is accompanied by the system load going from normal levels (~ 0.10) to 1, and staying there until motion is restarted:

My first attempt on a work-around was a Perl script that continuously 'tailed' /var/log/messages, waiting for the above error message to occur and then restart motion. It didn't work well.
Waking up and going to work
- Details
- Last Updated on Sunday, 03 March 2013 09:43
The nestcam not only provides a video stream: it also takes JPG snapshots when there is movement in the birdhouse at up to 5 pictures a second (320x240 px).
Here's a three minute, 40MB animated GIF composed of about 660 JPG images, showing the little guy waking up in the morning and leaving the house.

Created with Imagemagick:
convert -delay 20 -loop 0 *.jpg wakingup.gifRaspberry Pi data logging
- Details
- Last Updated on Saturday, 09 March 2013 17:56
I like logging data. I've always liked logging data. As a kid I used to keep track of barometric pressure and make graphs of it. For months on end, listening to Amsterdam VOLMET every morning and evening.
And now it's easier than ever before to log data (and display it) with Raspberry Pis, Arduinos and whatnot, all being easily connected to 'the cloud' for storing and sharing data. The Internet of Things.
I wanted a simple logger for my Raspberry Pi, which is online and hosting a webcam and a webserver. The requirements are simple:
- log CPU load, CPU temperature, bytes in, bytes out
- show the data in graph form
- because the data is not valuable it's ok to store it somewhere 'in the cloud'
Site upgrade
- Details
- Last Updated on Wednesday, 06 March 2013 21:20
The site has been upgraded to a new version of Joomla, using a new template, new plugins, etcetera. This involves some manual work, tweaking of settings, setting categories back to where they belong, etcetera. So while that is going on it may look a little different from what you're used to.
I'm also moving articles around a bit when I think they need to go into another category.
In the meantime, check out my new site, nestcam. That is, if you like to spy on sleeping little birds ;)
Installing the birdhouse webcam: 'nestcam'
- Details
- Last Updated on Saturday, 23 February 2013 14:12
After modifying the webcam and figuring out how to stream the images to a website with the Raspberry Pi, it was time to build a birdhouse and put the webcam into it.
I copied the dimensions from a birdhouse in which a couple of blue tits previously successfully raised a family, and made it a bit higher to accomodate the webcam. I used 16 mm multiplex and protected it on the outside only with clear (boat) lacquer. The outside dimensions are:
- width: 125 mm
- height (front): 300 mm
- height (rear): 350 mm
- depth: 125 mm
- diameter entrance hole: 28 mm
- height of entrance hole from bottom: 195 mm
The nest had already been out for a couple of weeks, and when opening it I discovered that it was already being used because there was a lot of poop in it.
The hole for the webcam can be seen at the top. That little plate can be easily removed in case I ever want to put in another cam.
Webcam streaming with Raspberry Pi
- Details
- Last Updated on Wednesday, 06 March 2013 21:16
Here is a set of instructions for the installation and configuration of a Raspberry Pi to provide streaming video from a webcam. I set this up in preparation for my Nestcam project which hopefully appears on these pages in the following months.
To capture video and snapshots from a webcam and stream them through a webserver I use Motion: "Motion is a program that monitors the video signal from cameras. It is able to detect if a significant part of the picture has changed; in other words, it can detect motion." Website here. I have also tried the combination ffserver and ffmpeg/avconv, but initially the webcam would throw errors like the one below, which caused avconv to crash. This was probably due to the USB stream containing errors and it disappeared after I updated the system
[video4linux2 @ 0x8cb6c0] The v4l2 frame is 8316 bytes, but 153600 bytes are expected
Motion can be setup in such a way that it only captures images and/or video when something moves in the camera's field of vision. This is ideal for observation purposes because it limits the required bandwidth and the number of images produced. 
To watch the stream in other browsers than Firefox you'll need to install a Java applet. At least, that's what the Motion website lets us believe: "The webserver generates a stream in "multipart jpeg" format (mjpeg). You cannot watch the stream with most browsers. Only certain versions of Netscape works. Mozilla and Firefox brosers can view the mjpeg stream but you often have to refresh the page once to get the streaming going. Internet Explorer cannot show the mjpeg stream. For public viewing this is not very useful. There exists a java applet called Cambozola which enabled any Java capable browser to show the stream. To enable the feature to a broad audience you should use this applet or similar.".
Mains frequency clock time base
- Details
- Last Updated on Wednesday, 06 February 2013 18:59
Years ago I rescued an old, two-faced Simplex clock from a dumpster. It is a so-called slave clock: it has no time-keeping mechanism from itself so it must receive a 24 volt clock pulse from a remote master clock once every minute.
Not having rescued the master clock I had to make an hour myself.
The first version consisted of a 32.768 kHz chrystal, a 4060 binary counter, a 555 integrated circuit, and some assorted TTL ICs. The idea was to divide the 32.768 kHz time base from the chrystal by some factor and end up with one clock pulse per minute.
This version broke down after 16 years of good service: the rectifier, transformer and probably some other components burnt out for reasons I have not been able to discover. Unfortunately I lost the original schematic and I did not feel like reverse engineering it, so I had to make a new hour from scratch.
Making a kite reel
- Details
- Last Updated on Wednesday, 06 February 2013 18:59
The making of this kite reel was inspired by a similar model I saw at a kite festival in Scheveningen, a couple of weeks ago. But in stead of building it from plywood I chose polypropylene, or polypropene - PP for short. It's a thermoplastic polymer that is easy to cut, saw and file and it is insensitive to moisture.
The sides are 25 cm in diameter and about 9 mm thick. They are made from kitchen cutting boards that I purchased at a local general store for about € 3 a piece.
In the left side plate I cut a hole with a diameter of 14,5 cm, to stick my hand through. Both side plates have three elongated gaps, to save weight and to function as an attachement for a carabiner. These holes also make the reel visually more attractive, IMHO.
I used a fretsaw for all the holes because it gives me more control than a jigsaw. A bandsaw would probably the most conveniet and time-saving, but I don't own one.
In the middle of the right side plate I attached a wheel from an inline skate: these have ball bearings for smooth operation and they offer a good handhold. The wheel is kept at a small distance from the right side plate with a little piece of aluminium pipe that goes over the attachment bolt.


