Nowadays, bees are more and more threatened, by predators or even by their environment (pollution, climate change). Thus, the use of connected hives is exponentially increasing. The goal of this project is to assemble a system that monitors a beehive's activity. This system has to be autonomous and reliable to allow apiarists to look after their apiary from the comfort of their living room. It will have a dashboard and will be able to send alerts by mail or SMS, thanks to LPWAN (Low Power Wide Area Network).
ConstraintsThe main constraints of the project are :
- Requirements on the data
- Internal temperature, with an accuracy of 0.1°C
- External temperature, with an accuracy of 0.1°C
- Multiple temperature sensors for more precision
- Thehive's weight, with an accuracy of 100g
- The battery state, with an accuracy of 1%
- Humidity sensors inside and outside ofthe beehive
- Environment luminosity
- Daylight time perday
- Being autonomous
The system has a battery, that shouldberecharged thanks to a solar panel.
- Low consumption
The system has to be energy efficient, to match with the previous point and last the longest possibletime beforeneeding recharging.
- Being able to switch the system on and off
It is mandatory to add a button to be able to switch the system on or off, whenever necessary.
- A Built-In LED has to be lit at the start of the system
To show that the system hasstarted correctly, the built-in LED has to be lit wheneverthe system is turned on.
- Data must be sent every 10 minutes
- Datamust be sent using the Sigfox module
- Datamust be received on Ubidot STEM
Firstly, we needed to place the system in a hermetic box. Every electronic part except from the sensors will be placed inside. This includes the microcontroller, the battery and the TPL timer.
We had to pierce holes in the box to pass the cables through. We also sheathed our cables to prevent damaging them during their usage. Another hole was also drilled to add the on/off switch.
We used a template to 3D-print a little box covering the external humidity and temperature sensor, to protect it from rain and wind, as for the internal one, we just covered it with a little tissue, to avoid it getting damaged by bees' wax or honey.
Inside the box, as previously mentioned, we put the microcontroller, the LiPo rider with the battery and the TPL timer. Holes were drilled through a cardboard at the bottom of the box and we screwed the electronic parts on it. The switch is linked directly to the battery which can be charged via the solar panel, using the LiPo Rider. The output of the battery then goes to the TPL timer which controls when the card has to be on or off. This microcontroller card is powered when the TPL allows the current to pass through, which corresponds more or less to 15 seconds every 10 minutes.
Use of the modules- Sigfoxmodule
The Sigfox Wisol module allows the system to send data to the Sigfox backend, which then sends the data to a cloud computing system: Microsoft Azure. To visualize the data, we must have a dashboard. We started off on Ubidots STEM to visualize data, then moved to the Beep App, an app which gives us the ability to create dashboards optimized for bee monitoring. To reach these dashboard, Microsoft Azure sends two requests, one for Ubidots and one for the Beep app.
- TPLTimer
This module is a timer used to switch on and off the Arduino microcontroller to optimize energy consumption. When you put a resistor on the 'Delay' output, the value of the resistor determines the time the TPL will wait before cutting off the current. The TPL then powers the 'DRV' port with the voltage it has on input. To resume the cycle and cut the power, the microcontroller sends a signal in the input port 'Done' to inform the TPL it finished gathering and sending data, so that the TPL can finally cut the power off, and so on.
We used the TPL module, because as said earlier, we need to be on very low consumption and the fact that the TPL cuts the power off periodically leads to a much lower power consumption and as such, a more autonomous system.
- LiPo Rider Module
This module acts as a bridge between the battery and the solar panel. It allows the voltage given by the solar panel to be lowered and usable to charge the battery without burning it.
Explanation of the codeBefore starting explaining, you can find the source code and some archives of it in the GitHub repository. In the 'ReadMe.md', you will find the necessary tools and tips to modify or run the code by yourself.
Link to the repository : https://github.com/noah-maupu/projet_hive
Firstly, we start the code by initializing every global variable and opening all the needed libraries.
Then you will find the 'setup()' function of Arduino Code, where you define the used pins of the Arduino Card, Within this function, we also start and scale our different sensors like the DHT22 or the Weight Sensor that you have to tare. As mentionned, you also switch of the Built-In LED 3 seconds after the start of the code.
Right after that, we enter the 'loop()' which is considered as a 'while' loop with a certain amount of delay. Within this function, we call every function allowing gathering datas from sensors. To shorten it, each of these function update the associated variable (for ex. : 'getWeight()' will update the variable 'weight'). Right after these update, we create the payload, object sent thanks to the SigFox Module to the backend, described as a 12-byte long data, represented as 3 integres (an integer is 4-byte long). These integres will be created thanks to the global variable updated and stored in integers with bit shifts. Then after the construction of this payload, we send it thanks to SigFox command, and sending the payload. We then put a 10 seconds delay to be sure every data are sent to the SigFox backend, then we set the TPL 'Done' input to 'HIGH' to stop the power output of the TPL and trigger the 10 minutes cycle in which the Arduino is off.
We don't need to keep track of our global variable as they are stored on the SigFox backend and the next variable are independant of the previous ones.
Comments