Tag Archives: webcam

Lincoln Heard, Minibeasts and Raspberry Pi

via Raspberry Pi

I often get asked how old the youngest kids we see using the Pi are. A lot depends on the individual kid’s dexterity: if they can handle a mouse with reasonable accuracy, they’re old enough to use Scratch. Usually the younger kids we see are the children of engineers or other people who are already confident around computers – and typically they start at about five.

Lincoln hooks up a camouflaged camera

Lincoln Heard a bit of an outlier. He is four years old. When he was three, he made a video with his Dad (an ICT teacher) about how to set up your Raspberry Pi (“So easy a three-year-old can set it up!”). Lincoln really loves his Pi, and, when he came home from school with a form inviting him to enter a Minibeasts habitat incorporating recycled materials, hit upon the idea of incorporating a Pi into the build.

A cereal box, a webcam, a Pi as a webcam server, some Minecraft cutouts and some weatherproofing later, Lincoln and Dad came up with this (the engineering knowhow is Dad’s, but the design and much of the work you see here is Lincoln’s):

And here’s snailcam in action:

If you’d like to make your own Minibeasts habitat like Lincoln’s, Dad has written the project up: you’ll find a full parts list and tutorial, as well as some discussion of design decisions he and Lincoln talked through (weatherproofing, wireless strength, power options). And, of course, you’ll find out how Lincoln did in the competition, in case you hadn’t guessed already.

Guest post #2: Peeping Tom in the toilet with Raspberry Pi

via Raspberry Pi

When Jeroen Danckers sent us a blog post with that title he was on to a winner. And let’s face it, who hasn’t dreamed of putting a computer in the toilet connected to a camera that reports back to a web page whether the toilet is occupied or not. I have.

There’s all kind of people running around at our digital agency (Intracto, Belgium). Not only in numbers, but also in all weird forms and shapes. A simple discussion during lunch break about busy toilet usage quickly ends up in high-tech cut ‘n’ paste with webcams, Raspberry Pi and PHP trickery. So now we can check online whether our toilet is taken or not. :)

Should I stay or should I go?

The trick with the webcam
The system behind our little project has already been the subject of lively discussion amongst our competitor/colleagues of the Belgian web sector. Farfetched solutions like a pressure sensors under the toilet seat or little gnomes in a cage with a switch are sadly not true.

In all its simplicity we put a webcam in our toilet. It luckily doesn’t shoot any compromising images, but measures the light intensity instead. The cam takes a boring shot of the wall in the front hall and then grants a brightness value to each pixel with PHP-GD.

From those -100 or +100 values we calculate the average, which determines if the toilet is taken or not. Almost dark means no toilet action and a lot of light probably means ‘danger zone in action’. Or the cleaning lady is making her rounds.

And it also lets you play Tetris while you are otherwise engaged.

Technical set-up Toiletcam
We connected a USB-hub to the Raspberry Pi, which functions as a power source. Additionally we connected 2 USB webcams to take the pictures (2 toilets) and a USB-stick on which we installed the OS. Lastly we plugged in a SD-card to boot the Raspberry Pi.

The calculation of the state of the toilet happens like this:

  1. Linux-application Streamer takes a still with the webcam and saves it.
  2. Through PHP-GD the light intensity (brightness) of the pixels gets calculated. The average of these values determines the state of the toilet.
  3. This result gets compared to the local cache. Only if there’s a difference something happens!
  4. This event gets filed away in a database log.
  5. The script pauses for one second, to give the poor Raspberry Pi some much earned rest. ;-)
  6. Switch toilets, rinse and repeat.

In the same time the Raspberry Pi offers a local website that refreshes each 5 seconds through an Ajax-call, pulls the current states of the toilets and shows them in a nice lay-out.

Surprisingly handy innovations on the working floor
Working at Intracto offers quite a few surprises. In the morning you can moan about the busy toilets on your daily sanitary strolls and in the afternoon the colleagues can already be busy working out a solution to ease the pain.

Next up on our list of innovations is the realtime level of the coffeepot! ;-)

Shard Rain Cam

via Raspberry Pi

Willem, from The Secret Batcave in South London, is piqued with irritation by the Shard, which interrupts his view from pretty much everywhere he looks. The Shard, for non-Brits and for those Brits who have been living…in a cave, is 95 storeys of incongruous Qatari-owned phallomorphism designed by the guy behind the Pompidou Centre in Paris. It’s the tallest building in the EU, at 309.6 metres. It’s out of place, madly disproportionate, looms over the city like a great big monument to stupid domineering excess, dwarfs the Wren churches of the City of London and even the converted power station that houses the Tate gallery, and was described by John Prescott as being of “the highest architectural quality,” which really tells you all you need to know.

I do not like the Shard. I’m not a Luddite; I say this as a person with a great fondness for the Erotic Gherkin and the Spiral extension of the V&A that never got built. London’s a living city, and new buildings are part of its evolution. But good architecture has something to say; all the Shard has to say is “Whee! I’m bigger than you!”, while trying to stab you in the eye. (And trying to get you to fork over £25 to go to the top to have a look out of the window. It’s a Tourist Attraction, you see.)

At least I don’t live in London, though. Unlike poor Willem, who has to look at the damn thing every day.

But Willem has realised that his rage can be assuaged with a little dose of sour grapes, and that information is beautiful even if the Shard isn’t, so he’s hooked a Raspberry Pi up to a camera pointing at the thing to remind himself that life at the top of the Shard isn’t always a light-bathed soak in other people’s views.

I live in South London, which means that the everywhere I look the Shard stands over me. Now its reported that a flat in this tower of Babel will cost north of £30 million quid. Lets hope the lifts work.


This wonderful splash of cash got me thinking, basically you buy this flat for the view. Now living in Britain as I do, I know that the weather is not really designed for long distant views. This got me thinking; if its grey and raining for a day, how much does it cost? Quite a lot as it turns out:


£30,000000 / (365 *10) = £8230 a day.


That’s right, rain costs eight grand a day.


Lets just go over those figures a little. We assume a flat costs £30 million, The Telegraph claims its up to £50M, however the estate agents seem to differ and peg it at around £20M. I’ll do what economists do and guess a number and swear its based on an accurate model. Likewise I assume that the average nouveau riche nonce will keep the flat for about ten years (I assume they’ll either die in a car crash, coke overdose, or have to sell it to fund an expensive vice of some sort).


If we plug those numbers into my proprietary financial model algorithm, we see that £30M spread over ten years equates to £8230 a day (with rounding). I also assume that you buy this type of flat for the view. Dividing it further, each rainy hour costs around £342. It’s even higher if you don’t count the night time.


So why do I need a webcam? Well I want to find out how often the shard is obscured by rain, and therefore how much money has been eaten by the British weather and then laugh at the ****s who splashed so much cash. 

You can read more about why Willem put this cam together and how he did it on his website. He’s also made his timelapse software available, and explains how he quantifies “cloudiness” using the cam’s output.

The data the Pi receives is sent to a simple little website called What Can I See From the Shard. Here’s a screengrab:

Thank you, Willem. Your bitterness serves us all.


Guest blog #7: Bird table webcam by Francis Agius

via Raspberry Pi

“You can know the name of that bird in all the languages of the world, but when you’re finished, you’ll know absolutely nothing whatever about the bird … So let’s look at the bird and see what it’s doing—that’s what counts.” – Richard Feynman (well, his dad Melville really)

And how do you see what the bird is doing? With a Raspberry Pi of course. Francis Agius tells us how :

A robin visits the table: click for video

Inspired by other web cam posts I wanted to set up a web cam that I could use to record my garden bird table. New to this sort of thing there were several hurdles to overcome! The main two were getting a reliable wireless set up and also being able to run the Raspberry Pi off a battery so I could leave it running free standing outdoors. I also wanted if possible to use Arch Linux as it is a very lean OS, less than 10 seconds to boot up! For wireless network I have used a Tplink WN722N USB stick, this is supported by Arch Linux without any extra difficult setup.

The innards

For power I already had a spare 12 volt car battery and found a fantastic DC to DC converter at Maplin which has two outputs, USB 5v at 0.6 amps good for the the RPi and a second 5 volt output at up to 3 amps perfect for a powered USB hub which runs the camera and the WiFi stick, making it possible to run the whole setup from a single 12 volt car battery power supply. There are probably cheaper ways to get 5 volts from a 12 volt car battery but the Maplin product is very tidy and easy to use. My Raspberry Pi is running Arch Linux with additional packages motion and ffmpeg installed, there are lots of post on how to set these up. I can forward info on my setup if this this will help anyone.

Sealed up and ready for action

So to summarize I am using Arch Linux running motion and ffmpeg, I use ssh connect to my Rpi and start motion running, pictures are captured to the Rpi sd card. On my windows machine Winscp is installed which is great for moving the captured files from the Raspberry Pi to windows.


Raspberry Pi

  • Arch Linux
  • Motion
  • Ffmpeg


  • putty for ssh connection
  • Winscp to transfer files


  • Tplink WN722N USB wifi adapter
  • Sweex Blackberry Black Usb Hd camera
  • Advent powered USB hub
  • Maplin A79 GW DC to DC converter
  • Old 12 volt car battery
  • Food storage container

Streaming Your Webcam w/ Raspberry Pi

via Wolf Paulus » Embedded

[Last updated on Feb. 2. 2013 for (2012-12-16-wheezy-raspbian) Kernel Version 3.2.27+]

Three years ago, we bought two small Webcams and since we wanted to use them on Linux and OS X, we went with the UVC and Mac compatible Creative LIVE! CAM Video IM Ultra. This Webcam (Model VF0415) has a high-resolution sensor that lets you take 5.0-megapixel pictures and record videos at up to 1.3-megapixel; supported resolutions include 640×480, 1290×720, and 1280×960. If you like, you can go back and read what I was thinking about the IM Ultra, back in 2009. Today, it’s not much used anymore, but may just be the right accessory for a Raspberry Pi.

With the USB Camera attached to the Raspi, lsusb returns something like this:


Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 005: ID 041e:4071 Creative Technology, Ltd

Using the current Raspbian “wheezy” distribution (Kernel 3.2.27+), one can find the following related packages, ready for deployment:

  • luvcview, a camera viewer for UVC based webcams, which includes an mjpeg decoder and is able to save the video stream as an AVI file.
  • uvccapture, which can capture an image (JPEG) from a USB webcam at a specified interval

While these might be great tools, mpeg-streamer looks like a more complete, one-stop-shop kind-of solution.

Get the mpeg-streamer source code

Either install Subversion (svn) on the Raspberry Pi or use svn installed on your Mac or PC, to get the source-code before using Secure Copy (scp) to copy it over to your Raspi.

Here, I’m using svn, which is already installed on the Mac, before copying the files over to my Raspi, (username pi, hostname is phobos)

cd ~
mkdir tmp
cd tmp
svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer
scp -r ./mjpg-streamer pi@phobos:mjpg-streamer

Please note: Looks like the repo got recently moved, Try this to check-out the code if the previous step does not work:

svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer/ mjpg-streamer

Over on the Raspi, I tried to make the project, but quickly ran into error messages, hinting at a missing library.

ssh pi@phobos
cd mjpg-streamer/mjpg-streamer
jpeg_utils.c:27:21: fatal error: jpeglib.h: No such file or directory, compilation terminated.
make[1]: *** [jpeg_utils.lo] Error 1

After finding out, which libraries were available (apt-cache search libjpeg), I installed libjpeg8-dev like so: sudo apt-get install libjpeg8-dev. This time, I got a lot further, before hitting the next build error:

make[1]: *** [pictures/640x480_1.jpg] Error 127
make[1]: Leaving directory `/home/pi/mjpg-streamer/mjpg-streamer/plugins/input_testpicture'

After some google-ing, which resulted in installing ImageMagick like so: sudo apt-get install imagemagick, the next build attempt looked much more promissing:


and ls -lt shows the newly built files on top:

-rwxr-xr-x 1 pi pi 13909 Sep 8 07:51 input_file.so
-rwxr-xr-x 1 pi pi 168454 Sep 8 07:51 input_testpicture.so
-rwxr-xr-x 1 pi pi 31840 Sep 8 07:50 output_http.so
-rwxr-xr-x 1 pi pi 14196 Sep 8 07:50 output_udp.so
-rwxr-xr-x 1 pi pi 19747 Sep 8 07:50 output_file.so
-rwxr-xr-x 1 pi pi 29729 Sep 8 07:50 input_uvc.so
-rwxr-xr-x 1 pi pi 15287 Sep 8 07:50 mjpg_streamer
-rw-r--r-- 1 pi pi 1764 Sep 8 07:50 utils.o
-rw-r--r-- 1 pi pi 9904 Sep 8 07:50 mjpg_streamer.o


MJPG-streamer is a command line tool to stream JPEG files over an IP-based network. MJPG-streamer relies on input- and output-plugins, e.g. an input-plugin to copy JPEG images to a globally accessible memory location, while an output-plugin, like output_http.so, processes the images, e.g. serve a single JPEG file (provided by the input plugin), or streams them according to existing mpeg standards.

Therefore, the important files that were built in the previous step are:

  • mjpg_streamer – command line tool that copies JPGs from a single input plugin to one or more output plugins.
  • input_uvc.so – captures such JPG frames from a connected webcam. (Stream up to 960×720 pixel large images from your webcam at a high frame rate (>= 15 fps) with little CPU load.
  • output_http.so – HTTP 1.0 webserver, serves a single JPEG file of the input plugin, or streams them according to M-JPEG standard.

Starting the Webcam Server

A simple launch command would look like this:
./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"

MJPG Streamer Version: svn rev:
i: Using V4L2 device.: /dev/video0
i: Desired Resolution: 640 x 480
i: Frames Per Second.: 5
i: Format…………: MJPEG
o: HTTP TCP port…..: 8080
o: username:password.: disabled
o: commands……….: enabled

Open a Webbrowser on another computer on the LAN and open this url: http://{name or IP-address of the Raspi}:8080

However, experimenting with the resolution and frame rate parameters is well worth it and can improved the outcome.

UVC Webcam Grabber Parameters

The following parameters can be passed to this plugin:

-d video device to open (your camera)
-r the resolution of the video device,
can be one of the following strings:
or a custom value like: 640×480
-f frames per second
-y enable YUYV format and disable MJPEG mode
-q JPEG compression quality in percent
(activates YUYV format, disables MJPEG)
-m drop frames smaller then this limit, useful
if the webcam produces small-sized garbage frames
may happen under low light conditions
-n do not initalize dynctrls of Linux-UVC driver
-l switch the LED “on”, “off”, let it “blink” or leave
it up to the driver using the value “auto”

HTTP Output Parameters

The following parameters can be passed to this plugin:

-w folder that contains webpages in flat hierarchy (no subfolders)
-p TCP port for this HTTP server
-c ask for “username:password” on connect
-n disable execution of commands

I have seen some good results with this
./mjpg_streamer -i "./input_uvc.so -n -f 15 -r 640x480" -o "./output_http.so -n -w ./www"
but even a much higher resolution didn’t impact the actually observed frame-rate all that much:
./mjpg_streamer -i "./input_uvc.so -n -f 15 -r 1280x960" -o "./output_http.so -n -w ./www"

MJPG Streamer Version: svn rev:
i: Using V4L2 device.: /dev/video0
i: Desired Resolution: 1280 x 960
i: Frames Per Second.: 15
i: Format…………: MJPEG
o: www-folder-path…: ./www/
o: HTTP TCP port…..: 8080
o: username:password.: disabled
o: commands……….: disabled

Webcam Stream Clients

The included Website (http://{name or IP-address of the Raspi}:8080) shows examples for how to connect a client to the Webcam stream. The easiest way is obviously a simple HTML page that works great with Google Chrome and Firefox but not so much with Safari. Anyways, it’s important to specify the width and height that was configured with the output_http.so, in the HTML as well

  <img alt="" src="http://phobos:8080/?action=stream" width="1280" height="960" />

Raspberry Pi Webcam Streamer

Taking the Raspberry Pi Web Stream Server Outside

This is the Raspberry Pi powered by a 5VDC, 700mA battery, with an (Edimax EW-7811Un) USB-WiFi Adapter and the Creative LIVE! CAM Video IM Ultra connected.

Video Lan Client for Viewing and Recording

Using Video Lan Client, you can view and also record the video stream, served by the Raspi.

Recorded Webcam Streamer

Movie, streamed from a Raspberry Pi

Raspberry Pi Webcam from Tech Casita Productions on Vimeo.

Let me know what Webcam software you found that works well on the Raspberry Pi.