Implementation of a LoRaWAN Based Smart Agriculture Decision Support System for Optimum Crop Yield

: A majority of the population of developing countries is associated with agriculture directly or indirectly. The liaison of engineering technology and Sustainable Development Goals (SDGs) can build a bridge for farmers to enhance their skills regarding advancements through future generation agriculture trends. The next-generation trends include better soil preparation, intelligent irrigation systems, advanced methods of crop nutrient inspection, smart fertilizers applications, and multi-cropping practices. This work proposes a smart Decision Support System (DSS) that acquires the input parameters based on real-time monitoring to optimize the yield that realizes sustainability by improving per hectare production and lessening water seepage wastage in agribusiness. The proposed model comprises three basic units including an intelligent sensor module, smart irrigation system and controlled fertilizer module. The system has integrated sensors, cloud employing decision support layers, and networking based DSS to recommend cautions for optimum sustainable yield. The intelligent sensors module contains a temperature and humidity sensor, NPK sensor, soil moisture sensor, soil conductivity sensor, and pH sensor to transmit the statistics to the cloud over the internet via Long Range (LoRa) using Serial Peripheral Interface (SPI) communication protocol. Moreover, an android application has been developed for real-time data monitoring according to GPS location and node information (accessed remotely). Furthermore, the DSS contemplates the accessible information from sensors, past patterns, monitoring climate trends and creating cautions required for sustainable fertilizer consumption. The presented results and comparison validate the novelty of the design as it embraces smart irrigation with smart control and smart decision-making based on accurate real-time ﬁeld data. It is better than existing systems as it transmits the data over the LoRa that is an open-source communication with long-range transmission ability up to several kilometres. The sensor nodes helped in advancing the yield of crops, which resulted in achieving inclusive and sustainable economic goals.


Introduction and Literature Review
The economies of developing countries are mostly agricultural dependent. Although the rise of industry and manufacturing have created more varied economies, a significant portion of GDP is still contributed by mentioned agribusiness segment [1]. The developing countries have been subjected to agricultural goods for foreign exchange. A considerable the information in the system by employing the position according to GPS coordinates. This study recommends an innovative procedure of smart farming by involving smart sensing detection with an auto-irrigation system. Rehman et al. in [14] proposed a system that allowed excess water to be saved, which is commonly wasted when conventional methods are practised. Gutiérrez et al. [15] suggest an inexpensive and effective WSN system to obtain the temperature and moisture of soil at several locations. The study of Sarmadian et al. [16] presents a crop estimation by cropland mapping remote sensing techniques. It has discussed the applications extensively used in farming and horticulture. Furthermore, Sonka et al. [17], has proposed that remote sensing is compulsory as the supervision of agrarian actions face unusual complications that are not common to other commercial sectors. The yield rests on the physical land (e.g., soil nature) and climatically driven variables and agronomic supervision practices. All variables are exceedingly inconstant by atmosphere and time. Moreover, as yield can alter in a short time due to inauspicious growing circumstances, agrarian monitoring systems need to be accurate with time. This is even more important, as most of the equipment is delicate. Subsequently, an investigation in the agronomic zone in a study by Kim et al. [18] proved that the harvest of cultivating is deteriorating step by step. However, utilization of innovation in agronomy has a basic impact in developing the creation just as in falling the extra human energy and endeavours. A valuable portion of the examination endeavours is accomplished for the advantage of agriculturalists, which conveys the frameworks that utilization of modern technology for expanding the agronomic output. According to the study of Bor et al. [19], LoRaWAN is able to extend transmission limits as compared to conventionally deployed IoT communication modules, whilst at the same time with less energy usage. Furthermore, LoRa offers appealing characteristics as non-destructive synchronized communications. The LoRa module can be utilized in supplementary wide-ranging network systems, not just the only one used by LoRaWAN. Thus, the LoRa communication modules support a fascinating selection for developing conventional IoT functions. The article of Adelantado et al. [20] presents the extent of LoRaWAN by investigating the restrictions of the innovation, coordinating with them to application use cases, and expressing the open exploration challenges. The work also depicts that a LoRaWAN gateway covers a several kilometre range in wireless communication and serves the concept of Machine-to-Machine (M2M) connectivity. In further, system testing by Wixted et al. [21] recognized some significant factors that affect the usefulness of LoRaWAN. The unpredictability of the gateway's mobile network assignment and the use of User Datagram Protocol (UDP) between a gateway and network server means that sensor statistics and functional data about the networks are lost. The only remaining packet loss is around 1%. This might be credited to some long span (up to 10 s), wide-band (2 MHz) modulated signals pivoted around 868 MHz that is seen on a few events. The wellspring of this signal has not yet been distinguished. On various occasions, gateways are noticing demodulating simultaneous transmissions as planned. In the proposed system of Lakshmisudha et al. [22], a procedure to survey the use of remote sensor network utilized in mechanizing water system and data is shipped off the webserver through remote correspondence. The sensors are utilized to recognize the temperature and moisture for crop observation. The watering system is automated when the sensor detects beneath the limit values. The rancher is routinely intimated with the field climate. In fields, light power control can be robotized in the collection of the water system. Here, the gauge of harvesting water need is not proficient. The research of Dimitrios et al. [23], shows that the yield of crops can be increased by linking the crop model with the sensing node. It also presents a method to combine sensing node data with a crop model to measure the effect of climate change on crop yield. Moreover, the work of G.Hoogenboom et al. [24], presented a Decision Support System for Agrotechnology Transfer (DSSAT). This work presents crop management by using environmental data to develop a simulation for soil data response. The presented data is useful not only for research, but also for planning to enhance production. The article of J. W. Jones et al. [25], suggests improving the DSSAT system because it deals with specific crops and it does not account for the change in environment, the effect of pests, excess of water and many other factors. In the works of J.W. Jones et al. [26], the proposed system is not accurate or beneficial for big data. It comprises a DSSAT system model to test soil, temperature, individual crop interface and pest models.
The best of the technologies are employed in the above literature, however, the proposed systems are more advanced, intelligent and viable to increase crop yield by monitoring and automating the appropriate parameters of the fields. Most of the existing studies have used Wi-Fi, GPRS, GSM, 3G, 4G or Zigbee that carries a range up to a few meters. Contrarily, the major problem in rural areas is the internet and connectivity. Long-range connectivity for communication can resolve this problem that has been considered by a limited number of papers. The existing works have used LoRa but with very few sensors, making the smart decision-making system less beneficial and important. In this study, the monitoring can provide information about crop yield and assist in recognizing the cause of the low crop yield production in agriculture by using more sensors and much advanced LoRa communication. The problem is significant, and the proposed solution provides a system that can easily tackle the aforementioned issues. The data are collected from agricultural land through sensor nodes interfaced with the hardware on the board. This hardware possesses different components, i.e., the ADC converter, LoRa module, and the entire interfaced sensor node. This has been enclosed in the plastic casing and charged using solar energy. Further, there is a wired broadband connection at the paced where available. The receiving node has been incorporated to receive the data from the sending sensor node and transmit the data over the internet to the cloud. Moreover, the data have been displayed in the android application. The major objectives of the study are given below.
• Development of solar-powered GPS based LoRa sensor nodes and transference of real-time data to central server/cloud through IoT gateway from the integrated nodes installed in geographically distributed locations. • Development of an online cloud database to store and process the data from multiple installed nodes at various fields. • The development of a DSS system software that takes into deliberation the available data from sensors and consequently provides recommendations, auto-irrigation, suggestions and alarms needed for optimal yield for each location. • The development of an android application where data from the cloud has been received, and real-time data along with projected recommendations in the form of notifications are available for each site.
The above objectives are set in the light of the 2030 objective for SDGs adopted by all UN Member countries (in 2015) that provide a blueprint to enhance prosperity and peace for people. They opted for 17 SDGs which call for action by all countries through global partnership. This work would help by mapping intelligent DSS of SDGs to enhance crop yield by automating irrigation and controlled fertilizer. It would help developing countries to enhance their economic position by adopting human-friendly technology.

Materials and Methods
The planning of this observing framework is capable of monitoring parameters while deployed at different locations on the farm field to give recommendations and cautions required for optimum yield. The sensor system, containing soil moisture, humidity, NPK, temperature, and pH sensors, transmits the statistics to the cloud over the internet. An android application has been developed for users for monitoring available real-time information at any place and any time. The monitoring can provide data about potato yield and assist in recognizing the cause of the low production of potato yield. The data has been collected from agricultural land through sensors interfaced with the hardware on the board. The proposed system possesses different components, i.e., ESP32, LoRa module, and the entire interfaced sensor board that encloses in a PVC casing and charged using solar energy.

The Architecture of the Proposed System
In this section, a detailed description of hardware and software components given, alongside the specifications of components used in this implementation. The hardware has been divided into three different layers.

•
Collecting data through sensors • Data transmission • Data acquisition and display of data First, the data has been collected from agricultural land through the combination of multiple sensors. The sensors provide soil moisture, pH level, GPS location, humidity and temperature from the targeted land. This data is further transmitted to the web server using logic through a sensor board and ESP32, where all data have been analysed. Data are then displayed through an android application. The flow of the data between the components of the proposed system can be seen in Figure 1. Figure 1 shows a gathering of data from the field through sensors and then the movement of data through LoRaWAN by passing through all attached models. The sensor layer comprises a few gatherings of sensor nodes. The sensor nodes and actuator nodes are important for this layer and can be conveyed to various territories of agricultural land or several agricultural areas. The fundamental contrast between these nodes is that the sensing nodes mostly gather and send the information to the sending node, i.e., ESP32 in the sending end layer, while the actuator node gets from the sensors and makes the actuators act as needed, i.e., to turn on the water pump and so on. Figure 2 proposes the block diagram of the designed system. A model schematic of the proposed sensor node is shown in Figure 3, comprising an MCU, LoRa wireless module, and various sensors. The connection of the pins of the components, i.e., the sensors section that includes DHT22, MQ135, NEO M6, NPK, soil moisture and temperature sensors, can also be seen in the Figure. Similarly, the pinout of ESP32 is shows the connections of its pins with other components. ESP32 has built-in WIFI and Bluetooth modules and also supports the RS485 communication module. It is a low power consuming MCU and also has the benefits of robust action that other MCUs lack. Moreover, the LoRa communication section shows the Pout and Pin connections for the configuration of the LoRa module. Based on the proposed schematic of the sending node, the prototype is also designed by selecting the suitable components. In Figure 4, the prototype of the proposed sending node is designed that comprise all the sensors and ESP32 MCU. Contingent upon the sensor node position, a portion of the sensor nodes are furnished with solar panels. A portion of the equipment parts of a sensor node is associated using a LoRa remote communication protocol as LoRaWAN upholds a sensible information rate with low energy utilization. The sensor layer comprises a few gatherings of sensor nodes. Moreover, sensor nodes and actuator nodes are important for this layer and can be conveyed to various territories of agricultural land or several agricultural areas. The fundamental contrast between these nodes is that the sensing nodes mostly gather and send the information to the sending node, i.e., ESP32 in the sending end layer, while the actuator node gets from the sensors and makes the actuators act as needed, i.e., to turn on the water pump and so on. A model sensor node is furnished with an MCU, LoRa wireless module, and various sensors. Contingent upon the sensor node position, a portion of the sensor nodes are furnished with solar panels. A portion of the equipment parts of a sensor node is associated using a LoRa remote communication protocol as LoRaWAN upholds a sensible information rate with low energy utilization. The receiving layer is framed by equipment comprising MCU and LoRa modules responsible for accepting information from sensor nodes using LoRa, preparing information, and sending the handled and compacted information to individual LoRa gateways through LoRaWAN. The transitional advance serves to fundamentally lessen the measure of information communicated over the LoRa gateways and satisfy the exacting prerequisites of LoRa's obligation cycle. A LoRa gateway principally comprises an inserted board with LoRa remote module. These gateways can be outfitted with sensors. These gateways are outfitted with Linux since Linux offers numerous benefits, i.e., being allowed to utilize, lightweight, upgraded security, customization, dependability and eliteness, while Linux doesn't need outstanding equipment. LoRa gateway offers numerous benefits administrations, for example, message pop-up, channel classification and security. For example, when a passage identifies irregularities, for instance, equipment errors in sensor hubs, the gateway can send a text to end clients, users or agriculturists, to advise about the issue. The prospects of information preparing in the sending layer range from multi-robot planning [27], to bio-signal examination [28,29]. It consists of a LoRa module and Node MCU. The MCU processes the data it receives from the sending node and further Analogto-Digital (ADC) conversion has been performed. Once the conversion is completed, the data from the sensing layer (node) is transmitted over the internet (Google Firebase in this case). The primary function of this layer is to transmit data, hence, it is also called the transmission layer. The proposed schematic of the receiving node has been shown in Appendix A Figure A1.

Software Design Data Acquisition and Display Layer
There are three levels in the data acquisition layer. The primary level comprises a discretionary gathering of repeaters that principally get the information from the LoRa module and forward that to the cloud through the LoRa gateway. The utilization of this level and number of repeaters relies upon the distance between the arrangement area, i.e., a far off-field, and the closest LoRa gateway. In the works of Petajajarvi et al. [30], around 20 repeaters were needed to keep a stable LoRa correspondence connected over a distance of 300 km, close to the signal transmission line. The researchers caution that even though LoRa can give long-range transmissions (for example, 25 to 30 km), packet loss of data increases significantly (after the 10-15 km threshold). The second level in the receiving layer comprises a progression of interconnected LoRa gateways linked with each other and share data about sensor hubs if they are nearby. We have assumed that the LoRa modules are not associated through LAN, VPNs or other virtual communication network arrangements and the LoRa gateways are situated in regions with stable internet connectivity. Furthermore, the LoRa doors are associated with cloud servers using Wi-Fi, Ethernet, 3G or 4G. The LoRa passages can offer progressed administrations including pop-up messages, circulated information stockpiling, security, information combination, and information preparation. More itemized data of LoRa benefits has been examined by authors of existing literature including [18,[31][32][33][34]. Please see Table 1. The third level comprises cloud servers and their administrations, i.e., worldwide information storage, big data investigation, message pop-up, information handling with complex calculations. Contingent upon the application, explicit cloud administration has been carried out. The end-client terminal layer comprises android applications and internet browsers which are utilized to get constant information, and information orders to control sensors in distant agricultural lands. The display layer then collects the data from the cloud and transmits it to the android application. Moreover, the design, development and working of the application have been discussed in (Section 2.4.1) while the decision support system has been illustrated in (Section 2.4.2).

Interfacing of Prototype Sensors
This section presents the interfacing of sensors used in this work. To design the hardware setup, all sensors must be properly interfaced with other modules for functionality. All the sensors are interfaced and tested in different ways for hardware deployment. The real-time sensing node deployment in the farm fields can be seen in Figure 5.

Software Development for the Proposed System
This section presents the design, interfacing and integration of hardware and software. We have deployed an IoT based smart agriculture framework to take the precision of irrigation and farming system with real-time information. As a matter of first importance, agriculturists 'login' into the application by using a username and password on an android device that permits the user to choose yield for the respective season. Further, the framework has been carried out in three layers listed below.
In Figure 6, the detecting stage detects the physical values of various parameters including temperature, NPK portions, humidity and moisture, etc. Moreover, each sensor has been further connected to the ESP32. All this data is transmitted to the LoRa gateway through the LoRa RA02 module. At the receiving end, the Node MCU has built-in Wi-Fi to connect the receiving node with the internet and upload data on the fire-base cloud.

Android Application Development
An android application is developed with the help of android studio. The layout of the application is displayed below. The layout of the application consists of three parameters on the dashboard. These are home alerts and controls. After logging in, the real-time data is shown on the home screen. All the recommendations, suggestions and alerts are given in the alert screen and the control tab controls, i.e., turning auto-irrigation and alerts ON or OFF.

a.
Real-Time Data: In this tab, real-time data of all the sensors are shown which is fetched from the Firebase database. b.
Alerts: In this tab, three types of alerts are shown. The first is about irrigation, giving alerts after processing moisture level. The nutrients portion suggests the fertilizers according to the values of NPK (nitrogen, phosphorous, potassium). The last portion is about PH, that suggests the right use of chemicals to control the PH. c.
Control: In the control tab, we can control the auto irrigation, and forcefully turn ON or OFF the irrigation and android application notifications.

Decision Support System
The DSS analyses data and makes assessments that contribute to decisions about autoirrigation, pH, and other soil nutrients utilizing real-time acquired data. First, the farmer signs into the android application using his ID, such as a unique username and passcode.

The Algorithm Used by the Proposed DSS System
Further, the home screen shows up, and the user is instructed to allow notifications and TURN ON the auto-irrigation system. The system is implemented in three different phases, i.e., Sensing, Processing and Data Allocation. The sensing is the first phase that passes the setting of all environmental parameters, i.e., temperature, pH level, soil moisture/temperature, humidity, NPK proportions, soil conductivity, and air quality. All these sensors are connected to the ESP32 MCU board. This board directs the data to the ESP32, which functions as the LoRa gateway in the built system as it has the capability to communicate the data to the cloud. This communication is performed using the LoRa RA-02 module. The further processing phase is performed in the server, i.e., the cloud. The cloud comprises a server, a database where the acquired information is retained, and a decision algorithm that holds decisions established based on acquired data from sensors. In the final phase of data allocation, the output of the decision algorithm has been delivered to the android application and next to the IoT gateway. The DSS is a simple algorithm built by using "if, else and if-else" statements. It makes the code smoother, more efficient, and simpler with better performance as compared to the existing complex systems. The end-to-end Algorithm 1 of the smart farming system is given below. The algorithm of DSS shown in Figure 7 has been further explained below. Figure 7 makes it convenient even for a non-specialist person to comprehend the system. As discussed earlier, the sensors get data from the fields and further send it to the cloud/android application to display the values for the user. Moreover, known threshold values of every parameter are stored in the designed system, which helps make decisions and give recommendations for the fields in which the sensors are incorporated. In this regard, first comes the parameter of soil moisture level. As in our case, the normal value is between 60% and 80%. When the value is in between the statistics, the system does nothing. But when the value is less, it checks if the user turns ON the auto-irrigation or not. If yes, it automatically turns ON the water pump. If the water supply is high, it shows the notification of a high-water level. As the system also comprises the NPK sensor, take the example of nitrogen in the soil. The normal value of nitrogen required for a crop is between 50-70 mg/kg. If the value is in between the statistics, it shows the normal options and no warnings. However, if the nitrogen value is below the threshold value of 50 mg/kg, it divides it into two categories. The first category is a slightly 'low value' from 49-30 mg/kg and tells the user to use appropriate fertilizers, i.e., sodium nitrate etc. If the value is below 30, it is considered deficient and recommends strong nitrogenous fertilizers, i.e., urea, ammonium nitrate, etc. Similar is the case if some nutrient's quantity is high. The same goes with other nutrients, i.e., phosphorus, potassium. The algorithm for other parameters, i.e., pH, soil conductivity, air temperature and moisture, etc., is also the same.

Results and Discussion
The main objective of this study is to develop GPS based LoRaWAN sensor nodes to transfer real-time data to the central server/cloud through an IoT gateway. The WSN nodes are deployed in geographically distributed locations for different crops. The development of logic-based DSS software at the cloud considers available data from sensors, historical trends and the impact of weather patterns and accordingly provide suggestions, alarms needed for optimal yield for each site. The planning of this observing framework has been done that enables the monitoring of crop parameters while deployed in the field at different locations on the farm. After deploying the proposed system, the farmers or the landowners can easily monitor their farms through a smartphone application. The designed application helps to store and retrieve data at any time from any remote location. The monitoring can provide information about crop yield and assist in recognising the cause of low yield production in agriculture. The problem is significant, and the proposed solution provides a system to easily tackle these issues. Moreover, the data collected from agricultural land through sensors and tools interfaced with the hardware on the board. The sensors are first interfaced with ESP32. The data has been sent to the receiving node with the help of the LoRa module, where a Node MCU is connected, and then this MCU transmits the data through the internet to the cloud. Once the data is transmitted on the web server via LoRa, it can be easily displayed on the android application. We have also analysed real-time data on the serial monitor and generated the AP (Access Point) mode of the ESP32 controller that retrieve data from controller to IP address of NodeMCU through the internet. It is mandatory to test the precision of the hardware setup. Hence, a specific area is decided for testing and implementation of the hardware module and values are assigned to specific parameters, i.e., temperature, humidity, soil moisture, etc. These values are monitored all the time by the hardware module. An android application, developed with the help of the android studio, consists of a dashboard, which contains main parameters, such as notifications, alarms, controls, etc.

Retrieving the Real-Time Sensor Data
Initially, the data has been collected from fields, and further processed on the ESP32. After this, the data has been sent to the receiving node. The next step is displaying data on the serial monitor of NodeMCU. Similarly, coding has helped in this aspect. By enabling the IP address of NodeMCU using coding and further connecting the NodeMCU with the internet, all the data of NodeMCU has been displayed at the IP address of NodeMCU. All the data has been stored in the cloud and can easily be retrieved from this cloud storage to the Android Application.

Uploading Sensor Data at Fire-Base Cloud
Google fire-base is used as cloud storage. Cloud storage may be a package model during which statistics are sustained, processed, stored the slightest bit, and formed around the handlers via a network, mostly through the Internet. The users characteristically purchase cloud storage according to their requirements at a fixed rate. While the per gigabyte value has been radically driven down, cloud storage suppliers have additional operating expenses that can make the technology further expensive. Cloud security continues to be the priority among users, hence, the providers have strained to contend with those uncertainties by an edifying security competence. Cloud storage involves transferring a file to the web that is available for an associate degree extended amount of your time. The simplest variety of cloud storage is uploading one thing to a server and having the power to retrieve it when required. The detailed results are displayed on the IP Address of NodeMCU. Cloud results play an important role in this data transfer. The data are easily gathered using a cloud server, and it is retrieved on the android application.

Sensor Data at Android Application
The data are displayed on the android application as shown in Figures 8 and 9. Specifically, Figure 9 shows the front-end of the android application developed to display the back-end functionality in a managed way. The application has four Graphical User Interfaces (GUIs): one showing sensors data, a second for notifications, a third for auto irrigation and the last for real-time location. The farmers and agriculture experts can easily monitor and operate the application by simply logging in by entering the username, passcode and node ID (2-factor authentication).  As depicted in Table 2, the proposed study is better in comparison with the existing studies for many reasons, as this system comprises a Long-Range communication module while the existing systems use the conventional modules, i.e., Bluetooth [35] and Wi-Fi [36]. Contrary to the existing studies, the proposed system is a complete package of smart agriculture as it comprises major parameters of automated farming including autoirrigation, a group of sensors, and also an android application with DSS, while the existing systems, as in the works of Jawad et al. [13] and in the study of Gutiérrez et al. [15], only focused on limited parameters.
The system presented in [13] has been purely a theoretical system that is designed using highly complex algorithms, while the proposed systems used efficient algorithms. Moreover, the system given by the authors [15] uses a GPRS module for communication that not only consumes much power but also is closed source and paid, while the proposed system uses the open-source LoRa communication module. A comprehensive comparison between the existing literature and the proposed system has been carried out in Table 2. The presented results and comprehensive comparison of the proposed system with existing systems validate the implementation design, as it enables the farmers to monitor their crops and automatically controls environmental parameters without human intervention. It increases the system accuracy while reducing the labour cost and ultimately increases the crop yield. It also helps to achieve sustainable and resilient infrastructure that ultimately promote inclusive and sustainable industrialization in agribusiness and foster innovation. Until now, the prototype is compatible in limited areas and cannot extract data from encryption sensors. For betterment in the future, a better and more well-developed system can be introduced. Therefore, it has been helpful in improving the monitoring and testing of large-scale areas.

Conclusions
This work implements a DSS system built using WSN, LoRa based platform, and an android application to automate the environmental parameters for optimal crop yields. The presented prototype is proficient in monitoring crop parameters while deployed in the field at different locations of the farm. We have used a LoRa module communication for an efficient smart agriculture technique intended to monitor and regulate ecological components in cultivation. The proposed low-cost system unceasingly monitors the precise stats and transmits these stats to the farmer through a gateway and an android application. The presented results also validate the proposed design as the accessibility of real-time information facilitates rapid usage and supervision of all locations of the farm. Additionally, the proposed system offers auto-irrigation, and auto-adjustment of environmental parameters by carrying the facility of wireless data transmission to the designed application. Large-scale deployment of the proposed system would help the farmers to improve their financial situation with enhanced crop yield and hence, the SDGs may be attained with smart system deployment in agriculture globally. In a future perspective, the proposed automated system can be integrated with a drone-assisted strategy proposed by Sharma et al. [37]. In addition, a separate thermal imaging camera (along with drone technology) can be deployed to supervise the crop farm. If a pest is inhabiting crop leaves, a drone equipped with a spray tank can be used to spray anti-pest liquid on an affected area of the crop farm.       Figure A7. NPK Sensor Pinout [41].