(I'm updating it now.. honest.. tap tap .. tap tap tap).
After a foray into bird-box ownership with a big brother camera I did some analysis of the bird activity in the nest using the times of the frames saved by the motion detector (guess what, they move about more in the day-time than in the night-time) and wondered how I could get more monitoring into the box, and lo, along came the Raspberry Pi.
Raspberry Pi is a small fully functional computer which costs about £30. Even better, you can easily connect switches, lights, relays, cameras and all manner of external goodies to it.
So what could I do?
The Raspberry Pi is small enough to fit into a specially designed bird box, so what data could I try to collect?In the end I decided on:
- Nest, outside, and processor temperatures
- Weight of nest and occupants
- Nest-box light level
- Visit rate
- Video
- Stills
- Sound level
I was going to add extra sensors to monitor the weather but instead I bought a weather station. Much simpler. It's mounted on the garage roof and even has its own website www.broken-drum.com
The weather station data collection and processing is run on another Pi, running Cumulus MX software, sited close to the station.
A quick explanation of the mess shown above. It's evolved a lot since the early days.
On the left is the back of the bird-box with a wireless access point in the flat box above. The white spikes are to discourage pigeons from indulging in aggravated perching.
On the right you can see the side and front of the bird-box (with blue-tit sized hole) and an external camera on the gantry.
The wooden bits
Normal bird-boxes are a simple design and can't accommodate the electronics I had in mind so a new design was required.It needed to have two compartments, one for the nest and one for the electronics.
I also wanted the cameras to be slanted to the nest floor, rather than directly overhead, and add a window to improve images in daylight. I made the window opaque to remove temptation from the local feline population.
For years birds have been reluctant to move into the box. There's been a few nest building attempts, one notably stopped by a large bee moving in and claiming the nest. I tried rotating the box by 90 degrees so that it faces north into some bushes but that didn't help. I've also moved the bird feeders to another part of the garden.
Last year (2024) I moved the box to outside the garage where there was more cover. Last year was still fruitless but this year (2025) there's success! A brood of ten eggs!
Ignore the camera in the top, it's from an earlier design, but this photo shows the box layout. It is finished off with a front, with entrance hole, and a side covering the electronics. Both are screwed in place for ease of access.
The electronic bits
Originally I used a breadboard for some of the electronics so that I could quickly re-design the sensor circuits. I've now replaced them with hard-wired versions.
The main electronics are mounted on a removable plastic board gleaned from a DVD case.
Top left is a Raspberry Pi 3B and an ADC (Analogue to Digital Converter) board.
Top right is a reed relay and components to switch an IR lamp on and off. It's driven by a GPIO pin on the 3B. Another GPIO pin controls the IR filter. I have two separate pins because the filter has a time lag of a couple of seconds. Software in the 3B takes care of that by delaying the lamp operation.
Bottom left is a diode pump circuit to measure sound.
Bottom right is a Raspberry Pi ZeroW. It is connected to a camera module and acts as an IP camera.
In the middle is the UBEC (Universal Battery Eliminator Circuit) which is a DC to DC step down voltage regulators used to power both Pis. It is fed by the 12 volt supply from the house to provide the 5 volt needed by the Pis.
Warning - It would not be safe to use the UBEC to power the Pi Zero on its own. I've a couple of dead Zeros to prove it. Pi Zeros do not have any voltage protection circuits, unlike the As and Bs, and I believe that they cannot handle the spikes and ripple that occur on a low loaded UBEC. Having the 3B also powered by it seems to provide enough load to calm the supply - End of warning.
Raspberry Pi
They come in a number of flavours, model A, model B, and Zero.I tried a model A with a wireless dongle but that proved too flaky (that's a technical term) because of the distance from the house to the box so I then went for the model B and a long network cable. I've now replaced the model B with the later 3B. I've also added a Raspberry Pi ZeroW to deal with the internal camera. The ZeroW is wireless which brings us back to the flaky problem so I've connected the network cable to a wireless access point near the box which also services the 3B, via a network cable, and some wireless Pi based IP cameras around the garden.
I control and program the Pis from any of the PCs on my home network using a combination of PuTTY and FileZilla.
Power
The bird-box is attached to a fence about 5 metres from our utility room (of builder-cam fame). I didn't want to run mains voltage out there. I'd probably end up with frazzled chicks. To power the Access Point, Pis and sensors I need +5, +12 and -12 volts. An old PC power supply can provide that and mains cooker cable is beefy enough to have acceptable voltage drop over that distance. I've suspended the power and network cables on a wooden gantry to keep them out of the way.I originally powered the Pi from the 5v supply but it suffered from instability so I've replaced it with a local UBEC running off the the +12v supply. It powers both the 3B and the ZeroW.
Analogue to Digital Converter (ADC)
The Raspberry Pi has digital inputs but no way of reading analogue signals. I'm using the ABElectronics ADC board which simply plugs into the Pi and gives 8 separate 0 to 5 volt analogue inputs. I need those for reading some of the sensors.Temperature
I decided to monitor the temperature of the nest and the temperature outside the box to see how cosy the eggs get.I also need to check the temperature of the Raspberry Pi to see if there's any danger of overheating on hot days.
The nest and outside temperatures are measured by a pair of Analog Devices TMP36 Voltage Output Temperature Sensors, and a couple of operating system calls measure the Raspberry Pi CPU and GPU chip temperatures.
Weight
Could I monitor the weight of the nest, chicks and parents?The weight will bounce around a bit when there's activity in the box but I might be able to get some data in quiet periods.
I estimated the maximum weight of birds and nest would be about 250 grams so chose a 500 gram load cell and a INA125 Instrumentation Amplifier to get the signal to a sensible level for the ADC board.
It is mounted on a false floor in the nest.
Light
How does light level in the box affect activity? Do the parents like dull days or sunny ones?After toying firstly with light dependant resistors and then calculating average values from the camera I've settled on a TSL2591 lux sensor which provides both visible and IR values.
Visits
Can I detect visits to the box without upsetting the birds?Originally I fitted a micro-switch just below the top of the entrance hole which was then triggered by a bird squeezing into the box. It was a bit hit and miss and was eventually pecked to death by an enthusiastic blue-tit carrying out DIY on the hole.
I replaced it with an IR LED and IR sensor pair across the hole. I encased them in plastic to protect the delicate bits. A bird entering or leaving the box breaks the IR beam and triggers a pulse to the Pi.
Sound Level
Chicks can get a bit noisy in the nest so I've fitted a sound level sensor consisting of a Maplin KJ44X microphone module and a simple transistor/diode/capacitor peak level detector.Cameras
The original design used an infra-red CCTV camera in the box to give live feed and stills for the web and allow me to check up on progress, and a Raspberry Pi Camera Module which took high definition stills and videos under software control.The Pi camera ran on the model B and had to be managed to avoid it interfering with the sampling of the ADC. I've now got a dedicated Pi ZeroW handling the visuals. It runs RPi-Cam-Web-Interface which provides streamed video for the web, motion videos, time-lapse images and stills via a web interface. I've used an IR lamp and and IR camera with an IR filter switch to give good daytime and night-time images. The filter and the IR lamp are switched at dawn and dusk by the 3B Pi. I tried to use the lux sensor to switch the filter and lamp but the lamp altered to light level making it difficult to find suitable switching levels. I may revisit it later.
I've since added another camera that shows a closeup of the hole from the outside. It also is driven by a Pi ZeroW which I've piggy-backed onto the first one.
The camera, IR lamp, and Lux sensor are mounted on a plastic board which slots into the top of the bird-box.
Top is the camera and IR filter.
Left is the IR lamp. The camera came with two IR lamps powered by the camera supply. I didn't need two lamps and wanted to switch one on and off so I removed one lamp and rotated the other to allow a separate power source. The blue-tack covers a sensor which would normally activate the IR lamp depending upon light levels.
At the bottom is the lux sensor giving visible and IR light levels.
This is what confronts you when you take the side off.
The white holey things are power rails and in the bottom right is a circuit board for the weight and entry hole electronics.
The programs
Python seems to be the language of choice for the Raspberry Pi so I've gone with that. I've used programs gleaned from the tinternet as a starting point. They are all still evolving.Box sensors
The program takes samples of the sensors at regular intervals and store them in a file, together with a time-stamp, starting a new file each day.Entry/Exit
The program waits for the beam to be broken and saves the time to a daily file. I've programmed it to send me an occasional email when a bird ventures into the box.Data Analysis
I needed to automatically combine the daily box and weather data and create graphs for this website. (see the Data Plots menu option). If I used the bird box Pi for that it would probably interfere with the data collection so I've set up yet another Pi in the house to handle the processing (I hope you're counting Pis, I'll test you later).The processing program uses the numpy package to collect the previous day's data and then uses the matplotlib package to create the plots and save them as a graphic file. That file is then sent to the website. This happens just past midnight via a cron job.
(If that last paragraph sounded gobbledygook then welcome to my world)
A separate program takes the entry data and creates a clock graph to show entry time of day against date.

