Introduction: Beehive Connected


As part of the second project in the fourth year of our training course entitled Electronics and Industrial Computing Engineering Cycle at Polytech 'Paris-UPMC, we have to carry out a project on a Connected Hive. For this project, we were supposed to form a group of 4 students, in view of the complexity of the project and the time to spend there. However, we decided to form a group of 3, motivated students who have already worked together to meet this challenge and compensate the work that a fourth element could have done in our group, by our goodwill and our motivation.

Our project consists to improve the capacities of a beehive by adding sensors to allow a beekeeper to obtain different information about his hive. Weight, temperature, humidity and position sensors will enable the beekeeper to have a view with distance of the beehive without hindering the beekeeper from performing his work properly, and without hindering the bees' work. Moreover, the system must be autonomous, and the beehive must be mobile.

The various sensors will be installed in the following way:

- Weight sensor: the hive will be placed on a scale

- Humidity and temperature sensors: they will be placed in the hive

- Position sensor: it will be placed in the waterproof case which is placed on the hive.

The data sent by these sensors will be processed by a microcontroller and then sent via the SigFox network (which will be explained later) on a platform online. This is so that they can be exploited in order to display charts and graphs illustrating the variations in weight, temperature and humidity, and the position of the beehive.

Climatic constraints: A hive is supposed to be placed outdoors, and can be confronted with the various changes in climatic conditions and therefore it could be affected by bad weather such as rain, hail, snow but also by strong temperatures. That's why we must protect our electronic circuits, using a waterproof box for our system.

Throughout this instructables, we will show you how to create your own beehive connected, ours codes are accessible on this post.

Step 1: ​STEP 1 : Materiel Needed

- Microcontroller :

• Arduino UNO

- GPS :

• Base Shield Grove

• Grove Cable

• Module Seed 113020003 + SIM28

- Humidity and Temperature Sensors :

• DHT22

- Weight Sensors

• Basic Scale with its 4 load sensors

• Load Combinator SPARKFUN

• HX711 Load Cell Amp

- SigFox :

• Akene Shield with Sigfox Module TD1208

- Actoboard

  • An account specific to our sigfox module

Step 2: STEP 2 : Temperature and Humidity Sensors

The DHT22 is a probe that allows the temperature and humidity to be measured with an Arduino board. It is powered between 3V and 5V input, the humidity is read in percentage with an accuracy of 2% and the temperature of -40 to 80 degrees with an accuracy of 0.5 degrees.

The DHT22 has 4 pin, only 3 are used

From left to right of HX711 :

• The 1st is the alimentation, connected to the 3.3V pin of Arduino UNO

• The 2nd is the data pin, connected to pin 13 of Arduino UNO ( in our case)

• The 3rd is not used

• The 4th is the GND pin connected to the GND pin of Arduino UNO

For extracting data from the DHT22, you have to use a library called DHT, available on Sparkfun's website and other free-source websites. You have to modify the data pin (in our case it is the pin 13 but by default it is the pin 2).

This library has two functions which allows it to recuperate Temperature: dht.readTemperature and Humidity: dht.readHumidity.

Step 3: STEP 3 : Weight Sensors

In the first step, you must get a basic scale to extract the 4 strain gauges, simply by disassembling it. In addition, the Sparkfun Load Combinator, which is used as a Wheatstone bridge, allows it to measure low variances of resistances from the 4 strain gauges in order to have at the output of the load combinator a voltage which varies in function of the force exercised on the 4 strain gauges.

Next step is that you have to solder the pins on different load combinator holes (locations are meant for that purpose), then solder the various wires of the strain gauges using the following color code:

• C : Red wire

• + : White wire

• - : Black wire

(No need to solder the RJ45 pins, SIG, GND, 5V of Load Combinator ).

Then, according to the color codes written on the components you have to connect the Sparkfun HX711 module, which allows to amplify and manage the information received by the load combinator.

The pins from HX711 have to be connected with Arduino UNO's pins in the following way :

- VDD and VCC with the 5V pin of Arduino UNO

- GND with GND pin of Arduino UNO.

- DATA with pin 3 of Arduino UNO

- CLOCK with pin 2 of the Arduino UNO

As for the code, the HX711 library is available online with codes allowing us to perform the calibration of our scale, first by posing an object of known weight on it and varying the variable "calibration-factor", until the balance returns the right value. Once the calibration is done, the scale will return the right weight of any object posed on the scale.

In a second step, when the code is initialized, the scale will do a "tare"; it resets to zero, this is so it doesn’t take into account the weight of the hive, but only the variation that will happen with the production of honey by the bees.

Step 4: STEP 4 : Position Sensors

At first you must connect the base shield Grove to the Arduino UNO by embedding it. Then, using a Grove cable, connect the Seed + Sim28 module in one of the slots. (In our case we connected it in slot 6).

Once connected and powered, the gps module sends you several frames under the NMEA standard. We are only interested by the $GPGGA frame.

Using the TinyGPS library, you can retrieve the GPGGA frame and extract the latitude and longitude, to display them in the terminal first and then send them via the Sigfox network in a second step.

To do this you need to specify the pins used according to your wiring, in the function gpsSerial of your code. In fact, in our case we chose pin 6 for RX and pin 7 for TX.

Step 5: STEP 5 : Sigfox Network + Akene Module

SigFox is a French company founded in 2010 that builds wireless networks to connect low-energy objects, which needs to be continuously turned on and emitting small amounts of data. Sigfox employs a technology that enables communication using the Industrial, Scientific and Medical (ISM) radio band which uses 868MHz in Europe and 902MHz in the US (available worldwide without licenses). It utilizes a wide-reaching signal that passes freely through solid objects, called "ultra narrowband" and requires little energy, being termed "Low-power Wide-area network (LPWAN)". The ISM radio band supports bidirectional communication. There is a standard for Sigfox communications: supports up to 140 messages a day, each of which can carry an amounts of 12 Bytes.

For this project, you can use an additional panel called Akene Shield which integrates a sigfox module (TD1208) and an antenna. Each Akene Shield purchased gives you access to your data on the Actoboard platform. We will discuss about this topic in the next step.

There are many libraries for Arduino components, and their shields, available for free on the Internet. This is why you don’t need to write a Sigfox communication protocol by yourself, you only need to use the functions already defined in the library to communicate via the Sigfox network.

First, you must change the serial pins that you use to connect Akene Shield with your Arduino UNO. As you can see on our code, in our project, we put pin 5 for TX and pin 4 for RX.

Finally, in your main file, you have to create a void function (we called it getHumTempCellLoadGPS in our project) which will be used directly to transfer all the data coming from the sensors of the connected hive. In our case, Humidity, Temperature in Celsius, Weight, Latitude and Longitude are the data sent.

The process of sending the data requires converting each data into hexadecimal, using the “akeru.toHex()” function, and then putting them into several "string" variables. We will be able to concatenate them and put them into a single variable "string" which will be named "data" that will be transmitted via the Sigfox network.

Step 6: STEP 6 : Actoboard Platform

As said previously, each Sigfox module has a unique number written on the card and a PAC number. To receive the data, you have to create an account on Actoboard platform and then enter your numbers, to configure the connection.

To create widgets and graphs with your data, you need to describe its format. The "data format" field uses a text syntax consisting of space-separated "data slots". These slots can be of type:

• int and uint, resp. unsigned and signed integer on 8, 16 or 32 bits

• float floating point values on 32 or 64 bits

• bool for simple boolean bits

Each slot is defined using the syntax {slot name}::{slot type}:{nb bits}.

In our case, we have 5 data named :

• Hum (int 16)

• TempCel (int 16)

• Poids (float 32)

• Latitude (float 32)

• Longitude (float 32).

To display your data in a charts, you have to create a new dashboard and add some widgets. And then you have to choose the type, the data source and the data set for each widget. Finally you have to define a display time scale.