How to Build an Electronic Bee Counter

Turns out you can measure the capacitance of a bee

Bees are important: they pollinate dozens of crops, including almonds, cacao, and coffee. While there has been a lot of attention paid to Western honeybees owing to colony collapse disorder, this specific disease and others like it are really measurable only once a colony collapses. And in any case, honeybees are not the only important bee pollinators. What we need is the ability to measure and monitor bee activity as it happens.

Historically, such monitoring was the purview of undergraduates armed with clipboards. More recently, optical sensors have allowed for the automatic detection of bees entering and exiting the hive. But placing optical sensors in a habitat of pollen, mud, and other hive debris drastically degrades their effectiveness. What if there was a better way?

A solution suggested itself when the two of us—a field applications engineer for Analog Devices and an amateur bee enthusiast—were working together on a previous project that involved capacitive sensing. Teachman (the bee enthusiast) commented to Perrault (the applications engineer) that the sensitivity of the AD7746 [pdf] capacitance-to-digital conversion chip was better than he had expected, and wondered, “Do you think we could measure bees with this?” All else being equal, the capacitance between two electrodes depends on the dielectric constant of the substance between them. Air has a dielectric constant of roughly 1, while water comes in at around 80. As living cells are mostly water, a bee should have a detectable dielectric signature. Intrigued by the idea, we developed a custom sensor setup to measure just that.

We concentrated on Mason bees, which are important pollinators (of fruit trees in particular). Unlike honeybees, these bees are solitary types: Every female works alone to build a nest and lay eggs. They build their nests in tubes, such as a reed or a hollow twig, and it’s typically one bee to a tube. Starting from the back of the nest, the bee fills the tube with a series of cells, laying one egg in each cell. The egg is then sealed in, along with food in the form of pollen and nectar.

Previously, a group at the University of Prince Edward Island, in Canada, had used a capacitive sensor to measure bees transiting a hive entrance. But we realized that Mason bees’ nesting preferences provided the opportunity to monitor activity inside their homes, as well as their entrances and exits. We would turn each bee’s entire nest into a capacitive sensor.

We placed two 1.27-centimeter-wide strips of copper tape on either side of a 13.5-cm-long, 1.27-cm-diameter acrylic plastic tube and sealed it at one end. We had already connected the copper strips to shielded leads. By instrumenting the entire tube, not just the entrance, we could measure how active bees are within their nests, along with information about the material they bring in to construct cells.

Using some blocks of wood, we housed eight of these instrumented tubes together, and placed Mason bee cocoons on top of the blocks to ensure that the empty nests would be rapidly colonized once the bees emerged.

One AD7746 chip can handle two channels, so we mounted four on a custom breakout board and connected it to an Arduino microcontroller using the I2C serial protocol. We gathered information about local light levels, temperature, humidity, and pressure by using the Adafruit TSL2561, MCP9808, HTU21D-F, and BMP180 sensor boards, which we also connected to the Arduino via I2C. The Arduino logged data and relayed it to an SD memory card every 10 seconds, and we also sent data via a second, Wi-Fi–enabled Arduino to SparkFun’s free cloud service. The total cost of the electronics was around US $200.

Converting the raw capacitance data into meaningful information about bee activity was the big challenge. For starters, over the course of 24 hours there are large swings in the baseline capacitance of the nests due to temperature and humidity shifts. Rather than trying to work out the exact impact of these shifts on the baseline from our separate temperature and humidity measurements, we simply blocked the entrance of one of the eight tubes to prevent its occupation. We then subtracted the baseline variations seen in the empty tube from the signal received from the other tubes. We also took video of the tubes and time-aligned it with the logged capacitance data to create a “learning” data set. This allowed us to be sure we were recognizing entrances and exits correctly.

As the bee brings material into the nest to build cells, it creates a permanent shift in the baseline capacitance of the cell. Although we’ve only just begun distilling the data, we believe it should be possible to determine not just the volume of material added to each cell but also details about the types of material involved (mud, eggs, pollen, and so on). As the bee moves about inside the tube, it also causes fluctuations in the capacitance. Together, this allows us to gauge how long the bees spend outside the nest, how active they are when they return, and how this changes depending on the time of day or other alterations in local conditions.

Through more rigorous analysis—perhaps by employing machine learning to process the data sets produced over the course of a year—it should be possible to predict how much pollen each bee is producing and the general health of the colony, and to better understand the dynamics of those important pollinators. During the next growing season, we plan to further develop the technology and see if it can be extended to other types of bees.

This article originally appeared in print as “Bee Counters.”