Motivation

I have four little kids and a full time job, so I don't get out to the apiary as often as I'd like. I keep the hives healthy, but they do occasionally fill up most of their available space with nectar and slow down collection before I can get out there to add more boxes. This problem isn't unique to me -- any beekeeper with remote apiaries has to weigh the possibility that a sudden, strong nectar flow has filled up their hives against the time it takes to drive out and make an inspection. Measuring weight alone will eliminate this problem as I'll know exactly how much nectar is coming in and I can make a quick trip to add supers (honey collection boxes) when the nectar is flowing fast while spreading out my trips when the nectar is coming in slowly.

Additionally, NASA has a HoneyBeeNet program that relies on volunteers to manually record the hive weight every day so the local nectar flows can be correlated with satellite measurements of climate change and land use changes. Unfortunately, my hives are all installed at remote apiaries, and I can't visit them every day. 

I want to contribute to NASA's HoneyBeeNet program, save myself unnecessary trips out to the apiary, and frankly, I want to collect gobs of data from the hives to see what I might learn about easily detectable signs that something might be wrong.

First Prototype

I tried to document a lot of my work over the last couple years on my blog, hackerbee.com, although I'll repeat a more concise (and uninterrupted) version here with the massive benefit of hindsight.

First, I purchased a range of scales and started ripping them apart to see how I could get them to meet my needs. I was very new to hacking electronics at this point, so I thought it would be easier to connect to a cheap scale than to try to build a scale from scratch. Unfortunately, I ran into kept running into black potted chips on anything cheaper than the ADAMS CPWplus 200, which costs $163 at Amazon.

If I knew everything I've learned in the past 3 years, I would have gone a much different route from the start, but I finally settled on an CPWplus 200 scale. While it has a easily hackable serial interface, I found that the scale is designed to tare (zero) on powerup, and since I need to run the system at a remote apiary on a battery with solar, I badly wanted to turn off the scale between measurements!

Eventually, I gave up on turning off the scale and simply oversized the solar panel and battery to make up the difference. I added an Arduino Fio with XBee to stream the data back to Thingspeak.com over a nearby internet connection.

I successfully streamed data from a beehive to Thingspeak.com for about a week last spring before my buggy coding of the wireless connection started getting interrupted. Unfortunately, I didn't have the foresight to add an SD card to backup the data, and between life and work, I didn't have time to get it working again last year.

I knew that the load cells would be significantly sensitive to temperature, and this original data was quite noisy as I hadn't yet been able to calibrate the scale for temperature. Here's a sample of some data I collected while the system was working. I removed the temperature sensitivity with a regression analysis after the fact, so this data is somewhat questionable, but it shows what I expect to see once I've got a properly calibrated scale working.


Beehive Monitoring System Design

Here's my plans for the current beehive monitoring system. Instead of trying to rely on firmware that was designed for a postal scale and doesn't allow easy power management, I'll measure the load cells directly with a 24-bit ADC. The output of the HX711 ADC board will be read by the Apitronics Bee unit and, along with a temperature sensor inside the bee hive, sent to the Apitronics Hive that saves the data. I'll also be streaming the logged data to a cloud service so I can monitor my hives in real time!

I've chosen 200 kg (440 lbs) as a load limit for the scale to be somewhat higher than the weight of my beehives (200-300 pounds when full of honey). This will allow for headroom in case a box full of honey gets dropped a couple inches onto the hive. I'd probably switch to a 300 kg limit for a commercial beekeeper who might be less careful about bumps, but that would cut the resolution by 50% and I want to get the best resolution possible for my own systems. The load cells do usually have a safety margin of 150% rated limit, although this wouldn't necessarily apply to an unbalanced load on a scale with 4 load cells (i.e. bumping the hive on one corner) and they are much more sensitive to any lateral loading.

Generic Scale Design

All the postal scales I have purchased so far have 4 load cells, one at each corner of a square base (see above picture of my first prototype), or a single smaller load cell using a series of levers to repeatably reduce the load from the platform. I think this might give better resolution for light, decentered loads, and it'll work fine for a beehive as long as the entire hive isn't tipped onto one corner (overloading a single load cell). Long-term, I'd like to move to a single central load cell protected from too much tilting by a frame of square tubing like in the top left of the second page in this PDF. I've purchased some 200 kg load cells for this purpose, but I'd like to get a prototype working with a postal scale before I jump into welding! 

A weigh scale or postal scale will work well for now at a reasonable price, and I plan to use a $50 Weighmax UB840 as the weight sensor. If it doesn't work for some reason, I'll switch back to the ADAMS CPWplus 200 I used in my last prototype, although this will significantly increase the BOM since these scales cost over $150. If necessary, I'll go with the more expensive scale and work on reducing costs once everything is functioning!

Along with a load cell, I need an ADC to read the load cell output. These load cells are constructed using a Wheatstone Bridge circuit that senses deformation of a precisely-shaped metal bar with four strain gauges, two under compression and two under tension.

The load cells take a stable input voltage, usually 10V to ground (lower voltage works, but reduces the magnitude of the signal), and output a tiny voltage difference across the sense wires that can then be amplified or directly measured with a sufficiently sensitive ADC.

I previously tried to design a board that would measure the output of my load cells directly using an MCP3551 24-bit ADC from Microchip, but I got stuck in PIC programming when I failed to read back the reading from the MCP3551 even though I could pick up the signal with a logic analyzer. I should note that Microchip has a truly incredible app note (AN1030) on using their 24-bit ADC in a weigh scale that is a great read for anybody interested in the details of scale design!

This time, I'm going to take another step back, and use a pre-built breakout board for the HX711, designed specifically for load cells in scales. I suspect the 5V limit of these chips will limit resolution, and I may have to swap out some resistors if I want to drop the working voltage to 3.3V (further limiting resolution), but both the chip and the board are well documented, so it will not be difficult to make changes.

If anything, I expect the temperature sensitivity of this HX711 to be higher than I'd like, especially since I don't really know the details of the chip's amplification circuit, but again, my plan is to get this working ASAP and characterize the temperature sensitivity of a working prototype before diving into an improved version.

Since the scale is going to be sensitive to temperature, it's important to have a temperature sensor on, or as close to the load cells as possible for accurate compensation. I'm using a waterproof temperature sensor from Sparkfun, but any temperature sensor should work, mounted inside the scale. You could probably get away with simply sensing the ambient air temperature and get a reasonable compensation, but there are so many reasons the scale temperature could deviate from the air temperature. For example, direct sunlight could heat up the hive and scale above the air temperature,, sudden cold wind could cool the air temperature faster than the shielded scale, or even insulation from snow around the beehive can keep the scale warmer than the surrounding air.

Logging the Data -- The Apitronics Platform

I've put SD cards onto Arduinos before, and I've demonstrated a working (if buggy) way to transmit data from a hive to a nearby internet connection and up to the Cloud, but I'm really excited to use a system from Apitronics (a Kickstarter project I backed last year and shipped late June 2014) that collects remote data with a custom, open-source (hardware and software) "Arduino-compatible" board and sends the data via XBee radio to a BeagleBone Black that I can place inside a garage for logging and streaming data to the web. A page roughly describing the system can be found here.

Given that the Apitronics transmitter units are open source, it should be possible to reproduce their functionality with an Arduino Fio and various breakout boards (SD Card, RTC, charging circuit with batteries). However, given that I'm very time-constrained and I've struggled for 3 years to produce far less than Louis and Hao (at Apitronics) accomplished in 6 months, I'm going to run with this open source solution! 

The system works as shipped to meet my datalogging needs, but the code is still being regularly updated on github. Confusingly for my honeybee hive application, Apitronics calls the Arduino-compatible transmitter a "Bee" and the BeagleBone Black datalogging receiver a "Hive" and rather than try to use quotes every time I mention one of these units, I'll just keep referring to Apitronics Bees and Apitronics Hives.

Here's a picture of the inside of my Apitronics Bee unit:

Here's a shot of the BeagleBone Black that serves as the Apitronics Hive:

To collect the data, the sensors  simply communicate with the Apitronics Bees via serial or I2C interface using widely available Arduino libraries (except for the weight, I'll probably write some messy bit-banging code to read the 24-bit ACD).

Weather Station

There are a lot of weather stations out there, and it's pretty simple to connect temperature and humidity sensors to an Apitronics Bee to provide a basic log of weather conditions. Even a log of rough estimates of current weather conditions in your zip code from the National Weather Service is probably good enough for later correlation with in-hive data.

That said, the Apitronics Kickstarter included a weather station option, and while I COULD try to justify measuring wind speed and direction and rainfall at my apiary, I'll just admit that I can't resist collecting more data. The bees won't fly much in rainy, very windy, or very cold summer weather, but while I think tracking temperature and humidity may be interesting to compare to overnight weight loss rates to see how weather affects honey curing (evaporation of water from the nectar), addition weather data beyond that available online s probably overkill.

This project uses a second Apitronics Bee transmitter and solar panel so I can install the Apitronics weather station a few dozen yards from the beehives without running a long wire, but again, it would be easy to track temperature and humidity using the same Apitronics Bee for data transmission as the scale.

Open Source Software and Hardware

Aside from the repurposed load cells mounted in a postal scale, all the hardware and software I've used is open source.

The Apitronics Hive is simply a Beaglebone Black (itself open source with links to schematics and code available here). The Apitronics code is maintained in a Github Repository here.

The Apitronics Bee is a custom, open source board. The schematics are available here, and the firmware is maintained in a public Github repository here.

I will certainly be making my modifications to the Apitronics Bee and Hive open through Github, although I haven't started on that yet.