Counting Bees With A Raspberry Pi

Even if keeping bees sounds about as wise to you as keeping velociraptors (we all know how that movie went), we have to acknowledge that they are a worthwhile thing to have around. We don’t personally want them around us of course, but we respect those who are willing to keep a hive on their property for the good of the environment. But as it turns out, there are more challenges to keeping bees than not getting stung: you’ve got to keep track of the things too.

Keeping an accurate record of how many bees are coming and going, and when, is a rather tricky problem. Apparently bees don’t like electromagnetic fields, and will flee if they detect them. So putting electronic measuring devices inside of the hive can be an issue. [Mat Kelcey] decided to try counting his bees with computer vision, and so far the results are very promising.

After some training, a Raspberry Pi with a camera can count how many bees are in a given image to within a few percent of the actual number. Getting an accurate count of his bees allows [Mat] to generate fascinating visualizations about his hive’s activity and health. With real-world threats such as colony collapse disorder, this type of hard data can be crucial.

This is a perfect example of a hack which might not pertain to many of us as-is, but still contains a wealth of information which could be applicable to other projects. [Mat] goes into a fantastic amount of detail about the different approaches he tried, what worked, what didn’t, and where he goes from here. So far the only problem he’s having is with the Raspberry Pi: it’s only able to run at one frame per second due to the computational requirements of identifying the bees. But he’s got some ideas to improve the situation.

As it so happens, we’ve covered a few other methods of counting bees in the past, though this is the first one to be entirely vision based. Interestingly, this method is similar to the project to track squirrels in the garden. Albeit without the automatic gun turret part.

Wired Hive Counts Bees, Keeps Them Cozy

The world has a bee problem. Honey bees are a major pollinator for all sorts of tasty crops, but an estimated one-third of all colonies in the US have vanished since 2006. These mass disappearances are collectively known as Colony Collapse Disorder, and everything from pesticides to global warming to a new bee virus has been blamed for bees going MIA. Regardless of the cause, keeping the bees that do remain alive and pollinating is important work, and an intelligent bee hive could go a long way toward that goal.

Normally, bee hives are a black – err, white –  box, where the bees go about their business without revealing much about it. While bees are amazing animals with an incredibly rich social structure that allows them to, for instance, team together to ventilate a too-warm hive with their wings, or gang up on invading predators, they have their limits, and knowing what’s going on in the hive helps the beekeeper to maintain an optimal environment. [Miguel’s] system, which appears to still be in the prototyping phase, aims to provide the beekeeper with data on temperature and humidity within each hive. GPS tagging allows the beekeeper to track where a hive is, which is important since hives are moved around as various crops begin to flower. The system can even keep track of the comings and goings of bees using photoelectric sensors; while [Miguel] doesn’t go into detail, we imagine that aspect working something like this bee counter we featured a few years back. And being from Portugal, [Miguel] has incorporated cork into the design of the hive, a sustainable material available locally and offering great thermal properties.

Sounds like [Miguel] is onto something here. The bees need all the help they can get, and anything that improves their husbandry will go a long way toward keeping the world fed. We’ll be watching to see where [Miguel] takes this system.

Hacking A Bee Hive


[Marc] created a self-contained monitoring platform that enabled him to record the temperature and humidity of his bee hives.’

The health of colony can be determined based on a few factors. One is temperature which is an early indicator of whether or not the bees are about to swarm. Once temperature spikes are noticed, the bee wrangler can take the necessary steps to reduce the chance of losing the hive to a neighbor. Another indicator of bee health is humidity. If the area is too damp, it can damage the hive.

With that in mind, [Marc] developed a system to alert him via SMS or email if the sensor readings go beyond a certain range. In addition, he monitored the weight of the hive to see how much honey is inside. Frequency of the buzz was also recorded, and so was the activity of the entrance. He used an Arduino Duo and a DHT22 temperature/humidity sensor. A solar panel powered the bee monitoring system.

There were some challenges that needed to be overcome. Initially the Arduino wasn’t sending out data, but that was fixed with a simple debugging session. From there, he was able to broadcast the information creating graphs with the data. Battery levels, temperature, and humidity were all recorded. With the bee hive hacked and monitored, [Marc] was able to make progress on his system making great use of an Arduino.