Aside from tinkering with computers, Stephen B Kirby loves to watch birds perching in his garden, but he can’t always be around to see them. To get around that problem, he devised a Bird Feed Monitor powered a capacitive touch sensor and a camera. As Raspberry Pi projects go, it has proven to be a real feather in his cap.

Retired civil servant Stephen B Kirby worked in the medical industry for 30 years and he particularly enjoyed the roles that involved computer programming, saying it scratched a creative itch.

The idea was born from an earlier, similar project which made use of an Arduino Yún. As one of the first non-shield WiFi Arduinos, Stephen says it was perfect for the task of counting and timing the visits of the birds at his feeder. “It performed the job well for a long period of time,” he tells us.

Stephen wanted to go further, however. “I decided to use more than one Raspberry Pi computer to create an interactive network of devices to perform specific monitoring tasks,” he says. “I wanted this project to detect the birds on each perch and use an integrated Raspberry Pi camera for photographs. Most importantly, I added a Raspberry Pi MQTT broker to control, monitor, and store the data for the project.”

This article was written by David Crookes and first appeared in The MagPi issue 85. Get a free Raspberry Pi with a 12-month subscription to The MagPi in print.

Capture photographs of birds with Raspberry Pi

Three Raspberry Pi devices are utilised

Any plastic or wooden-perched bird feeder is suitable

MQTT communications are key to the project

Current weather conditions are monitored via DarkSky

The software only works with a Raspberry Pi Camera Module

Using MQTT to store data

MQTT is a lightweight messaging protocol for Internet of Things deployments, and one of its key benefits is an ability to scale. “MQTT is versatile and it can handle multiple bird feeders, cameras, or other Internet of Things devices because it has an ability to communicate with a wide variety of hardware,” Stephen explains. Using MQTT also enabled him to move away from storing data in a spreadsheet on Google Drive.

“The MQTT server […] requests and stores data from the Bird Feeder Monitor, controls its operation, and activates the monitor at dawn and shuts it down at dusk. It also controls the timing interval for requesting data, and it monitors and records the current weather conditions.”

Using a touch sensor to photograph birds in the garden

When a bird lands on one of the feeder’s perches, it activates a capacitive touch sensor connected to Raspberry Pi Zero W via a CAP1188 breakout board. The data is then sent to and stored on a MQTT server on a Raspberry Pi 3B+, starting a timer to determine how long the event lasts.

At this point, a MQTT message is published by the Bird Feeder Monitor’s MQTT server telling the Camera Module (connected to a third Raspberry Pi) to take a photo. A note of the number and time of the perches is made along with the local temperature, humidity, cloud cover, wind speed, wind gust, and wind direction. The photos of every feathered friend are stored on the Raspberry Pi and they can be managed remotely.

The box contains a Raspberry Pi Zero W device with power taken from an underground wire from Stephen’s garage up the pipe post. Within this weatherproof box is a CAP1188 turnkey capacitive touch sensor. Stephen is exploring whether it could even ascertain the size of the bird.

Pecking order

So far, the results have been surprising. “I initially thought I would witness some sort of routine spikes of feeding,” Stephen says. “For example, I thought we would see a large spike in the morning and another spike before dusk, but we discovered that birds are hungry all day long. Secondly, birds treat my six-perch bird feeder like a buffet. They fly on to one perch and then proceed to hop from one perch to the next. Many of the birds make a point to circumnavigate the entire feeder, but it means the bird counts are inaccurate.”

Even so, it’s something Stephen intends to work on. He’s also hoping Cornell University, which publishes the Merlin bird-identifying app, will create an open-source Linux version. “I’d love to be able to auto‑identify the birds,” he says. “Maybe that will happen someday.”

See also: