Picture of Raspberry Pi Birdbox Camera

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...

Remove these adsRemove these ads by Signing Up

Step 1: Prepare the Raspberry Pi

Picture of 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 instructions.

NestBoxTech9 months ago

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: 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?

mattwood0 (author)  NestBoxTech9 months ago

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.

Stulander8 months ago

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.

As for compiling ffmpeg from source, again, doing it on the Pi itself is probably not the best approach:

You'll do much less waiting if you use cross-compilation.

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.

I cheat and just run a mjpeg stream to a windows box running iCatcher Console, and the motion capture and recording happens there.

mattwood0 (author)  NestBoxTech24 days ago

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.

mattwood0 (author)  Stulander7 months ago

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.

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.

mattwood0 (author) 5 months ago

A huge thank you to Björn Vanneste who contributed an alternative Python script. I've included it an step 12 in the build. Thanks Björn, awesome work!

Jan_Henrik10 months ago

Nice, but doesnt the infrared light confuses the birds? D:

mattwood0 (author)  Jan_Henrik10 months ago
There are many commercially available nest box and wildlife cameras with infrared illuminators that don't impact the wildlife.