Thursday 5 January 2017

BirdBox2017: a new year, a new birdbox?

Well, not exactly. No plans to build a new box, but I would like to add a second camera.

As well as the main event inside the bird box, there is often quite a bit of action on the outside, especially during the early weeks, and at the end, when the chicks fledge.

So with only a few weeks left until I need to deploy my two Raspberry Pi powered bird boxes, I need to get on with development.

This seasons idea

For this year I would like to add a second camera to one (or maybe both) of my Pi powered bird boxes. These are the ones with entrance holes, that are triggered when a beam is broken.

The outside camera will be housed in its own little box and attached by an arm, maybe 2-300mm above the birdbox. At this height I can use the standard RaspiCam lens, rather than have to fit a wide angle lens.

Block diagram for BirdBox2017

The original bird box contains a power controller board which is permanently powered by a 12V 12Ahr lead-acid battery. When the entrance sensor beam is broken (hopefully by a bird) the power controller switches on power to the Raspberry Pi.

After a simple hack, I'll have both the internal and remote Raspberry Pi boards switched on and off at the same time. Each Pi boots and runs its own software. Communication and video streaming is via separate USB wifi adaptors.

Although I've chosen to power the remote Pi with 12Volts, I could have used 5Volts. My initial reasons for choosing 12V were; 1) avoid any problems with noise or voltage drops on the power feed cable, 2) I may want to use this camera on its own in the garden later in the year.

On reflection, noise and voltage drop shouldn't be a problem given that I will probably use a fairly short length of twin 3Amp cable (the kind used for ceiling lights).

I've fitted a 78B5.0 voltage regulator directly to the gpio holes in the Pi Zero. The lead pitch is the same as the holes, so I've just bent the 12V pin over and added a small strip of insulating tape to stop it making an unwelcome connection to the Pi board.

test rig; complete with wifi dongle, 5V regulator & clothes peg camera clip

The main downside to using 12V is one of cost. When I first started using the 78B5.0 regulator there were lots of suppliers, so I could buy one for about £6. But a few weeks ago I noticed I had less choice and paid over £12.

Obviously my battery run time (between recharging) will be approximately halved, so I may have to recharge after about 35 hours of run time. Note that the current drain on standby is just a few mA and this won't change as a result of adding a separate camera. The increase only occurs when the system has been triggered.

the software

Although my bird box system boots into a graphical desktop, allowing me to VNC in and run my Gambas program, I'll probably take a different approach with the remote camera.

I don't need my Gambas app or the gui desktop, so will probably use ssh to run commands from the command line. From my laptop I can also use my gui file manager (pcmanfm) via the "Connect to server..." option to view the Pi file system to check, view and manage saved "motion" video clips.

Probably THE most annoying thing about Linux is that applications and other stuff that worked fine in the past, may not work now, with the latest software.

This currently seems to be the case with VLC, which I use for video streaming on both my boxes. It will continue to work, so long as I don't upgrade the software.

But the silver lining to this cloud is that I have been forced to re-evaluate other methods for my Pi Zero camera.

I've been playing around with the user-space Video for Linux driver: uv4l
This seems to give me good streaming performance using an mjpeg stream, and also results in a "motion" display and capture rate of 5fps. (Maybe more on this in a future post).

It looks like I'll still have to switch between mjpeg streaming and motion using clunky commands via ssh, but at least the Pi is ready for action sooner after it boots than the main box!

what next?

If this configuration is successful this year, I may find the enthusiasm next year to rationalise the design. It would be good to link the two Pi boards via USB and blend the video into a single stream, with the two images side-by-side. I could then run with a single wifi dongle and extend battery life.

Anyway, that won't happen this year. The next step, while I wait for a suitable plastic enclosure to arrive, is to continue testing the software.


  1. Could you give a link to the 78B5.0 voltage regulator that you used please?
    I've been attempting to figure out how to combine both 12v and 5 feeds to power pi (5v) and LED array (12v).
    Incoming voltage is either 48v (this is what comes down poe), or 12v (stepped down from poe).
    I have tried one of those step down 'buck' things to drop down from 48v to which I broke :(. Your solution seem to be a lot neater & compact.

  2. Hi NestBoxTech, I bought the last one from Amazon:

    But the cheapest now seem to be RS (not sure about P&P):

    Also check Rapidonline and Farnell.

    I use the 1A version (R-78B5.0-1.0), there is also a 1.5Amp version (R-78B5.0-1.5). Do check the max input voltage, but both are OK with 12V.

    I hope this helps.