Close

Foiled by Drivers!

A project log for Honeybee Hive Monitoring

Recording weight, hive temperature, and weather data toward better management and understanding of honeybees.

ken-meyerKen Meyer 09/21/2014 at 22:160 Comments

I've got everything ready to integrate. I should be able to just slip the HX711 board into a Apitronics Bee enclosure, and bogde has written a lovely, open source HX711 driver with examples here, but the Apitronics Bee firmware has drivers that simplify programming a bit TOO much. Back when I was taking C++ classes, this wouldn't be a problem, but I've forgotten too much to just slip a new sensor into the BeeCore firmware (even sloppily).

That's not the end of this project! I'm sure the Apitronics folks will help me get it working when they have time, and I could probably figure it out within 2-3 weeks on my own, but this might be as far as I get by a week from now, September 29, the Semifinal deadline for the Hackaday Prize.

I'm going to keep plugging away, and I'll update the rest of this project page to reflect my current progress.

In case anybody wants to help with the programming on short notice, I'll describe what I think needs to happen.

In the HX711 example (here) I want to use the function "scale.get_units(10)" to get the average of 10 measurements from the HX711 board. I think this function needs to be written into a driver, along with the definition of HX711.DOUT and HX711.PD_SCK using this function, "HX711 scale(A1, A0);"

The firmware on the Apitronics Bee will be a modified "BeeCore" and the HX711 driver needs to follow the form of the other sensors, for example the WeatherPlug.

The current code is as follows from BeeCore (I'll want to add a 3rd sensor, the HX711):

Sensor * sensor[] = {&onboardTemp, &batteryGauge};
Sensorhub sensorhub(sensor,NUM_SENSORS);
#define NUM_SENSORS 2

Finally, here's the code in void loop() that actually samples the sensors. It's been so simplified by the drivers that I can't just slip in a number at the end of an array. I really appreciate the programming work here, I'm just over my head trying to learn or re-learn (sometimes it's hard to tell which) how to modify it to do what I want.

//this if statement just samples
if( clock.triggeredByA1() || buttonPressed || firstRun){
Serial.println("Sampling sensors");
sensorhub.sample(true);
clock.setAlarm1Delta(0,15);

Discussions