Hi there! This is a step-by-step guide to creating a Raspberry Pi Birdbox Camera that features real-time video streaming, motion detection, infra-red LEDs for night vision and has a cheap Power-over-Ethernet solution.

I starting making this with my 11 year old son for his Primary School but it quickly became a complex project and I ended up finishing it off! It's now located on a wall of his school and has an interested female House Sparrow building a nest, fingers-crossed that we'll have some eggs too.

Note that I used a Birdbox that we had at the school which is built for use with a camera and has opaque windows that let in sunlight.

Please note that these instructions are DRAFT. If you would like to recommend any improvements or if you have any questions then please don't hesitate to contact me via the Instructables website.

On to the project...

Step 1: Prepare the Raspberry Pi

Base Raspberry Pi components

Firstly, I used a Raspberry Pi model B, a cheap case and, to keep the size to a minimum, a Micro SD adapter and Micro SD card. I purchased the following base Pi parts (the prices were at the time when I purchased them):

I installed the SD card, put the Pi in the case and installed Raspbian by following the raspberrypi.org instructions.

<p>Excellent make there. I really like how SEGfL have set up the means for schools to do live web streams. It's really neat how you have managed to keep the build within the footprint of an RasPi case. My first thought was that that all those LEDs would cause a white-out, but from your footage this isn't the case, and the integral light dependent resistor is a nice touch. I've done something similar described on my blog, (minus the IR stuff) here: <a href="http://nestboxtech.blogspot.co.uk/2014/04/side-view-raspberry-pi-powered-bird.html" rel="nofollow">http://nestboxtech.blogspot.co.uk/2014/04/side-view-raspberry-pi-powered-bird.html</a> I thought you might find my approach to PoE interesting. I've used an off the self product (not expensive) that steps down to 5v at the box, meaning I can use quite long cat5 runs - I've got a webcam nest box running a good ~150ft from the power source in one case. Does your setup give you the option of recording video locally?</p>
<p>Hi NestBoxTech, thanks for your comments and feedback. Your approach to PoE sounds great, I'll look at that for next year. It can record locally, it would just need a change to the Python script.</p>
<p>This is a great project and something that I have wanted to do for a while.</p><p>I'm rusty on linux but happy that all the steps are clear enough to follow - thanks for that.</p><p>If this is a non-school project and I just want to see the live images on my home network, can anyone recommend the best way to consume the feed coming from the pi?</p>
<p>You are adjusting the focus distance, not the focal length (zoom).</p>
<p>This looks great, I've been using an analogue webcam birdbox at home for a while but like the idea of switching to IP. I'm going to also see if my son's school would like me to help them set this up. Just one thought I've had, how badly does this hit the school's bandwidth? Is it a constant 500kbps stream? If so that's over 5GB upload a day if they leave it 24/7, has your son's school been ok with that? I don't want to be responsible for them racking up massive usage bills!!</p>
<p>Hi Jimnastics,</p><p>I found that it doesn't use too much bandwidth. The SEGFL system seems to use an adaptive bit rate and it settled at around 150kbps (if my memory serves me correctly). The school were fine with it. One word of caution is that dealing with school IT can be difficult (to set up firewall rules, etc)! It was a combination of people from the local council, a local secondary school and the school itself. It was quite a slow process so I'd recommend asking them early.</p><p>Good luck with your build!</p><p>Cheers,<br>Matt</p>
<p>Can i use this setup but bypass the SEGfL setup? I just want to be able to stream the video for myself, via an IP address??</p><p>I'm new to all this Pi stuff.</p><p>Thanks :)</p>
Hi, yes you can use this setup and stream it to an alternative destination. Best regards, Matt
<p>I think it's worth mentioning that the encoding with ffmpeg doesn't need to take place on the Raspberry Pi itself. You can pipe stdout over netcat to another PC do to the encoding. If you want true live streaming, encoding with VP8/9 should do the trick. I've achieved near 0 delay with VP6. Ffmpeg does not take advantage of the hardware acceleration offered by the Pi, and encoding is quite processor intensive. I believe you'd be able to achieve higher FPS, and better resolutions by doing the encoding on a more powerful PC.</p><p>As for compiling ffmpeg from source, again, doing it on the Pi itself is probably not the best approach: <a href="https://trac.ffmpeg.org/wiki/CompilationGuide/RaspberryPi" rel="nofollow">https://trac.ffmpeg.org/wiki/CompilationGuide/Rasp...</a></p><p>You'll do much less waiting if you use cross-compilation.</p><p>I'm curious - how does the CPU of the Pi cope under the load of ffmpeg whilst it's encoding? Did you have to reduce the quality to achieve reasonable FPS? This is something I'm going to be looking into very soon.</p>
<p>I cheat and just run a mjpeg stream to a windows box running iCatcher Console, and the motion capture and recording happens there.</p>
<p>Interesting options. The purpose of this build, though, was to create a standalone bird box camera that doesn't need any other local computers. It streams the video over the internet to the South East Grid for Learning content delivery service where a huge number of people can watch it simultaneously.</p>
<p>Thanks for the comments Stulander. I believe the recompiled ffmpeg does take advantage of the GPU hardware acceleration as long as you use the RPi Camera Module that connects directly into the CSI port. If you use a USB webcam then I don't think the GPU can be used. The image resolution and frame rate for my project was limited by the server receiving the video stream, which I think was 640x480 at around 15fps. The CPU utilisation was low - around 10% - and the Pi was also doing the motion detection.</p><p>Regarding the cross-compilation, that sounds interesting but I think it's easier to do it on the Pi itself and just leave it for the 9 hours or so that it takes. I'd love to hear how you get on with cross-compilation if you try it.</p>
<p>A huge thank you to Bj&ouml;rn Vanneste who contributed an alternative Python script. I've included it an step 12 in the build. Thanks Bj&ouml;rn, awesome work!</p>
<p>Nice, but doesnt the infrared light confuses the birds? D:</p>
There are many commercially available nest box and wildlife cameras with infrared illuminators that don't impact the wildlife.

About This Instructable




More by mattwood0:Raspberry Pi Birdbox Camera 
Add instructable to: