HoneyPi.
Introduction
HoneyPi is a smart beehive scale for do-it-yourself construction, based on the single-board computer "Raspberry Pi".
Sensors measure the weight of the beehive as well as other variables such as temperature, humidity and air pressure and can be visualized live on the Internet, e.g. on a smartphone. At defined
events, e.g. a swarm exit, a message is sent to the smartphone.
This IoT ("Internet of Things") device is an open-source project, so that the system can be flexibly expanded as required, e.g. with a webcam.
Track hive weight live online and watch the bees collecting nectar
Here the measurement data of the hivecale can be followed live.
Mechanics
While the electronic components are in their way from China to Germany by post, the prototype of the mechanics around the load cell is slowly taking shape.
The scale rests over 4 metal angles on the two beams of the hive rack (outside in the picture for illustration). Since the measuring element and a large part of the "base" disappear in the hive,
only the plate is visible.
The weight is supported on the measuring element made of aluminium, which functions as a bending beam and has a strain gauge element on the upper side, which changes its electrical resistance
with the deflection.
The construction appears stable, nothing wobbles.
Initial start-up on 07. April 2019
In the meantime, all essential components have arrived from China, and the test setup is working in the laboratory (at the desk).
Yesterday, just in time for the cherry blossom, the start-up took place at the apiary: the mechanics of the hive scale are mounted under the hive in a barely perceptible way. Power is supplied by
an old car battery, whose charge is hopefully maintained by a solar module via a charge controller even during bad weather phases.
The electronics are provisionally set up using a "breadboard", i.e. the components are mostly connected "flying" via plug cables and housed in an old plastic box that is halfway
weatherproof.
The measurement data (currently weight, temperature honey room, temperature and humidity outside) are uploaded to the cloud via mobile radio.
The measured weight curve still seems implausible to the garden beekeeper. Here probably still a troubleshooting is necessary.
Calibration of the load cell on April 8 2019
The curve of weight and outside temperature suggests that the load cell has a significant temperature drift, i.e. the measured value is falsified by an unwanted temperature influence. At a
measuring range of 200kg, the temperature drift appears to be approximately 3kg or 1.5% per 8°C. This is clearly too high for use as a hivescale.
The new firmware V0.1.0 provides a temperature compensation. To calibrate the linearization of the measuring cell and the temperature compensation, two 15kg dumbbell weights were placed on the
scale and measured for one day. A temperature range of 3°C to 21°C was covered. At two points in time, measurements were made with 15kg and 0kg. Subsequently, the parameters offset, slope and
temperature coefficient were adjusted using the EXCEL solver.
First measurement results on 19 April
The prototypical setup of the hivescale provides first plausible measuring results and thus interesting insights into honey production:
- During the night, the bees thicken the nectar that was collected the day before. Water leaves the hive by exchanging the humid air from the inside for dry outside air. Thereby the weight decreases by 250g.
- Between 8:00 and 10:30 a.m. numerous bees leave the hive to go on a collection flight. The weight decreases by 1.25kg.
- From late morning until dusk is the main flying time. Bees leave the hive permanently and return again. Due to the nectar input the hive weight increases steadily.
- In the evening between 17:00 and 19:00 the weight begins to increase even more, because now numerous bees return to the hive and only a few leave it. The weight gain is slightly more than 2kg per day.
Assembly of the electronics on 28 April
The prototype with its "flying cabling" is already loading exciting measurement results into the cloud. However, the structure is susceptible to loose contacts.
Temperature and humidity inside the plastic box have nothing to do with temperature and humidity outside. Interestingly enough, the inside temperature increases significantly compared to the
outside temperature in bright light, even when the box is completely in the shade. The ventilation holes do not change this, but they do allow insects to colonize the box and misuse it as a
nesting box.
The current firmware V0.1.0 contains some enhancements compared to V0.0.4, but the program module used to read in the load cell gives useless results. After the corresponding module from V0.0.4
has been implemented in the program code, the measured values are plausible. The garden beekeeper hopes that this software error will be fixed with the next version of the firmware.
Meanwhile, the final assembly of the measuring electronics is being built in the garden beekeeper's playroom: It is to be placed in an old medicine tin.
Waterproof plug connections are used to connect the sensors. A push button is used to activate the maintenance mode, but it must be "unlocked" by a key switch. When the maintenance mode is
activated, the Pi establishes its own WiFi access point and the automatic measurements are suspended until the maintenance mode is left.
However, some small parts are still missing to complete the box. The way from China to HeilbronX is long...
Housing
An old medicine box is used as a housing.
In maintenance mode the Pi builds up a WiFi access point, which can be used to connect to the smartphone to modify the configuration. The key switch activates the possibility to put the Pi into
maintenance mode. The maintenance mode is activated by a key switch. An LED indicates the active maintenance mode.
The sensors are connected to the Pi via waterproof connectors.
Honey Room Sensor
The DHT22 sensor measures temperature and relative humidity. The sensor is placed in a queen cage in the honey room.
An array of temperature sensors for the brood chamber
The temperature sensor DS18B20 supported by the HoneyPi firmware uses 1-wire. Thus, a multitude (>100) of sensors can be operated on only one single signal line. The sensor itself is a cent
article.
The temperature sensor has 3 connectors. Several of these sensors can be connected in parallel, so that all sensors use the same power supply and signal line.
The plug connection was made from 2.54 mm standard pin headers by connecting the pins of each of the 3 rows of 12 pins. This allows each individual sensor to be plugged in for easy maintenance.
The connection of the sensor array to the Raspberry Pi is also made by such a connector with only 3 lines.
Unfortunately, with the free-of-charge ThingSpeak account you can read in a maximum of 8 channels only. For this array of temperature sensors this is not enough. If the HoneyPi firmware would
support multiple ThingSpeak channels, this would be possible. The garden beekeeper is eagerly waiting for the corresponding extension of the firmware.
Since firmware version 1.0 more than one ThingSpeak channel can be written. Thus the representation of a temperature profile from thermocouples in each of the 11 honeycomb gaps could be
implemented.
Since mid-April 2020 it is possible to observe how large the breeding nest is at the moment, which should be especially interesting during the cold season.
Single temperature sensor
As long as uploading to multiple ThingSpeak channels is not supported, the array of temperature sensors cannot be used. For this reason, a single DS18B20 sensor is connected to the input.
Cable routing at the hive
The cables are routed from bottom to top on the outside of the hive. They are held by self-adhesive clips. The cables are led into the prey via a notch on the top of the incubator and honey room frame. When removing the frames, the clips must be opened.
Visualization of measurement data with ThingSpeak
ThingSpeak offers a very easy way to integrate visualizations into your own homepage. This is done with the help of so-called widgets, which are called with a line of code.
The result can be seen on our site under the menu item Hivescale.
A detailed description of the procedure to create these graphics has been published by the garden beekeeper on the HoneyPi site.
Linearization of the load cell using the EXCEL solver
On the HoneyPi homepage a simple procedure for determining the linearization of the load cell is provided. Two different known weights are placed on the load cell and offset and slope are
determined. Additionally, a temperature compensation can be activated.
Considering the fact that the measured value of the load cell may vary considerably, an identification of the parameters offset, scaling value and a temperature correction value based on a larger
number of measurements is desirable.
The parameters should be determined in such a way that the linearized values are as close as possible to the true values. Ideally, the range of measured values should cover the entire working range of the stock scale, as indicated in the following figure.
Getting suitable calibration weights should generally not be a problem: The garden beekeeper borrowed dumbbell weights for this purpose. The situation is different with setting the temperatures,
this would require a climate chamber, which most beekeepers probably do not have. So the practical alternative is to use the temperatures that occur naturally outdoors by placing the calibration
weights on the scales on a cold day in winter and a hot day in summer and possibly on a few moderate days in the transitional period, and taking a few measurements each time, ideally running a
day-night cycle for each weight level.
It is obvious that this procedure involves a large number of individual measurements and that this process takes several months. This results in certain requirements for the Excel calibration
sheet.
In the Excel sheet, each individual measurement is entered in a row, or imported via the ThingSpeak data import.
- Column A contains the temperature measured at the load cell.
- Column B contains the weight displayed in maintenance mode or transferred to ThingSpeak or to the CSV file. If no values for offset, scaling value, temperature correction factor and temperature during calibration are stored in the HoneyPi (offset = 0, scaling value = 1, temperature correction value = 0), the raw value is displayed here.
- In column C the actual weight is entered.
- Columns D to G contain the values offset, scaling value, temperature correction factor and temperature at calibration that are active during the measurement.
The following columns contain calculated values:
- Column H contains the recalculated raw value of the load cell.
- Columns I and J contain the linearized weight without and with temperature compensation, calculated on the basis of the optimized parameters entered in the range O2 to R2. The formula is:
- Column K contains the deviation, i.e. the difference between the linearized and the true weight.
- Finally, column L contains the square error, which is summed up in cell O4.
The 4 parameters are optimal when the mean square error is minimal. If you have a lot of patience you can modify these values until you think that the square error cannot be minimized any
further.
The Excel Solver does this work for you. It is an Add-In that comes with Excel, but may need to be activated first via File -> Options -> Add-Ins -> Manage. After activation, it can be
accessed via the menu bar in the "Data" -> Analysis section.
First the start values for the parameters are entered in the spreadsheet:
- Offset: positive value (for example, 100)
- Scaling value: e.g. 1
- Correction value: positive value (e.g. 100)
- T0: any, e.g. 20°C
Now the target is defined, in our case this is cell O4. Then the variable cells to be adjusted are specified, usually the cells O2 to Q2.
The reference temperature in cell R2 can be chosen arbitrarily and does not have to be determined by the solver.
Finally, the solution method is selected, whereby "GRG nonlinear" is recommended, and the "Solve" button is clicked.
It has been shown that this algorithm does not reliably find the best solution. Therefore it is recommended to repeat this procedure several times and if necessary with different starting values.
The following table shows an example for a "reasonable" solution.
By recalculating the active parameters during the measurements, the balance can first be roughly calibrated, and this calibration can then be gradually refined as new measurements are available.
To be continued...
There are no comments yet.