1. Introduction
Since the late 20th century, the agricultural industry has embraced technological advancements catalyzed by the internet revolution to bolster productivity, sustainability, and resource allocation. Notably, the utilization of remote embedded systems with network connectivity has emerged as a dependable instrument, catalyzing the transformation of agricultural field monitoring. In line with the global population projections of 2019, it is anticipated that the world’s population will increase by approximately 26% by 2050. With this impending demographic milestone, it is projected that farmers will face the unprecedented challenge of meeting the world’s growing food demand, surpassing all the historical production records [
1]. This surge in demand necessitates the strategic enhancement of resource allocation. The incorporation of monitoring tools stands as a promising avenue to identify the precise locations, methods, and extent of resource deployment.
Arable land, being a fragile and limited resource, requires careful management to maximize its potential for increased production without the need for expansion. This objective can be accomplished through the judicious management of various components within the agricultural environment, including fertilisers, water, and pesticides. Despite notable technological advancements, the average water usage in fields has shown minimal changes over the last five decades, resulting in water surplus in specific areas of plantation, while causing shortages in the others [
2].
This study seeks to design a computerized precision agriculture system employing a microcontroller system with network connectivity. The system will measure the key variables, including air temperature, air humidity, and soil moisture, at multiple locations within an agricultural field and transmit these data to a central server. The data will be interpolated to create maps depicting the agricultural environment’s status in relation to the variables under analysis. This system aims to provide an automated irrigation tool.
Hence, the primary objective of this study is to develop a computerized precision agriculture system capable of employing a network-accessible micro-controlled system to collect the measurements of vital variables, such as air temperature, air humidity, and soil moisture, at various locations within an agricultural field These measurements are then sent to a server, and these data are subjected to interpolation te1chniques to create maps of the agricultural environment, illustrating its condition concerning the analyzed variables, both current and historical.
This research has been divided into the following structure: (i) the Materials and Methods, which show the theoretical framework and its selected programming languages for the project, the microcontrollers and sensors used for measurements, and it also introduces the core concepts of network architecture chosen for the project; (ii) the Results and Discussion present the prototype developed in the research; (iii) the Conclusions addresses the final reflections, challenges faced, and suggestions for improvements.
2. Materials and Methods
Structured Query Language (SQL) was chosen for the creation of the database due to its versatility, user-friendliness, and ability to handle extensive sets of structured data. MySQL was employed as the Database Management System (DBMS). A DBMS is a suite of software tools that enables a database to be queried and modified through the use of its proprietary communication sockets [
3].
In creating the visual part of the website that delivers information to the user, HyperText Markup Language (HTML) was employed to define the elements, and Cascading Style Sheets (CSS) were used for styling and positioning these elements on the page. Additionally, the Bootstrap framework was utilized for the interface design. Bootstrap is a robust and extensible frontend toolkit, constructed and customized with Sass, allowing for the use of a pre-programmed grid system [
4].
The web service responsible for receiving data and executing operations on the database utilized Hypertext Preprocessor (PHP). PHP, a high-level language, is particularly well suited for the creation of dynamic web pages. It offers an array of tools for facilitating user interaction through forms, URL parameters, and links. What sets PHP apart from languages like JavaScript and CSS is its server-side execution, delivering pre-processed, pure HTML. This architectural choice enables interactions with databases and server applications without exposing the primary source code of the system, thereby ensuring data security [
5]. In the generation of interpolated temperature and humidity maps, the Leaflet library was employed. Leaflet is an open-source tool for rendering interactive maps [
6].
The selected microcontroller was the ESP32, which is manufactured by the company Espressif. This embedded board comes with built-in Wi-Fi and Bluetooth connectivity, a low-power processor, and provides a robust and highly integrable platform capable of meeting the ongoing demand for energy-efficient consumption. It offers essential tools for ensuring data security due to its ability to operate with encrypted network protocols [
7].
To conduct temperature and air humidity measurements using the data collection microcontrollers, the DHT11 sensor was employed. This sensor is capable of measuring both parameters and generating them as a digital signal. It can measure temperatures in the range of 0 °C to 50 °C and humidity in the range of 20% to 80%, which typically cover the measurements within the arable fields of northern Paraná, with only occasional exceptions. For soil humidity measurements, a corrosion-resistant resistive hygrometer was used.
The microcontroller network features autonomous power supply through photovoltaic cells. To maintain compactness, prismatic lithium polymer batteries were employed, along with a protection circuit for charging and discharging. Typically, these batteries provide the highest energy density available on the market.
Methods
The development methodology employed for this project was the Waterfall model, which is one of the most traditional approaches to software management. It follows a linear sequence of stages, where each phase of the project must be completed before the next one can begin. In the initial stage, system requirements are defined. In the second stage, the project is developed, with the aid of UML diagrams. Upon completion of this phase, implementation begins, involving the writing of program code and the development of functionalities. Subsequently, the unit testing phase is undertaken to ensure that each component of the system functions correctly.
For system requirements definition, a literature review was conducted within the scientific literature on the use of resources in agricultural fields in the Paraná state’s Northern Pioneer region. Subsequently, the Entity-Relationship Diagram (ERD), as depicted in
Figure 1, was created to understand how the entities in the system’s database should relate to one another. The ERD is one of the key diagrams in UML. MySQL Workbench, a tool for database creation and management, was employed to construct the research diagram.
In the diagram depicted in
Figure 1, the “user” table holds information about the system maintainers. This table exhibits a one-to-many (1:N) relationship with the “microcontroller” table, signifying that a single user can register multiple microcontrollers, while each microcontroller can be registered by only one user. Additionally, the “user” table maintains one-to-many (1:N) relationships with two other tables, the “login_record,” which stores user log entries, and “access,” which records the agricultural fields that a user is authorized to manage.
The “microcontroller” table is related to four other tables in the following manner: It exhibits a one-to-many (1:N) relationship with the “field” table, representing arable fields. This signifies that one microcontroller can belong to only one arable field, while a single arable field can be associated with multiple microcontrollers; it maintains a one-to-many relationship with the “history” table, which is used to store data every time the irrigation actuators are activated. There is a connection with the “sensor” table, facilitating the link between each microcontroller and its respective sensors; and then it is associated with the “irrigation_schedule” table, where the irrigation routines to be followed by that microcontroller are stored. Additionally, each microcontroller is uniquely identified by a Media Access Control (MAC) physical address, as denoted by the unique constraint.
The “irrigation” table specifies the soil moisture threshold at which irrigation should stay active and the time of its activation. This is connected to the “irrigation_schedule” table in a many-to-one (N:1) relationship. This means that one irrigation can be associated with only one irrigation routine, and an irrigation routine generally encompasses multiple irrigation actions.
The “sensor” table contains data regarding the latitude and type of sensor. It is related to the “microcontrolador” table in a one-to-many (1:N) relationship. This means one sensor can be linked to only one microcontroller, but a single microcontroller can be associated with numerous sensors.
The “sensor_reading” table stores the values recorded by the microcontrollers, and it is related in a one-to-many (1:N) manner with the “sensor” table. These data from the “sensor_reading” table are used to generate maps.
3. Results and Discussion
The project in question comprises a structure divided into three parts, each playing a fundamental role in the system’s operation. The first part consists of the data processing and visualization server, which serves as a central hub for interactions with the users and microcontrollers. This server hosts user interface screens, providing a platform for users’ interactions. Additionally, it is equipped with an Application Programming Interface (API) that acts as a receiver for the data collected by the access clients. This API is crucial for ensuring seamless communication among the various system components.
The second phase of the project entails the deployment of the microcontrollers. These components are tasked with sending HTTP requests to the primary server. Upon receiving these requests, the microcontrollers orchestrate the execution of the designated assignments, such as activating the irrigation valve when the soil moisture level falls below the threshold specified in the “irrigation” table.
In conclusion, the third part of the project focuses on creating clients that facilitate interconnection between the database server and the microcontrollers. By bridging centralized data storage and distributed processing devices, the clients play a crucial role in the integrity and smooth operation of the project as a whole. The diagram shown in
Figure 2 illustrates communication between the entities within the system. The only part with direct access to the Database Management System (DBMS) is the PHP Web Server, which serves as the core of the system. This is important to ensure the integrity of the information stored in the database and prevent SQL injection vulnerabilities.
To access the information, the user first logs in on the system’s homepage, and is then redirected to the interactive maps page. This page features four selection fields, allowing the user to choose the specific measurement period they wish to view. The PHP system conducts a database search for the records collected by the microcontrollers during that period, calculates the averages, and generates an interactive map using JavaScript, displaying the calculated measurement averages. Subsequently, a second layer is added to the map to showcase data interpolation, improving the user’s ability to visualize the field’s status.
Figure 3 illustrates a temperature map generated using the data collected by three microcontrollers on 29 August 2023. The microcontroller positioned outside the “IFPR Bloco Administrativo” recorded an average temperature of 28.4 °C during the one-hour interval when the map was generated. The one located underneath the “IFPR Bloco dos Estudantes” registered 28.8 °C, while the microcontroller inside the “IFPR Bloco de Alimentos” measured 21.8 °C. The system calculates an average of the values recorded within a specific time frame and performs data interpolation. The users can explore different positions by interacting with the map by clicking and dragging on the screen. To obtain temperature readings, they simply click on the microcontroller icons. The initial position has been set to the location of IFPR—Campus Jacarezinho.
4. Conclusions
Throughout this paper, strategic choices were made that molded the infrastructure and operation of this project. The careful selection of programming languages, frameworks, and devices, combined with the Waterfall development methodology, led to a prototype that encompasses data collection, processing, and visual representation. The proposed network architecture and the interaction among system entities have resulted in an agricultural monitoring system capable of performing fundamental high-level operations, such as data storage and retrieval.
The objectives have been partially achieved. The developed system is currently capable of performing tasks such as:
Registering, deleting, and modifying microcontrollers;
Listing registered arable fields and microcontrollers;
Sending and receiving messages from embedded systems that conduct measurements;
Generating interactive maps with average values within a user-defined time interval;
Conducting measurements of the air temperature, air humidity, and soil humidity;
Executing data interpolation for the information presented on the maps;
Performing irrigation through irrigation routines or manually.
To assess whether the users’ needs have been adequately addressed, testing in agricultural environments will be essential. For future implementations, there is a plan to replace the current method of communication between the embedded systems and the PHP server. Instead of using a direct HTTP connection, each ESP module will be equipped with a radio communication module. These devices will send their requests to a central microcontroller Gateway, which will then forward them to the server. This approach will enhance the system’s robustness, allowing the sensor-equipped modules to operate at greater distances from points with internet connectivity.
Author Contributions
All authors contributed to the study conception and design. Material preparation, data collection, and analysis were performed by R.J.C., L.C.d.C., R.O.A.T., A.L.S.M., L.H.R.L. and W.N.L. All authors commented on previous versions of the manuscript. All authors have read and agreed to the published version of the manuscript.
Funding
The authors would like to thank to the Pro-Rectory of Extension, Research, Post-Graduation, and Innovation of the Federal Institute of Education, Science, and Technology of Paraná–Proeppi/IFPR. Through the Directorate of Extension, Art, and Culture–Diext, as well as the Araucária Foundation Paraná, for granting financial aid scholarships to undergraduate students to promote extension activities that resulted in the development of this research.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Data are contained within the article.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Wilmoth, J. United Nations Global Population Projections: A Critical Analysis of Key Methods and Assumptions. In Proceedings of the African Population Conference, Entebbe, Uganda, 18 November 2019. [Google Scholar]
- Spier, H.; Rabbinge, R. Agriculture and Resource Management: Future Needs in Europe and Developing Countries. In Proceedings of the IFA Agricultural Conference on Managing Plant Nutrition, Barcelona, Spain, 29 June–2 July 1999; pp. 1–5. [Google Scholar]
- Surian, J.; Nicochelli, L. Apostila de Banco de Dados e SQL. 2010. Available online: http://www.josevalter.com.br/download/sql/ApostiladeBancodeDadoseSQL.pdf (accessed on 29 July 2023).
- Bootstrap. 2023. Available online: https://getbootstrap.com/ (accessed on 29 July 2023).
- de Souza Barreto, M.V. Curso de Linguagem de PHP. Aracaju, 2000. Available online: http://www.etelg.com.br/paginaete/downloads/informatica/php.pdf (accessed on 29 July 2023).
- LeafletJS. Leaflet—A JavaScript Library for Interactive Maps. Available online: https://leafletjs.com/ (accessed on 29 July 2023).
- Espressif. Get Started—ESP32—ESP-IDF Programming Guide Latest Documentation. 2023. Available online: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ (accessed on 29 July 2023).
| Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).