Guest post #7: Bird table webcam by Francis Agius

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.

Software

Raspberry Pi

  • Arch Linux
  • Motion
  • Ffmpeg

Windows

  • putty for ssh connection
  • Winscp to transfer files

Hardware

  • 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

31 comments

oldlaptop avatar

I would suggest running sshfs on the rpi, connected to a *nix machine. That would make it possible to save images directly to the *nix machine over the network (particularly handy if you happen to use Linux as your main OS).

Dave avatar

Excellent project, this is one of the reasons I bought my raspberry pi, although I’ve not progressed with it yet. I current have a windows setup connected to some security cameras, one inside a birdbox that used software to record video when movement was detected. Also wrote a perl script that would tweet a screenshot from the birdbox when movement was detected.

It works great but abit bulky having a desktop in the garden shed, so aiming to miniaturise to a raspberry pi – the world of linux is new to me so I taking it slowly – still at first base, managing to install a VNC ;)

Link below gives some details on my setup, start from the bottom of the page:-

http://lakeuk.blogspot.co.uk/search/label/birdbox

Francis avatar

Dave,
Just checked out your link and your setup looks to be much more capable than mine, looks really good! Getting an Rpi setup with similar performance will definitely be a challenge but then that’s half the fun.

Davespice avatar

That’s a great bit of work. I love the video of the Robin too. You can see he thinks the Camera is up to no good and so keeps checking it every few seconds =)

GMi avatar

Very nice. How long does the battery last?

Francis avatar

I have had the camera running all day, at least 12 hours. To be honest using a car battery may be a bit over the top I just happened to have one and wanted something portable. A half amp Rpi and a 50 amp/hr battery in theory should run for a few days. A tidier solution may be a smaller 12v lead acid motorcycle or house alarm battery.

Mark avatar

I got my son who is 14 a Raspberry which arrived a few weeks ago and so far he has managed to install the XBMC media softaware but now seems a bit lost as what next to do.

Your Webcam setup has hit the spot but as we are complete novices at this side of computing I would appreciate any help in installing the Arch Linux software and the additional packages you used to get up and running.

I really enjoy your projects and has got me fired up with several ideas, I now have the hard task of convincing number one son.

Thanks

Mark

mittfh avatar

The process for the ARM version of Arch may be slightly different, but there’s a very useful Beginner’s Guide on the Arch wiki – it’s over 20 pages worth of printout, but very useful! I used it the other week when setting it up on my Desktop box to replace another distro (after backing everything up first, just in case!)

https://wiki.archlinux.org/index.php/Beginners%27_Guide

Mark avatar

Thanks for the links.

Francis avatar

Mark,
I have used the Arch image “archlinux-hf-2012-09-18” from the Raspberry pi downloads page, and set it up to use ssh to access the Rpi remotely from a laptop. To capture images from the webcam I added two packages, motion and ffmpeg, they can be installed using:
pacman -S motion
pacman -S ffmpeg
The Rasberrypi.org forum is a great place to go to get detailed information on how to configure motion and your Rpi. I found it much easier to first use a wired network setup until the webcam was working and then added wifi later. There were several failed attempts and Arch ‘re-images’ before I had wifi working!
For wifi setup two package were added, initscripts and netcfg, installed using:
pacman -Syu initscripts
pacman -S netcfg
A wifi configuration file needs to be created to hold your wifi settings you can use file wireless-wpa as a template.
Navigate to /etc/network.d
copy file wireless-wpa to a new file, ‘mywifi’
cp wireless-wpa mywifi
Then move it to the network.d directory.
mv /etc/network.d/examples/mywifi /etc/network.d/mywifi
Edit file ‘mywifi’ to add your home wireless settings add these lines.
ESSID=’your wireless sid’
KEY=’your wireless password’
Next edit file /etc/rf.conf so that the wifi network is started when the Rpi boots up.
Add a line at the end of rf.conf:
netcfg -c mywifi
This is just an overview of what has worked for me but I am sure there are lots of alternative ways to capture images and configure wifi. Hope you can make use of this and have fun with your project!

Tom avatar

Yeah, this is exactly what I’m gonna do when I’ll have money for second Pi. The one I have is now rabbit surveillance (with nightvision webcam) and PPTP server.

Andy Wright avatar

Neat project but it’s basically re-inventing the wheel. Wi-Fi or IP cameras have been available for years now. These cameras can wait for a minor or major change in the viewing area then can be set up to automatically record, Email or even send you a SMS text message. They are completely configurable in a web browser. Plus most Wi-Fi cameras are designed to handle an outdoor environment. Basically your 12V battery and a Wi-Fi camera could take the place of the Pi, Hub, USB Camera & DC to DC converter and a Wi-Fi camera might even cost less too!

clive avatar

“it’s basically re-inventing the wheel”

More like building your own wheel from scratch because you fancied learning something about geometry, spokeshaves, working steel etc; or just because you enjoy carpentry. Of course, you could have just gone out and bought a nice shiny wheel ;)

computermillerj avatar

Very well said! The raspberry pi project really is all about learning, not buying an off the shelf solution. Those have their place, but there is not much learning involved and not much customization available.

Francis avatar

Thanks, I totally agree, it may have been done before but you can get a huge amount of pleasure from doing it for the first time yourself! I think there are two aspects to an Rpi project, there is the end result which may or may not be put to good use and then there is the bit before this where you get a few hours enjoyment learning something new.
Cheers!

KA1OS avatar

Nothing wrong with reinventing the wheel when your goal is understanding how they’re made…

A similar project would be a wildlife camera triggered by motion or breaking a light beam. Or to take the bird camera further, playing with pattern recognition.

Christian avatar

That is absolutely great! Could you tell me from where you’ve got the dc/dc-convertor?

I’ve got a similar setup running in a birdhouse but with an alix board, i’m on to migrate it to raspberry pi for next spring and add some temperature sensors and infrared lights. mine is solar powered and with two webcams. check it out if you want to have a look: http://goo.gl/15UtK

keep up those great projects!
best regards from switzerland

Inky- avatar

From maplin.co.uk

Francis avatar

Christian,
I have had a look at your link, the pictures are really impressive! Maplin.co.uk stock the dc to dc converter, just search for part number a79gw. It is very versatile and I am sure it will be useful in other projects. Please keep your link updated hopefully there will be some Rpi footage next spring!
All the best.

Aleksandr Ershov avatar

Great job! Can you comment on the quality/resolution of the video?

Francis avatar

The picture size and frame rate are not as high as I had hoped, the video at the top of this article is the best quality I could get, and after several changes to the motion config file. There is an option for motion to use an ‘mpeg’ input straight from the webcam which I suspect would give better results but couldn’t get this to work with my webcam and arch install. I would be interested to know if anyone has been more successful with this.

Steve Gulick avatar

Very Nice! If you are using systemd in Arch linux and are are starting ‘motion’ automatically on booting, I would be thankful if you could describe your startup configuration. I am new to systemd

R Williams avatar

Fantastic segment on bird box cameras. Has anyone tried an analog camera like the bird box cameras? We have one would like to connect PI up. The camera uses phono connectors and need a way to convert phono to digital, then process the image. Thanks all in advance R Williams

smstext avatar

im looking to do a similar with a window bird feeder and pi+camera. just a question about the battery, how many amps is it and how long does it last between charges?

Francis avatar

Its an old 50amp/hr battery, never tested it until flat but my guess is that it should be good for a few days, assuming the Rpi and kit is using 0.5 of an amp.

Alex Birkett avatar

Why can’t you plug the webcam and the wifi dongle directly into the Pi? Is there not enough power?

polarlight avatar

I have 512MB RAM Raspberry Pi with the Raspian distribution + motion installed.
What kind of top frame rates and resolutions combination have you come out with ?

I have Logitech B910 USB-webcam and I get something like 1 fps with resolution 864 x 480.
Additionally I am saving still picture every 60 seconds and running Apache2 server with 4-5 instances (probably 2 too much in that number). 1 fps is quite good for RasPi, since the jpegs are quite big. The stills are like 100kB in size…motion jpegs are probably 50..70kB each.

According to my findings, the outcome was poor and not usable with 256MB RAM Rasperry Pis. Yes, I am a major consumer of RasPis, I have about 6 of them in various tasks, from UPS monitoring to home automation to video surveillance :)

xierdaxinxi avatar

The author of the article, so I learned a lot, thank you.

Qynn avatar

Hmm.. I had the idea for combining this project with a solar power Rpi project …wonder if that would work?

I’d like to set it up to capture images of our Hummingbird feeder and tweet shots of when the birds fly in!

Any thoughts?

Lohith avatar

Please explain me the steps how did you do this..?
I have done a similar setup, but motion is streaming very slow even aflter overclocking.
I want to setup teamviewer kind of app, suggest me if anything is available other than VNC..
Thanks.

Eric avatar

Hi, just a question. I saw your DC to DC converter, but could not find it anywhere.. can you tell me exactly what brand it is? please send me a email as i’m afraid i’m not be able to find this topic back!

Comments are closed