The technology behind the birdhouse
I’m making an attempt to describe how the technology behind my birdhouse with a built-in web cam actually works, it may seem like a simple thing for visitors to the blog, for which you need only click on a picture, and just like that, it will show you live video with sound from the birdhouse, but there is so much more going on behind the scenes.
This can also serve as a guide to build your own birdhouse with an integrated web cam, and that can be watch through your own website. Many commercial bird houses with built-in camera is based on the principle that the camera is connected via cable or wireless network to the TV set at home, and they often require special software to get both picture and sound.
This is a project that is flexible and fairly easy to build yourself, however, it requires some computer skills and a lot of patience 🙂
The first step, it is to build a suitable nest, it is at this point you have to make your first decision on what type of bird that you want as a tenant, for they are demanding those little fellas. I started about a year ago to consider what kind of birds that lived in the garden at home and noted that the blue tit was very common.
After some surfing on the internet, I found a very good drawing for a bird house. One of the most important things are that the entrance hole must be Ø = 30mm for the blue tit.
I had to modify the Drawing Birdhouse for Blue Tit to fit my needs, especially where the space for the camera was too tight.The inner dimensions from the entrance hole and downwards is still the same. Remember to use unplaned timber, otherwise it will be a little difficult for the bird to get a good grip with their small feets.
When the type of bird and drawing for the birdhouse was in the bag, the next step was to choose the type of camera. A standard USB camera was out of the question because I did not want to have a computer standing out in nature. There is no sensible way to extend the USB cable over longer distances. Camera with cable was not to think about, it would simply be impossible to pull cable from the birdhouse location to the nearest computer. So the choice fell on a wireless IP Camera Type D-Link DCS 2121, it could deliver both video and audio, even if the audio is kind of crap…
I can in this context to say that D-Link was quite reluctant to assist with any kind of advanced technical support, it was like banging your head into the wall when I had a few questions, for a while I seriously thought about throwing the camera away and get a new one. There are still a few loose ends that I would like to sort out, but I have realized that D-Link won’t be any source of information.
Well, the trick with this type of camera is that it gives a good picture, built-in microphone, and finally only need to access the wireless network (Wi-Fi/WLAN) which is common in most homes. What I had to do was to put another network node to our home network that could cope with the distance to the nest. Had it been possible to use a network cable, it would have been the absolute best solution.
So that the IP camera should survive inside the nest box, I had to encapsulate the camera in a plastic box where only the lens is visible, and so the microphone could “hear” what is happening. It is a safeguard that will be fine during summertime, but during the winter I would definitely not choose to have the technical equipment left inside the birdhouse.
One of the prerequisites for the camera to cope is to make sure it is always on, ie that there is power to the camera, because the camera’s own generated heat is enough to keep moisture out. It is important to keep the condensation away from the electronics. Had I been wise I would have chosen a camera for outdoor use, but they are way too expensive.
One measure that I have done this year to improve the reception of the wireless network was to move the camera’s antenna outside the nesting box, all to get the best possible contact with my network. When the antenna is inside the nest box the moisture in the wood affects reception conditions a lot.
Power to the camera was not much of challenge. I did not have access to mains power where the nest box is located so the choice fell on battery power. The camera does not consume that much power, but I did not want to charge the battery more than once a week, so after a bit of number crunching on the power consumption the choice fell on a 12V 120Ah leisure battery, it was the biggest I could find, and it is maintenance-free. I don’t fancy the process of topping up battery water 🙂 The battery will last for at least 10 days on a single charge.
With power source in hand, there was only one thing remaining, it was the tiny little problem that the camera was not possible to operate with 12V, it required a 5V power source to operate. So I put a voltage converter between the battery and the camera. The voltage converter transforms the 12V supply to 5V. So now I was all ready to kick-start the camera.
The voltage converter was a DIY-kit based on a regular 7805 circuit, there are tons of them out in the real world (where the pizza-dude comes from), try to find it at radioshack, velleman or any other DIY electronic dealer.
When the camera was up and running, I configured it to talk to my network via wireless link, this was not more complicated than connecting a laptop to the network. The setting I chose in the camera was that it should deliver an mpeg4 640×480 pixels at 30 frames per second. The data stream could then be accessed from my LAN computer via http:// [camera IP] / play1.sdp.
The next step, however, demanded a lot of thinking before I got it solved, but briefly the data stream from the IP camera was not possible to directly link up on a web page, this because the camera and web browser must speak the same language, so to say.
The data stream that originates from the camera is completely incomprehensible to most browsers, and I wanted a solution that could work in so many different versions of browsers as possible. My choice fell on to convert the camera signal to a pseudo-streaming flash (FLV) that can be accepted by almost any kind of browser without any fuss.
I did the conversion with the help of a fantastic software, VLC. Using VLC I can in real time convert the SPD data stream that originates from the camera to a FLV data stream that browsers understand. It is this FLV stream you can watch through my blog.
In my wordpress blog I use a plug-in called JW Player, it is using it as you, the user can see into my little birdhouse. To get the data stream out from my network, I also had to fiddle around a bit in the router, this so that the data stream could find its way out on the Internet.
As seen from a technical standpoint, I say to VLC to encode the data stream from the SDP RTSP to FLV in two stages via H264, with a *. Bat file containing the following:
C:\Program\VideoLAN\VLC\vlc.exe --repeat rtsp://192.168.1.200/play1.sdp :sout=#transcode{vcodec=h264,vb=400,deinterlace,ab=32,fps=30,width=640,height=480,acodec=mp3, samplerate=44100}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=/mediaplayer/stream.flv},dst=display}
This solution also ensures that VLC handles the events that will occure when the camera for some reason would stop sending any data. When the data stream is restored, then VLC will reconnect to the data stream and be back in business without having me to press any buttons.
And on the receiving end, that is on my blog, where I run wordpress and then displays the FLV stream using JW Player.
Behind the scenes I have made sure that a chunk of each day’s activities inside the nest box is saved, so if I get a bird family in the nest, then it will result in a short movie at the end of the summer.
I know that there were quite a lot of technology in the last part, but I am happy that I got to it all to operate, now I’m waiting for a bird to move in to the birdhouse.
Would you like more detailed information on how I implemented the project, so just contact me, easiest via email on stefan@gemzell.se
Cheers!