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…

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.Raspberry Pi Birdbox Camera

Step 2: Install the Pi NoIR Camera Board

The original Pi camera board had an infrared filter, which meant that it couldn’t be used with an infrared light source for night time vision. The Pi team subsequently released the Pi NoIR camera (NoIR stands for No Infra-Red filter). It’s a decent 5 mega pixel camera capable of real-time streaming at 1080p.

The Pi camera board connects directly into the Pi circuit board and makes use of the Pi’s Graphics Processing Unit (GPU) rather than using the CPU for processing. This means the Pi can process real-time 1080p with very little impact on the main CPU. This is a great advantage over using a webcam connected to one of the Pi’s USB ports.

I purchased the Raspberry Pi NoIR camera board (£23) from Amazon: Raspberry Pi NoIR Camera Board

It’s quite straightforward to connect the camera to the Pi circuit board. Instructions are here.

You can then use the raspistill and rapsivid commands to test the camera. Note that I only used these commands for testing; I wanted the birdcam to have real-time video and to capture photos from the camera for motion detection simultaneously, which wasn’t possible with raspistill and raspivid because only one process can connect to the camera at a time. I used the picamera Python library instead – more on that later.

Step 3: Adjust the Focal Length of the camera

The lens on the Pi Camera Board is shipped with a fairly long focal length so it needs adjusting for the close up ‘macro’ photography required inside a birdbox. Fortunately, the Pi Camera lens has a screw thread that is set to a standard focal length at the factory and then glued with a couple of blobs of resin. You need to very carefully turn the camera lens with a pair of pliers to break the glue and then you can freely adjust the lens.

Once you’ve broken that glue it’s a case of positioning the camera in your birdbox and then using trial & error to adjust the focal length to where you think the birds will be sitting. I placed a packet that had small writing on at the point where I wanted the sharpest focus (about 2 cm from the bottom of the box). I then kept adjusting the screw thread and using raspistill take photos until I had a sharp in-focus picture. The two attached photos show the before and after shots.

You can find more details of macro photography with the Pi Camera here.

Step 4: Attach the Infrared LEDs

Infrared LEDs are required to illuminate our feathered friends at night time. I purchased the following ‘infrared illuminator’ because they were so incredibly cheap (£3 including postage): Infrared Illuminator Board. A word of caution – they took approximately 8 weeks to arrive because they are shipped from Hong Kong.

Unfortunately this illuminator requires a 12v power supply; I did look around for 5v alternatives but I couldn’t find one. I suspect this is because 12v is standard for security cameras, which I believe this is designed for. In order to avoid having two power supplies connected to the birdbox camera I decided to have a single 5v supply and then split it so that 5v is supplied to the Pi and then a second cable connected in parallel uses a voltage converter to upscale from 5v to 12v. I purchased this converter (£3.18) to do the job.

You’ll also need a power supply cable that plugs into the LEDs and can be soldered onto the voltage converter. The power supply cables that fit the infrared LED board are available here (£2.12 for five cables): Power Supply Cable for CCTV Camera LED Board.

The voltage converter I purchased is adjustable, so it requires the used of a multimeter to ensure it’s around the right voltage for the illuminator.

I’m sure there are better solutions than what I’ve done so if you happen to be expert in this area then any feedback would be appreciated.

Step 5: Set-up the cheapest ever Power-over-Ethernet

I wanted a single cable going out to the birdbox to provide power and a network connection so Power-over-Ethernet (PoE) seemed the obvious way to do this. The Pi doesn’t support PoE natively so a custom solution was required.

Many PoE kits are available but they’re really expensive. I wanted to keep the cost to a minimum and I eventually found some cheap PoE injectors. I purchased two (£2.90 each, £3.70 postage): Power-over-Ethernet injectors.

One of the PoE injectors is connected to the power supply, a network port on your LAN and also connected to one end of a long Ethernet cable that goes to the Birdbox. The other PoE injector is used at the Pi end. I cut the power jack off the injector and soldered on a Micro-USB male connector that plugs into the Pi power supply; a cheap USB charger cable provides the male Micro-USB connector (£3.41): Right Angle Micro USB connector

I also soldered a power cable to voltage upscaler for the Infrared LEDs.

All of the above should be visible in the attached photos.

Bear in mind that Ethernet cable provides resistance so the voltage drops over a long cable. I wanted an Ethernet cable circa 5 metres long and after some experimentation I found that I needed to supply 6v for the Pi, LEDs, voltage converter, etc to work at the other end of the 5m cable. I also used Cat5e cable (this is really cheap on Amazon, circa £2 for 5m including postage).

I also researched and experimented to ascertain the power requirements: the camera module needs 250mA, the Pi requires a maximum of 1000mA and the LEDs drew 23mA. I thought the voltage converter would also used a fair amount of power (which I didn’t measure) so I erred on the side of caution and purchased a power supply capable of 6v at 3Amps (£18):Multi-voltage 3 Amp Power Supply. This is probably overkill so an improvement would be a more cost effective power supply.

A potential improvement to reduce the size of the Birdbox Camera is to solder the power cables from the PoE injector directly to the Pi circuit, which removes the need to have the Micro-USB male connector protruding from the side of the Pi. After I had finished the bird box I found instructions on how to do this here: Solder power supply directly to Pi circuit board.Raspberry Pi Birdbox Camera schematic

Step 6: Squeeze it all into the Raspberry Pi case

A hole needs to be cut into the case to allow the Pi Camera Board lens to protrude through and then the camera needs to be glued in place. I used regular strong adhesive for this.

A couple of other slots need to cut into the case to make space for the cables.

The Pi itself and the voltage converter can be positioned so that the case can be snapped shut.

Step 7: Register with the SEGfL Birdbox Project

A forward thinking group of Local Councils and schools in the South East have created The Birdbox Project, which is essentially a web portal that provides a capability for schools to share video streams, photos and a blog for their bird box projects. It is designed to work with USB webcams and streaming from desktop PCs but I found a way to use it with the FFMPEG streaming utility on the Pi.

Firstly, you’ll need a member of staff at the school you’re supporting to get in touch with the Birdbox Project team for an account. Details of how to do this can be found on The Birdbox Project website.

Once the account has been set-up they will supply you with the administrator URL, username and password. You can get the details you need for FFMPEG using the following steps:

  1. Login to the Birdbox Project Admin website
  2. Click on ‘Edit’ for your Microsite
  3. Click on ‘Video streams’
  4. If a video stream page hasn’t been created already then create one
  5. Click on ‘Edit’ for the video streaming page
  6. Stroll down to where HD Streaming is on the right of the page. Click on ‘Find Out More’
  7. On the HD streaming page click on ‘Download Profile’ and save the file ‘fmeProfile.xml’ for later. It contains the details you’ll need to use with FFMPEG
  8. Scroll down the page a little further to a section called ‘Step 4: Click the green…’ and note down the Username and Password. These are also required for FFMPEG

 

For more detail: Raspberry Pi Birdbox Camera




© 2015 Powered By Engineering Projects Team, Raspberry Pi Projects

Scroll to top