Main Content

Beehive Monitoring with Theft Prevention (GPS)

Motto: If All The Bees In The World Die, Humans Will Not Survive

My goal was to address the remote monitoring of a beehive (nevertheless the solution could be used for any kind of remote monitoring and data logging). Beehive monitoring is quite unique as there are certain limitations which must be taken into account as beehives are usually located in nature which means that:

There is no electricity source - the power consumption matters

There is no connectivity and even GSM signal is often not available

Beehives are a subject of robbery (eighter because of the honey inside or because of the bees and beehive itself)

This is why I decided to use the combination of Sony Spresense board and Sigfox network as the reliable data carrier to build a solution which fulfills all the basic requirements on remote beehive monitoring.

So how does it look like?

The prototype consists of the Sony Spresense board responsible for all the computing and detailed data logging to SD card, BME280 sensor responsible for temperature, humidity and atmospherical pressure measuring, GY MAX4466 microphone module with amplifier responsible for noise level monitoring and finally Sigfox modem responsible for the data transfer.

Beehive monitoring with theft prevention (GPS)

Sensors are recursively requested to provide the data and the result is stored to SD card each one minute. Each 15 minutes is the data sent over Sigfox too.

1 / 2 Sony Spresense, BME280, GY MAX4466 (focused)

Let’s have a closer look at the data now.

Log file

After the boot checkes the sketch for the existency of log file. It is created if it is not found and the header row is prepared. New log is appended each minute. The file is in a simple CSV format.

CSV log file taken directly from SD card and opened in Notepad

It can be easily converted into Libre Office Calc (or MS Excell, Google tables,…) spreadsheet so it can be easily analysed.

Log file opened in Lebre Office Calc for analysis

Device monitors the level of noise and each minute records the minimal, maximal and average values of the noise level detected. This could help the beekeeper to predict some events like swarming.

Sound level analysis from log file

Also the weather related values - temperature, humidity and atmospherical pressure - ale logged each minute.

Temperature, humidity and atmospherical pressure analysis from log file

Well, such logs are nice for analysis but are accessible only after the monitor is taken out from a beehive and data from SD card are transferred to PC. To solve this I engaged Sigfox modem. Sigfox network allows to transfer up to 120 messages daily (= one each 15 minutes with some contingency we need for theft alert messages) each of the size up to 12 Bytes. Plenty of bandwidth right? :-)

To save the space I am sending integer values only (and a bit coded to fit in 1 Byte each). The data message has following format:

a1::uint:8 t1::uint:8 v1::uint:8 p1::uint:8 s1::uint:8

a1 - 1 for Data message , 2 for Theft Alert message

t1 - temperature (actual temperature in degrees of Celsius +50. I just hope there wont be less than minus 50 C ;-).

v1 - relative humidity in % - as it varies from 0 to 100 % there is no need to extra code it.

p1 - atmospherical pressure (actual pressure in hPa diminished by 885 so the average (normal) pressure of 1013 hPa is transferred as 128 giving enough space to higher and lower values).

s1 - sound level

There is also a special Theft Alert message which is sent each time the GPS position of the beehive changes significantly (the treshold can be set by a variable). It has a bit different format:

a1::uint:8 la::float:32 lo::float:32

a1 - 1 for Data message , 2 for Theft Alert message

la - last known Latitude

lo - last known Longitude

These messages are transferred over the Sigfox network and captured in Sigfox backend.

Messages as received in Sigfox backend

Sigfox backend allows to define custom callbacks - simply the data are extracted from the received message and sent to desired location in desired format. I am using REST API to receive the data on the server so the data are encoded as GET in URL form (just to be easily readable - it could be changes to POST easily).

Example of custom callback from Sigfox backend

Sigfox backend allows to define more than one callback so I am using extra callback for data message and extra one for Theft Alert message.

Two different custom callbacks from Sigfox backend

Data are currently stored at iTRUBEC (iDRONE) server and visualised on this page:

http://itrubec.cz/cs/2-itrubec-cz/28-sony-spresense-sigfox-based-beehive-monitoring

In case REST API receives Theft Alert message it immedialelly alerts the owner via SMS sent via SMS over e-mail service:

Theft alert SMS (screenshot from mobile)

In parallel it sends and e-mail with the last known position of the device…

Theft alert e-mail with last known GPS position

…so it could be easily located on the map:

GPS position from the above Theft alert visualised on map

Issues

As well as my colleagues in the discussion related to the contest Make it better with Sony I experienced that the GNSS become to be unusable when there is SD card inserted to the slot. With SD card in it does not fix the position even outdoors. It takes several minutes to get the correct time - oscillating between 0 and two satelites.

This means that the user must decide if to collect the detailed log or omit logging and use the Theft alert & location function instead.

I hope this “feature” will be fixed in next release of the board as is really lowers the value of it.

What next?

As my work on the field of beehive monitors is never to be finished I would like to extend this prototype with a bunch of additional sensors, collect the data from a number of beehives during the year and analyse them using IBM Watson analytical capabilities.”

Link to article