Bird box beginnings

Bits everywhere
Jack’s bird box has been kicking around for ages and I’d like to make use of it. He enjoyed making it, and I asked him and Annabel if they’d like to gadget it up a bit and finish it off by adding a night vision camera to keep an eye on any birds that may choose to nest, and painting, draft proofing, and attaching it to the house. Annabel really liked the idea.
I bought a load of cheap bits and Annabel put together a Raspberry Pi computer after I’d set up the Linux operating system on the micro SD card. She plugged all the parts together herself, including the Pi noir camera that doesn’t have an infrared filter, and powered it up.

Her first job was to test that the camera was working, which got her to type some commands into the terminal but within the GUI. We used raspivid to get an almost fullscreen video showing the video feed from the camera. It all looked a bit weird because of the lack of an IR filter, but it was working fine. She then got distracted by Scratch and ended up teaching herself how to program some commands and related them to key presses with very little help from me. She drew a Dalek and some explosions and thought it was hilarious when she got it to spin around and move forward using the arrow keys, giving her a massive giggling fit. How much fun is programming?
Scratch programming
The second job was to power down the Pi (which she insisted on doing herself) and then wire up an infra-red LED to 2 pins on the Pi’s GPIO (general purpose input output) pins. We had to have a look at the pins and a diagram to work out which were which, and add a resistor in the right place so we didn’t burn out the LED. She put all these bits together herself and then plugged the Pi back into the power to see if the LED lit up. Of course the infrared light was invisible to our eyes, but would be visible to the camera which can see infrared light.
Unfortunately my clumsy fingers pushed a couple of bare wires together followed by a burning smell. Oops. Annabel started up the raspivid software again and showed the IR LED to the camera but it couldn’t see any light. I think I burned out the LED. She shut the Pi down again and I gave her another IR LED to replace the broken one with. While she did that I grabbed some insulating tape and wrapped up most of the bare metal bits with tape so I wouldn’t make the same mistake.
Annabel powered up the Pi again, started up raspivid, and showed the new IR LED to the camera. Success! On the monitor the LED was really bright even though our eyes couldn’t see any light coming from the LED itself.
Infrared light!
We unscrewed the lid of Jack’s bird box and worked out how we were going to attach the camera and the LED to the inside of the lid. We need to light up the box without distracting the birds, get the camera at an angle that looks down on the nest, and check the focus. Using some more insulating tape and a bit of rolled up paper to wedge the camera to the correct angle (the roof is sloping) we could see into the box even in complete darkness. Awesome! But the objects we put into the bottom of the box were out of focus.
Testing with tape
The Pi camera has a little lens but it’s glued into place to give a focus point at some distance from the camera with a good depth of field. I was given the fiddly job of cutting away at the glue and then rotating the lens to adjust the focus. It took a while. When I got the lens to rotate we found that we could focus the camera really close up to just a few centimetres, and then we fiddled until we got it just right. We stuck it all back together, put a couple of Raspberry Pi boxes in the bottom of the bird box, stuck the lid back on and it all worked and the image was in focus. Great!
Bits hanging out but it works
That’s the point I wanted to get to today, and I wanted Annabel to think about what we might need next. I suggested using some teak oil to treat the wood of the box, and we’ll need some longer cables so that we can put the Pi inside the house and the bird box outside. We have to find a longish camera extension ribbon and I’ll sort out some wires and heat shrink tubing for the other bits. We’ll need some brackets to mount the bird box on the wall, and maybe a box for the Pi itself to keep it all neat. I think I might also design and 3D print a plastic box with a wedge to hold the camera and screw it into the inside of the roof of the bird box. I’ll also get Annabel to set up some software so that we can view the video remotely, and I have an idea about adding a PIR sensor and an LCD that will detect and notify of anything entering the box.
We’ve got a few jobs to do but we’ve shown that it works. All this has come from the “Infrared Bird Box” guide on the Raspberry Pi resources webpages. Annabel has learnt about wavelengths of light, electronics and electricity, controlling a computer from the command line, programs and programming. Not bad for a Saturday afternoon, eh?