IoT based smart garden monitoring system using NodeMCU microcontroller

Technology brings a remarkable advancement in every field of life, whether its industry or agriculture. Our lives are essentially dependent on agricultural development. Researchers are working to integrate modern technologies in agriculture to develop new practices for the enhancement of healthy agriculture and production. Internet of things is a domain of computer science that provides mechanisms and techniques to interconnect a wide range of digital devices to automate the real-life systems. In big cities, peoples facing problems in their homegrown gardens regarding the maintenance and availability of proper gardeners. This research paper has proposed an IoT based approach for smart garden monitoring using NodeMCU microcontroller that helps the users in identifying current parameters of temperature, moisture, and humidity of their homegrown plants and gardens. A prototype has been implemented to show the real illustration of the proposed approach. An android mobile application has been developed to display the real-time profiles of environmental factors like temperature, moisture, and humidity. With the help of this system, users will be able to treat their gardens in a better way in terms of plant health and growth. This research work replaces the need for gardeners and issues faced during the maintenance of gardens in big cities. The purpose of this research is to introduce and prosper the IoT innovation towards smart cities in


Introduction
*In the current technological era, automation rules all over the world and holds the key to radically empowering several sectors of Pakistan's economy. From manufacturing, agriculture to services and logistics, technology can enhance the capacities, efficiencies, and production quality of every human activity (Yeo et al., 2014). Internet of things is a technique of using computers, mobile phones, or digital devices in monitoring and controlling the simple parameters of day to day life (Dorsemaine et al., 2015). Using IoT concepts and knowledge, new systems will be developed based upon sensors, software, and communication protocols for automation of specific tasks. Data exchange is the key factor for IoT. The standards of our lives will be nourished by the practice of using automation for simple things (Albishi et al., 2017). We are living in the fourth industrial revolution in which systems are moving from manual to automatic process (Trotta and Garengo, 2018). It brings the concept of the smart industry and opens many research directions (Zhou et al., 2015). Those Peoples who prefer to grow gardens and other small fruit plants in their homes often get cautious during the early stages of maintenance. As a result, the garden gets destroyed due to a lack of care. There are also weather conditions that can render the gardens lifetime short, as some crops/plants can die due to lack of moisture, severe heat, and humidity, etc. (Biswal et al., 2015). People hire the gardeners to maintain their homegrown small gardens. Most plants often get damaged due to environmental conditions and lack of proper care. This is where the idea of an automated garden monitoring system takes place with the internet of things to overcome above-mentioned problems. The proposed system integrates all sensors and components for real-time statistics. Communication is done with wireless sensor networks. Mobile computing is an efficient technology to support the internet of things for developing real-life systems (Kavitha et al., 2020). Already, there are mobile applications that help farmers in their crop maintenance. Similar IoT based systems are designed for garden maintenance that is costly and often used one task, only temperature reading or water pouring mechanism. Our country is based upon the agriculture sector, and it needs to achieve higher benefits from agriculture like India . Thamaraimanalan et al. (2018) have proposed a system that analyzes the environmental parameters of the garden to automate the watering process of plants. A mobile application is developed to check the status of the garden for watering. This system senses the temperature and moisture with temperature and moisture sensors for big gardens. Soil and other supporting sensors are integrated over Arduino that gathers the values of soil and transfer the information to firebase by using built-in WIFI facility. Suma et al. (2017) presented a watering system for gardens according to six seasonal environmental factors of their country. The temperature sensor, humidity sensor, and pump controller are integrated to develop the prototype. The system senses the moisture and humidity level of plants and provides water accordingly. Another home garden watering system based upon singleboard raspberry pi computer is developed by Ishak et al. (2017). This system is highly efficient in terms of hardware, development, and implementation cost. IR sensor, soil moisture sensor, ultrasonic sensor, LDR, and the gas sensor is integrated over raspberry pi. This system senses the environmental factors and alerts with proper time to feed the plants. A theoretical model of intelligent garden monitoring is presented by Biswal et al. (2015) to help the developers and researchers to build intelligent systems. Another implementation for remote monitoring of environmental soil properties is presented by Na et al. (2016).
Internet of things is the future of current technology, and there will be 20 billion-plus digital devices interconnected over the internet in 2020. Internet of things bringing a revolution in our lives by providing automatic solutions of manufacturing  to monitoring systems (Ali and Paracha, 2020). IoT based system development is harder due to a lack of flexible and proper integration of digital devices (Kasiviswanathan and Ramalingam, 2020). A wide range of challenges is encountered in the development of the internet of things based systems (Porras et al., 2018). IoT is an integration of digital devices, people, and processes for meaningful communication and operation of any real-life system. Multiple methodologies and techniques have been introduced to address the challenges of wireless sensor networks, cloud computing, pervasive computing, ubiquitous computing and embedded system development. However, these approaches cannot address the challenges of IoT based systems. Kumar et al. (2016) have introduced an integrated methodology to tackle the challenges of IoT. Zhou et al. (2017) highlighted the current IoT concerns and issues very precisely. Guinard et al. (2011) briefed the concept of the web of Things and their implication in real-life systems. The Internet of things completes the dream of connecting the physical things with the virtual world, which can be remotely controlled and managed. Atlam et al. (2017) emphasized the cloud things architecture that integrates cloud computing and the internet of things. Khan and Salah (2018) have technically reviewed and categorized the security issues of IoT by mapping those issues on three-layer architecture. Furthermore, security requirements for IoT Systems are highlighted, and the state of the art solution is presented.
The paper is divided into five sections, and every section elaborates on the aspect of this research. Section 2 discusses the proposed system design, along with hardware and software development. Section 3 shows the implementation of the proposed garden monitoring system with hardware components, software, tools, and communication protocols. Section 4 discusses the experimental results with sufficient details and supporting figures. Lastly, section 5 concludes the research and briefs the future direction.

Proposed system design
We use NodeMCU (ESP 8266) microcontroller to integrate the entire module where sensors are connected to it, and data is transferred via a Wi-Fi module that is available in the microcontroller. The device is portable and requires charging after some time. The data is transferred directly to the application. Fig. 1 proposed system diagram is a pictorial representation which shows how every component plays a certain role in it. In this diagram, the device is depicted in the center with various components. The network part is an access point allotted for operating the device.
Temperature sensors are used to detect the current status of heat and soil of air that can be useful for analyzing the heat effect on garden plants. Similarly, the YL-69 sensor displays the current moisture levels of soil and humidity sensor detect the percentage of water vapors at the moment. All sensors provide the real-time data of plants, which help us to get an exact situation of the environment. User can use this information to treat areas which are affected in the garden. Charging Unit consists of a battery that is connected to a power input chip and a circuit board that uses it to transfer the DC power to sensors for functioning properly. The Display unit can generate output, i.e., the parameters detected currently in the area along with the IP address.
Requirements of this system are categorized as functional and non-functional requirements.

Hardware development
The hardware for the system consists of the following components which are tested using Arduino IDE (programming) and integrated over breadboard with jumper wires to connect with a DC unit. The other set of requirements from the proposed system are as follows.

Performance
This device needs to deliver an acceptable level of performance. The standard for speed of data communication between the device and mobile applications must be at a constant level (Mahalank et al., 2016).

Safety and security
The proposed prototype must hold a standard set for safety and security for customer usage (Nguyen et al., 2018). It must be able to provide user authorization.

Software quality attributes
Ensuring the optimization, system constraints, and testing grade via quality control (Mahalank et al., 2016). These attributes allow us to keep a proper check and to set the standards for commercial use. Key attributes include connectivity to any network, standalone use without mobile application, portability and charging capability, etc. (Sachdeva and Chung, 2017).
The device requires an android application to access and show the collected data. The consumer needs to sign in the application to access the data. Upon authorization, the user can be able to view the real-time readings taken from the device and also able to check the history of factor profiles. Automatically users will browse the best conditions that are required for plants of the garden. For the design of a mobile interface, we used Android Studio to develop a custom application that operates the entire system. Technically there is only a singular interface (user). The application has been designed to get data from the device and then display it on UI or save it in the localhost. The communication of the device relies on a wireless network standard, and the HTTP standard is used. Since the device will require an IP Address to connect to a network. The response between the connected devices will be in JSON format. If there is any network problem occurred then data will be saved on the local server, which can be accessed later.

Implementation of the proposed smart garden monitoring system
The proposed system incorporates the physical configuration of its electrical components with communication approaches that cover the methods and types of data transfer between the device and application. The implementation is mainly consisting of two parts: The device will be using sensors which are programmed with microcontroller and linked with a mobile application to transfer the data that is collected from the device. The development of this prototype consists of both hardware and software along with a communication medium. The emphasis is more on the hardware side as manufacturing of device from components which are vital for projects purpose. The proposed design is a portable and area independent automated system that, as stated in previous sections to collect information about garden health with sensors. Below is the block diagram of the device's physical configuration.
In Fig. 2, the Central point is the NodeMCU controller to which sensors of temperature, humidity, and moisture are connected with power supply, charging unit, and display. A small TFT LCD screen is used here to build the display over the device. The system is composed of three units: Sensors, power, and display. The unit for sensors is consists of temperature, humidity, and moisture sensors.
The overall working process of the proposed system is shown in Fig. 3 named as operational flow. Initially, the user begins by starting the device, and the underlying area are tested by a constructed device. The device analyzes the garden area and tries to fetch the defined real-time parameter values by using integrated sensors. If the values are successfully fetched, then the device determines the network access. Otherwise, the device is restarted and debug procedure activated, which find and handle the error. If the device found a network connection, then the retrieved results are delivered via mobile application. If there is any problem while connecting with the network, then the retrieved results are shown by the TFT screen integrated on NodeMCU.

Hardware
Following key hardware components are used to implement the proposed garden monitoring system,

NodeMCU
NodeMCU is a digital microcontroller based upon system on chip (SoC) technology to develop IoT applications (NodeMcu, 2019). It contains an onboard WIFI system for communication of data and other supporting libraries. MCU refers to the Micro Controller Unit. It provides the facility of analyzing, controlling, and monitoring of digital systems. Here are a few prominent features of NodeMCU, Fig. 4 shows NodeMCU as follows:

DS18B20 temperature sensor
The DS18B20 is a single wire temperature sensor to sense the real-time temperature. It requires only a single data line to communicate with an integrated device. Fig. 5 shows the DS18B20 temperature sensor.

YL-69 soil moisture sensor
YL-69 is the cheapest and reliable soil moisture sensor to sense the humidity in the soil. It consists of two components, a small electric board, and two sensing strips to sense the values. Fig. 6 shows the YL-69 soil moisture sensor.

TFT LCD (1"4 inches)
1.4 inches TPT LCD is integrated over the NodeMCU to display the results on the device. If the mobile application is facing any error related to network or other components, then the fetched environmental values will be displayed on the integrated TFT screen. Fig. 7 shows a TFT LCD.

System implementation
By using a custom-designed circuit board, we have mapped sensors and other components in appropriate locations. The proposed smart garden monitoring device is shown in Fig. 9. The device is used in the real garden, and real-time results are retrieved.

Software/tools
Android Studio is used for the development of mobile applications and Arduino IDE for the programming of the entire device. Both will use some libraries that can allow us to create a link between the application and device. The application will be taking data generated from the device, and it must have the correct library files on both ends. JSON is a communication interface for data sharing between a device and a mobile app.

Communication protocols
Communication protocol defines the type of medium used for data exchange between two components. For this purpose, we use JavaScript Object Notification (JSON), a file format type that has lightweight and flexible, used for serializing and transmitting structured data over a network connection-transmit data between a server and a client. This approach is considered as a standard approach in most of the custom built machines and devices as it requires the data transfer in the form of the variable between device and application. We use a Wi-Fi Manager and Client Libraries in Arduino IDE to allow the device to connect application via an IP Address and transfer the live detected parameters directly to the app. Fig. 10 shows the real-time results on a TFT screen that is integrated on the device board. It displays the current moisture and temperature of soil, humidity, and temperature values. In the bottom of the screen, the IP address of an attached device is shown. Fig. 10: Results on TFT screen Fig. 11 shows the mobile application, which is integrated with a GSM device that enables mobile computing services. The same environmental results of soil moisture, humidity, and temperature of plants are shown on the application screen. Users and gardeners will be able to treat their plants with more care by using these real-time results. Fig. 12 elaborates on the moisture profile of the garden. In Fig. 12, time slots are shown on the x-axis, while the moisture in percentage is shown on the yaxis. In the early morning time slot, the moisture is high. But as the time increase to noon, the moisture decreases, and in the evening, it again increases as shown in Fig. 12. Fig. 13 illustrates the humidity reading of the garden at different time slots. Time is taken on the xaxis, while the humidity values are taken on the yaxis. The difference in recording the humidity is 4 hours in Fig. 13. Initially, the humidity value is high in the morning, but with sunrise, it decreases.

Conclusion and future work
The proposed approach of smart garden monitoring is based upon NodeMCU microcontroller, mobile computing, and the internet of things. It provides real-time statistics of garden environmental factors, so the local users and gardeners are able to treat their plants in a well manner. Soil temperature, moisture, and relative humidity are considered environmental factors. The results are shown on the TFT screen, which is integrated over the proposed device. The result are also delivered through a mobile application. This approach can remedy the problems of gardening that are faced in urban areas due to lack of gardeners. In the future, we will enhance system functionality by adding an interface for archiving all the historical records. Furthermore, we will also add the overall maintenance properties and precautions of wellknown plants that will be shown as a suggestion against specific parametric values. So users or gardeners can easily manage their plants with more care. Moreover, irrigation and fertilization features will be added for automation.