We have built our own Swallow Cam using a Raspberry Pi so that we can watch the swallows in our shed raise and fledge their young. I should be honest and point out that although I say we, it was my brother who put this together for us, and he has kindly agreed to outline what he used, and did below…
For this project we used an old version 1 Raspberry Pi. Any model will do apart from the early PiZero models which do not have a camera connection.
Raspberry PiNOIR Camera:
This is the ‘night vision’ version of the Raspberry Pi camera. You can use the regular one for better colour images, but as we wanted to also shoot in total darkness we went for the infra red version.
Long Range USB WiFi Adaptor:
This was needed as the shed with the nest was outside normal WiFi range of our internet hub. The best test to do is that if your smartphone has a WiFi connection in the location you are placing the Pi then you you can use a regular USB WiFi connector. If you are using the latest Pi3 or Pi ZeroW they have WiFi built in
Prototype Board, 6 x IR LEDs & 2 x 47ohm resistors:
These are only needed if you are using the PiNOIR camera and want to do night vision filming. Below is a screen shot of the wiring diagram and the power is just supplied from the 5v and Ground pins on the Raspberry Pi.
The first thing to do is to install a new version of Raspian on your Raspberry Pi and get the camera set up. If you are new to the Raspberry Pi then all the information can be found on their website at:
Once you have your Raspberry Pi and Camera set up then you will want to make sure you have PuTTY and VNC activated on your Pi so you can access it remotely using your PC without a monitor, keyboard and mouse connected to the Pi. There are plenty of tutorials on this available and so I will not repeat them all here.
We installed our camera overlooking a nest that our visiting swallows return to every year. The piece of insulation that you can see in the photo below is something that we put in place a couple of years ago to protect the lawnmower that sits underneath the nest. Since our swallows have never seemed bothered by this adaptation to their nesting site we were hopeful that the presence of Swallow Cam wouldn’t disturb them.
Streaming your live feed to Youtube
Now you need to install the software on the Pi to stream to YouTube. Type in these commands in order through a command line on the Pi:
git clone git://git.videolan.org/x264
sudo ./configure –host=arm-unknown-linux-gnueabi –enable-static –disable-opencl
sudo make install
This will install X264 on the Raspberry Pi. These steps will only take a minute or so. Once this has finished you will need to install FFMPEG with the following commands (the ‘sudo make’ stage will take hours so you may as well get on with other stuff, but don’t forget to do the ‘sudo make install’ when it has finally finished):
git clone git://source.ffmpeg.org/ffmpeg.git
sudo ./configure –arch=armel –target-os=linux –enable-gpl –enable-libx264 –enable-nonfree
sudo make install
You now need to set up your YouTube account for streaming. Click on the upload button in your Youtube account and follow the instructions to set up a live feed. When you apply for live streaming YouTube will verify your account and then issue you with the key that you need to add to the code below
Once this is set up then enter the following command on the Raspberry Pi:
raspivid -o – -t 0 -vf -hf -w 720 -h 480 -fps 12 -b 480000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i – -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<Stream name/key from YouTube>
On the 30th of April our Swallows started to return, and we are delighted to see that they are visiting our Swallow Cam nest and appear to be making repairs ready to nest. You can see them and Swallow Cam in action below
This has been such a fun project, and the kids are totally enthralled with the live stream of our nest. We already had most of the bits and bobs to put Swallow Cam together, but if you are starting from scratch and buying everything in, we would expect to be able to build it for less than £50. We are now working on a camera trap version to see if we can capture some images of the nocturnal visitors to our garden.