Open Engineering
Environment and Development.

Arduino Data Logger for Beehive

This page describes a Beehive Data Logger that I developed to measure the hive weight and two temperatures (from a probe inside the hive and of the external ambient temperature). It records the measurements in a file on an SD card using the CSV format which is easy to load into a spreadsheet. It can also send results in an SMS message. The data logger achieves very low power by switching off between measurements. Depending on how frequently it takes readings and sends an SMS, it should be able to run for several months from a fully charged 250mAh rechargeable PP3 battery. There is also a button cell used by the clock circuit which should last at least a year.

In addition to this page, there are further details about the data logger here.

Design

The Beehive Data Logger system consists of:

Hive with Data Logger: (1) Prototype Installed; (2) Schematic.

The Electronics

The electronics consists of:

If you don't want to make a PCB, you could build the circuit and mount the modules on strip-board (Veroboard); this is what I did for the prototype. You could also prototype using a plugboard.

The Hive electronics, mounted in a plastic box with transparent lid.

The sensors are:

Operation

The data logger achieves very low power by switching off between measurements. The alarm function of the Real Time Clock DS3231 is used to wake up the unit. The power to the Arduino is controlled by a flip-flop comprised of two NAND gates. This bistable is flipped into the Power-ON state by any of three events:

The Arduino is able to flip the bistable into the Power-OFF state via output D4, when the program wants to put the unit into sleep. The RTC is powered by its own button cell, like a watch. The flip-flop power-up circuitry consumes only microamps from the main 9V battery.

The Circuit

The circuit was designed in KiCad and a PCB laid out (the "Hive PCB").

To understand how to use KiCad, see the brilliant series of several Youtube videos starting with An Intro to KiCad – Part 1: How PCBs Are Made | DigiKey There are 10 videos that take you through the whole process: essential viewing!

The PCB gerber files generated by KiCad were sent for manufacture to Chinese company JLC PCB who made 5 copies of the PCB for under in £10 total. Had I used surface mount components, they could also have populated them.

The Software

The software is a single Arduino file. It makes use of standard libraries for the SD Card, the RTC, the HX711. The SW has two functions: (a) For a log (woken by the RTC alarm), carry out the measurements, record them to SD and if due, send an SMS; (b) When woken because the user pressed the push button, make and display measurements and provide a simple User Interface that allows the user to check the current configuration settings, adjust the clock, re-calibrate the sensors and send a test SMS.

The way that the logger operates (frequency of logs, etc.) is controlled by a configuration file on the SD card. This file has to be edited by removing the SD card from the logger, plugging it into a PC and using a text editor. It can only be viewed, not edited, on the Logger itself, as editing with just a push button as input would be too hard. Also there is almost no space for additional code on the Arduino, the program already being large.

Results

There are two ways results are obtained from the Logger:

SMS Message Format

The SMS messages have to be very brief in order to fit in the 160 character SMS limit. The illustration shows a real message received. Below is the content of a message sent at 14:00 on 21st October:

Hiv2 B7.6V
dd hh:mm  kg  Ext Int
20 18:00 11.08 14 32
20 22:00 11.08 14 31
21 02:00 11.08 14 30
21 06:00 11.08 14 30
21 10:00 11.08 13 29
21 14:00 11.08 15 29

The first line shows a 4-character (max) Hive ID "Hiv2", followed by the battery voltage "B7.6V". The battery voltage is provided so that you can tell when the battery may need replacing.

The second line is the column headings for the data rows. These are:

The remaining 6 rows are the data. These are retrieved from the LOG file.

SMS Received from Hive.

Using the LOG File

To use the LOG file copy it to a PC. You can view it in a text editor (like Microsoft Notepad); normally a text editor will open it automatically if the extension is .TXT

You can also open the LOG file in a spreadsheet like Excel. The easiest way to do this is to make the file extension .CSV (if it isn’t already, so the filename will be LOG.CSV) and then click on it. When Excel opens the CSV file for the first time, it is likely to ask how you want to import the columns. Select the DateTime column and choose Date YMD. The DateTime should now be in the first column of the spreadsheet and you will be able to generate graphs with DateTime as the X-Axis.

If you record measurements frequently (e.g. every hour) you will be able to see the hive weight change as the bees leave in the morning to forage and return with nectar, and the drop in weight during the night as they consume stores. When the brood box contains larvae, you can also observe the very steady temperature of about 33C that is maintained in the brood chamber. Some example graphs obtained from our hive during the summer of 2020 are below.