Intelligent_Agriculture_System_Based_on_LoRa_and_Qt_Technology

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Intelligent Agriculture System Based on LoRa and Qt Technology

Liu Jing1, Yao Wei1


1. College of Electrical Engineering, Zhejiang University, Hangzhou 310027
E-mail: 21710155@zju.edu.cn

Abstract: In order to solve the problems of low collection efficiency and high labor cost for the growth environment
parameters of traditional agricultural greenhouse crops. And solving the problem of using Zigbee communication
technology to cause short transmission distance and easy interference. This paper integrates commonly used LoRa
wireless network technology and QT technology to design a new intelligent agriculture system. The system uses LoRa
communication module as the communication core, and use the widely used STM32F103 development board as a
controller of the sensors and execution, the host computer program developed by Qt receives the data, visually display
them, and processes them, this system realized timely monitoring and timely decision-making on the agriculture
greenhouse.
Key Words: Intelligent Agriculture System, LoRa, Qt, TDMA

by SEMTECH. It is based on linear spread spectrum


1 INTRODUCTION technology and it’s working frequency range is below 1Ghz.
Environmental parameters of crop growth, such as It can solve the problems of long distance communication,
temperature, humidity, and the light intensity, natural strong anti-interference ability and low power consumption
changes in these parameters will influences the crop growth, required by current intelligent agricultural system[7]. The
reducing the crop yield [1]. In traditional agriculture key features and advantages of LoRa are shown in Table 1:
greenhouse, these parameters need to be collected manually. Table 1: Key features and advantages of LoRa.
If the area of agriculture greenhouse is relatively large, that
means, more data points need to be collected. In this case, Key Characteristic Advantage
not only the labor cost is high, but also the real-time and 157db link-budget
Long distance
effectiveness of the data is difficult to ensure. With the Distance>15km
continuous development of technology, agriculture Low infrastructure costs
Can use gateways to expand Easy to build and deploy
production has begun to become intelligent. Especially the
system capacity
emergence of the IOT technology, various intelligent
Unauthorized frequency band
agriculture systems have begun to appear. For example, Low node cost Low cost
literature[2] proposes to apply agricultural information Low infrastructure costs
management technology to agriculture production
decision-making, but in this paper, only the wireless sensor Therefore, this paper aims to combine the current IOT
network is added to the system for data collection, but a technology with a variety of sensors to collect data in
complete system is not given. Literature[3] proposes an agricultural greenhouse, using the ARM core stm32 series
intelligent agriculture system based on GPRS. It need to MCU (microprogrammed control unit) as the control core,
build a gateway and pay the frequency band. The cost is too using LoRa technology and Modbus embedded network,
high and it is not easy to promote. literature[4] proposes an design an intelligent agricultural system based on LoRa and
intelligent system based on Zigbee technology, which solves Qt technology. The system can timely and accurately collect
the problem that the environmental parameters need human the environmental parameters of agricultural green houses,
collection. However, due to the short transmission distance and can operate the equipment in the greenhouse in time
of Zigbee technology and it is easy to receive interference according to the needs, adjust the environmental parameters
from others frequency bands, which leads the intelligent of the agricultural greenhouse, and keep them in the
agriculture system based on Zigbee technology can not have prescribed state to meet the growth and development
a large-scale development. As an emerging IOT technology, requirements of crops and realize intelligent production, this
compared with the traditional wireless communication system has a good prospect of promotion.
technologies, LPWAN (Low Power Wide Area Network)
has the advantages of long transmission distance, low power 2 SYSTEM ARCHITECTURE
consumption, low cost, and large coverage capacity.
This system consists of three parts: sensors acquisition
Currently LPWAN include LoRa, SigFox, LTE-M,
control system, LoRa wireless network system and host
NB-IOT, Weight-less[5]. NB-IOT is standardized, rigorous
computer monitoring system.
and standard, but LoRa is more open, flexible and
customized[6].LoRa is a modulation technology introduced

978-1-7281-0106-4/19/$31.00 2019
c IEEE 4755

Authorized licensed use limited to: Indian Institute of Technology Palakkad. Downloaded on May 29,2024 at 04:13:25 UTC from IEEE Xplore. Restrictions apply.
The sensors acquisition control system mainly includes two including two I2C interface, three the UART interface and
parts: acquisition and control (or execution). The two SPI interface[8], can accommodate multiple sensor data
acquisition part is composed of a variety of sensors, such as and access to the LoRa module. Development board shown
a temperature and humidity sensor. The collected in Figure 2:
temperature and humidity data is transmitted to the LoRa
NRF/SPI
module through the serial port or the general IO port. And UART1
the LoRa RF module is directly transmitted to the LoRa
master node through the LoRa network. The control
(execution) part is directly connected to the LoRa module
by the 485 bus-based Modbus salve device, and is USB/POWER
connected to the master node through the LoRa wireless
network.
SWD
LoRa wireless networks are primarily used to convey I2C
information in the system. The sensors transmit data such as
GPIO
temperature and humidity to the STM32F103 control chip
through I2C or general-purpose IO port. The LoRa wireless
network system includes the master node and the sub node.
MCU will package the received data and some protocol Fig 2. Development board.
information specified by the system, through the SPI
3.2 Sensors
interface, call the function (spi write ()) to write the data into
the transmit buffer (FIFO) of the LoRa module. The LoRa In actual agricultural greenhouse, we need a variety of
module sends the data to the master node in the specified sensors to measure environmental parameters.in this paper,
frequency band and the specified time period. Realizing we use light intensity sensors, soil moisture sensors and air
wireless transmission of data from the sub-node to the temperature and humidity sensors to illustrate.
master node. Digital light intensity sensor (BH1750FVI) ˖mainly used to
In order to make the environmental parameters more measure the light intensity in the greenhouse. Using the
intuitive, in this paper, using the Qt crater software to design standard I2C bus transmission mode, the acquisition range
the upper computer operation interface, the machine is 1-65535lx, the connection between BH1750 and STM32
interaction becomes more intuitive and convenient. The is shown in Figure 3.
running process is as follows: the LoRa master node sends VCC
the data to the Qt program interface of the PC. After
receiving the data frame sent by the master node, according VCC

to the address information and sensor information contained


in the data frame, the Qt program performs some necessary
SCL
data conversion operations, the data is displayed in the
corresponding display frame of the upper computer. The STM32F103
SDA BH1750
MCU
architecture of the system is shown in Figure 1.
I2C
STM32F GND

actuator GND
Sub node 1

Fig 3. Connection between BH1750 and STM32.


Sensor A
STM32F
Soil moisture sensor (XH-M214): mainly used to measure
Sub node m Sensor B the relative water content of the soil. Adopting the four-wire
communication mode. When the humidity is lower than the
STM32F
set value, the DO port outputs a high level, when the
Master node humidity is higher than the set value, the DO port outputs a
Sub node N low level. The analog output port AO is connected to the
STM32F Sensor C
ADC interface of the STM32, and more accurate soil
moisture can be obtained by AD conversion. the connection
Fig 1. System architecture. between XH-M214 and STM32 is shown in Figure 4.

3 SENSOR ACQUISITON SYSTEM

3.1 STM32F103
STM32F103, produced by STMicroelectronics, a 32-bit
microprocessor with ARM-cortex-m3. It has many
general-purpose IO port and nine communication methods,

4756 The 31th Chinese Control and Decision Conference (2019 CCDC)

Authorized licensed use limited to: Indian Institute of Technology Palakkad. Downloaded on May 29,2024 at 04:13:25 UTC from IEEE Xplore. Restrictions apply.
VCC chooses LoRa wireless network to form information
VCC
transmission system, and establishes information
connection with sensor control system and upper computer
system.
PB5
DO 4.1 LoRa Technology
ADC/PA1
AO LoRa (long range) is a kind of LPWAN communication
STM32F103
XH-M214 technology. It is an ultra-long range wireless transmission
MCU
GND technology based on spread spectrum technology adopted
and promoted by SEMTECH, the original signal of the user
GND
data is XORed with the extended coded bits to generate a
stream of transmitted signals. This modulation allows the
Fig 4. Connection between XH-M214 and STM32. bandwidth of the transmitted signal to be increased, so that
the signal can be transmitted over longer distances, and
Temperature and Humidity sensor (DHT11): mainly used to LoRa operates in an unlicensed spectrum, the working
measure the temperature and humidity of air. Using single frequency band is generally 433,868,915Mhz, and the
bus bidirectional serial communication protocol. the construction of the network can be more flexible and
connection between DHT11 and STM32 is shown in Figure controllable.
5.
VCC 4.2 Nodes and Networking
VCC In this paper, the LoRa module ra-01 produced by AnXinKe
technology. It is selected as the LoRa sub-node and the
master node. the Ra-01 module uses SEMTECH’s sx1278
R1 device. Supply voltage is 3.3v, bandwidth is 125k,
STM32F103
spreading factor is 12, load length is 64 bytes. In the sleep
MCU
DATA DHT11
mode, the FSK modem can switch to the LoRa modem via
the configuration register RegOpmode[10].
GND Considering that the applicable scenario is an outdoor
GND
agricultural greenhouse, the distance of the nodes used
generally does not exceed the transmission distance of LoRa
point to point, so there is no need to use a relay node.
Fig 5. Connection between DHT11 and STM32. Moreover, the environmental parameters of agricultural
3.3 Controller greenhouse will not change much, the number of nodes used
in small and medium-sized agricultural greenhouse is not
The controller part is a variety of devices that can be much. Considering the above applicable scenarios and
configured with the Modbus protocol, such as exhaust fans, combining the cost, this paper only needs to select a typical
hot fans, plant lights and mirrors, to control the water supply star network to meet the requirements, that is, each sub-node
system, temperature and humidity control system and communicates directly with the master node.
auxiliary lighting system in the agriculture greenhouse to LoRa has a low transmission rate, which will lead to long
achieve the purpose of adjusting various environmental channel occupation. In a typical star network composed of
parameters. In this paper, a networked thermostat (VN4013) LoRa, data collision between nodes needs to be considered.
is connected to the device via the RS485 bus. the connection Generally, there are two types of solutions, competition and
between VN4013 and STM32 is shown in Figure 6. LoRa time division multiple address (TDMA). The competition
Module is based on STM32. mode is flexible and simple. Before the nodes sends data, it
L detects whether the current channel is idle, if it is idle, it
N directly sends data, if it is not idle, it will be detected after a
delay, until the channel is detected to be idle, and the
number of detections increases, and the delay time is set to
be longer[11]. In the case where the applicable environment
VN4013 FAN LORA
Module
is an agricultural greenhouse, the competition mode is not
applicable. The agricultural greenhouse uses more network
D+ 485R+ nodes. In the competitive mode, the channel will be very
D- 485R- busy, which will increase the probability of data loss due to
data collision. While long-term channel detection will lead
Fig 6. Connection between VN4013 and STM32. to increased power consumption. TDMA allocates an
4 LORA WIRELESS NETWORK SYSTEM independent time slot for data transmission for each node
within a certain period of time. If the node does not belong
In order to meet the long-distance communication to this time slot, communication is not performed[12].
requirements of intelligent agriculture systems, this paper

The 31th Chinese Control and Decision Conference (2019 CCDC) 4757

Authorized licensed use limited to: Indian Institute of Technology Palakkad. Downloaded on May 29,2024 at 04:13:25 UTC from IEEE Xplore. Restrictions apply.
During other idle times, the node performs periodic Start Start
switching in sleep mode and channel activity detection
(CAD) mode. Sleep in sleep mode. Monitoring the network
Initialize Initialize
in CAD mode, in this mode, the master node needs to add a configuration configuration
long time preamble before the valid data. The duration of
the preamble must be longer than the sleep period of the
node. this will ensure that the data can be received. After the Receive data
MCU write data in FIFO
signal is monitored, if the data is sent to itself, it enters the
working mode. If not, it goes directly to sleep mode and Sava in FIFO
waits for the next wake-up. Combine the time interval of
LORA module
CAD mode with the TDMA timeline, as shown in Figure 7 send data
below. CRC Error
NO
T0 T1(Timesync) T2 (timeslot k) T3 (To Sub node j) T4 (timeslot j)
Host node YES

Sub node j
t DIO0 set high level
DIO0 is high level
NO

Sub node k
MCU read
FIFO YES

End End
Time points CAD preamble Payload
Fig 8. The process of transmitting (left) and receiving (right).
sleep Timeslot Single reception Working mode
5 DESIGN OF QT APPLICATIONS
Fig 7. The time interval of CAD mode with the TDMA timeline.
According to the needs of intelligent agricultural system,
As shown in Figure 7 above, at time T0ˈeach sub-node is in and in order to display the environmental parameters of
sleep node. at time T1. The master node sends time agricultural greenhouse more efficiently and intuitively, this
synchronization data (preamble + payload), at this time, the paper developed a smart agricultural human-computer
node is still in sleep mode. When the master node sends the interaction interface system based on Qt technology.
preamble for the duration of time, each node will enter the Including safe landing system, agricultural greenhouse
CAD mode. At this time, the preamble is monitored, and environmental parameter monitoring, control decision,
each node enters the single receiving mode, and after actuator control.
determining that the data is sent to itself, it enters the
working mode. After the work is completed, each node 5.1 Design of User Interfaces
enters the sleep mode again. At time T2, this time slot is In order to ensure the security and stability of the system,
allocated for node k under TDMA, at this time, the node j before entering the intelligent agricultural monitoring
maintains the original state, and the node k automatically system, a secure landing system was designed. Only the
transmits data (such as temperature) to the master node. personnel in the system database can enter the main
after the transmission is completed, it goes to sleep. At the interface and give them different management operation
time T3, the master node sends an instruction to the node j, rights. For example, only administrators can add or delete
and the node j detects the preamble and knows that the users. The interface design in shown in Figure 9 below.
information is transmitted to itself, so continues to receive
and enters the working mode. The node k detects the
preamble and finds that the information is not sent to itself,
discards the data and enters the sleep mode. At the time T4,
this time slot is allocated for node j under TDMA, at this
time, node k maintains the original state, but node j
automatically transmits data (such as humidity) to the
master node. after the transmission is completed, it goes to
sleep. This system has been circulating in this way.
LoRa needs to use its own data buffer FIFO to transmit and
receive data. The process of transmitting (left) and receiving
(right) is shown in Figure 8 below.
Fig 9. Secure landing system.

The main interface of the intelligent agriculture system can


display the illumination, temperature and humidity, and the
operating status of various control devices in the

4758 The 31th Chinese Control and Decision Conference (2019 CCDC)

Authorized licensed use limited to: Indian Institute of Technology Palakkad. Downloaded on May 29,2024 at 04:13:25 UTC from IEEE Xplore. Restrictions apply.
agricultural greenhouse. The specific interface design is ventilation purposes. Some of the parameters are shown in
shown in Figure 10 below. Table 2 below. T1 is the greenhouse temperature, T0 is the
suitable temperature for the growth of crops. And RH1 is the
humidity in the greenhouse, RH0 is the suitable humidity for
the growth of crops.
Table 2: Ventilation decision experiment parameters.

Types Start Conditions End Conditions


T1-T0 > 3°C T1-T0 < 1°C
Cooling RH1-RH0 < 8% RH1-RH0 < 8%
T1-T0 < 3°C T1-T0 < 3°C
Dehumidifying
RH1-RH0 > 8% RH1-RH0 < 5%
Cooling and T1-T0 > 3°C T1-T0 < 1°C
Dehumidifying RH1-RH0 > 8% RH1-RH0 < 5%
Fig 10. Intelligent agriculture system.
6 CONCLUSION
There is a calendar widget on the far left of the main The intelligent agricultural system studied in this paper
interface to view the date of the day. At the bottom of the adopts advance embedded development technology, LoRa
main interface, there are various node display combination wireless communication technology and Qt host computer
widgets, which can increase or decrease the number of technology to realize timely monitoring of crop growth
nodes according to the number of nodes used. On the node environmental parameters in agricultural greenhouse and
display widgets, the sensor data collected by each node can when environmental parameters are changed, this system
be displayed. For example, node 2 and node k, TEMP can have a timely action. It solves the trouble of manually
means temperature, RH means Relative Humidity, LI collecting data in traditional agricultural greenhouse, and
means Light Intensity. It can be seen that the temperature overcome the problem of long-distance communication and
and humidity data of node 2 and node k are not much anti-interference of intelligent system based on zigbee
different, but the light intensity is quite different. Because technology. With the continuous development and
an auxiliary light source is used at node 2. In the middle of improvement of the IOT technology, building such an
the main interface, there is a greenhouse device status intelligent system has a good applicable prospect.
display and operation widgets. It can be seen that the fan
device is the running state (the status light is green), and the REFERENCES
lighting device is in a stopped state (the status light is red).
[1] Y. Ma and J. Chen, Toward intelligent agriculture service
The device can be turned on or off by using the widgets on platform with LoRa-based wireless sensor network,2018
the right of the device status display. The location at others IEEE International Conference on Applied System Invention
to support extensions to add other devices. (ICASI), pp. 204-207,2018.
[2] D. Yan-e, Design of Intelligent Agriculture Management
5.2 Design of Decision System Information System Based on IoT,2011 Fourth International
The upper computer obtains each sensor status and each Conference on Intelligent Computation Technology and
control device data every 4 minutes (interval time can be Automation, pp. 1045-1049,2011.
[3] S. Li, J. Cui and Z. Li, Wireless Sensor Network for Precise
adjusted according to different applicable occasions), and
Agriculture Monitoring, 2011 Fourth International
updates to the user interface in time, then controls the Conference on Intelligent Computation Technology and
parameters according to the set conditions. Automation, Shenzhen, Guangdong, pp. 307-310,2011.
Taking the adjustment of humidity conditions as an example, [4] G. Sahitya, N. Balaji, C. D. Naidu and S. Abinaya, Designing
due to the evaporation of soil moisture in the greenhouse a Wireless Sensor Network for Precision Agriculture Using
and the transpiration of vegetables, the humidity in the Zigbee, 2017 IEEE 7th International Advance Computing
agricultural greenhouse is generally higher than that in the Conference (IACC), pp. 287-291, 2017.
[5] D. M. Hernandez, G. Peralta, L. Manero, R. Gomez, J. Bilbao
open field. For the growth of vegetable, the appropriate air
and C. Zubia, Energy and coverage study of LPWAN
humidity is 35% during the day and 83% at night. When the schemes for Industry 4.0,2017 IEEE International Workshop
humidity is higher than the set value, the upper computer of Electronics, Control, Measurement, Signals and their
sends a command to open the ventilation unit. Under the Application to Mechatronics (ECMSM), pp. 1-6, 2017.
action of the ventilation unit, the outside air can be [6] X. Zhang, M. Zhang, F. Meng, Y. Qiao, S. Xu and S. H.
introduced into the agricultural greenhouse to improve the Hour, " Low-Power Wide-Area Network Information
humidity environment. There are certain differences in the Monitoring System by Combining NB-IoT and LoRa,
requirements of various environmental parameters for in IEEE Internet of Things Journal, 2018.
different vegetable types, different seasons and different [7] L. Krupka, L. Vojtech and M. Neruda, The issue of LPWAN
technology coexistence in IoT environment,2016 17th
time periods. It is necessary to set scientific and reasonable
International Conference on Mechatronics - Mechatronika
ranges of environmental parameters such as temperature, (ME), pp. 1-8, 2016.
humidity and illumination according to different specific
requirements. Set different ventilation types for different

The 31th Chinese Control and Decision Conference (2019 CCDC) 4759

Authorized licensed use limited to: Indian Institute of Technology Palakkad. Downloaded on May 29,2024 at 04:13:25 UTC from IEEE Xplore. Restrictions apply.
[8] S. Sun, J. Ni and Z. Chen, The design of a DeviceNet - SPI [11] J. Lim and Y. Han, Spreading Factor Allocation for Massive
converter module based on the STM32 MCU,2015 IEEE Connectivity in LoRa Systems, in IEEE Communications
International Conference on Mechatronics and Automation Letters, vol. 22, no. 4, pp. 800-803, 2018.
(ICMA), pp. 843-847, 2015. [12] L. Tessaro, C. Raffaldi, M. Rossi and D. Brunelli,
[9] A. Lavric and V. Popa, Internet of Things and LoRaЯ Lightweight Synchronization Algorithm with
Low-Power Wide-Area Networks: A survey, 2017 Self-Calibration for Industrial LORA Sensor Networks, 2018
International Symposium on Signals, Circuits and Systems Workshop on Metrology for Industry 4.0 and IoT, pp.
(ISSCS), pp. 1-5, 2017. 259-263, 2018.
[10] Z. qin, Y. shenglong, Z. heng, C. xuesheng, Z. shengmao and
D. yang, Design and Implementation of Marine Temperature
Measurement System Based on LoRa,2018 International
Symposium in Sensing and Instrumentation in IoT Era
(ISSI), pp. 1-4, 2018.

4760 The 31th Chinese Control and Decision Conference (2019 CCDC)

Authorized licensed use limited to: Indian Institute of Technology Palakkad. Downloaded on May 29,2024 at 04:13:25 UTC from IEEE Xplore. Restrictions apply.

You might also like