Keywords

1 Introduction

Greenhouse cultivation has gained a growing attention as a significant method of contemporary farming. The key features of the modern greenhouse are incorporation of sensors, embedded and wireless communication technologies in the design of a greenhouse monitoring and control system [1]. Agriculture has been the primary occupation of our country for ages [2]. Presently, there is so much interference in the agriculture because of the immigration of people from villages to cities, resulting into the need of smart farming techniques using IoT to tackle this issue. IoT refers to a network of objects that make up a network to configure itself [3,4,5,6]. The smart plantation scheme conceived in this paper is based on the common platform Raspberry Pi and IoT. Virtual Raspberry Pi board is interfaced with the Ubidots platform using the Wi-Fi module. Ubidots is one of the smart and fully automated platforms of IoT. The system consists of Raspberry Pi microcontroller and sensors as major parts as they are responsible for controlling the field irrigation [7, 8]. Raspberry Pi is an advanced version of the microcontroller that forms the core of the system. Different sensors such as temperature sensor, humidity sensor, etc. are used to measure the different environmental constraints. The sensor parameter is demonstrated in terms of ppm at different levels and actions on the IoT device [9, 10]. Additionally, the sensor must be able to use the server via wireless communication in order to graphically achieve the real-time information so that data stored in the cloud can be transmitted to many users at any time [11]. Ubidots offers a quick and reliable mechanism for the real-time sending and receiving of data from and to IoT devices using the global cloud network [12]. Ubidots offers a firm forum for the hobbyists, enthusiasts, and professionals alike, allowing them to quickly retrieve and use the sensor data across the globe and making it useful. Ubidots platform is used to send the different sensor values or other data to the cloud, safely store them, and retrieve them whenever a person wants to use simple API calls.

As we know that there are so many plant monitoring projects developed to monitor the health status of plants [13]. Currently, there are so many manual approaches of plantation to monitor the parameters, in which manpower is used to detect the growth of plants [14]. The gardeners themselves examine the factors in their field [15]. Earlier only the sensors were used for accomplishing this task. The process may consume more time and a huge manpower. It is very difficult and hectic task to continuously monitor for the maintenance of the crops [16]. It is almost impossible to be always in the field and analyze as well as monitor the temperature [17], humidity, and moisture accurately. So, it may lead to the decrease in the quality of plants due to insufficient monitoring [18]. Previously, there was no source of information about the field status via SMS [19]. When any of the sensor value goes beyond the threshold value or some problem happens to the motor, he may know manually [20]. In order to avoid these circumstances, the authors have proposed a system in which the person can get information via SMS and e-mail immediately if any of the above sensors goes beyond the limit. The system is also required to do the needful operation, such as turning on or turning off the water pump whenever required by the user’s instructions on the electronic device.

The main contributions of this research work are to propose a smart plantation system to monitor the health status of crops and thus increase the production of the crops, to implement a smart water management system, and to use the cloud computing resources to incorporate this framework. The purpose of this proposed system is to track the various parameters related to the plantation being observed electronically via wireless connectivity. The proposed system is of great benefit to the farmers as farming accounts to over 60 percent of our country’s employment. The production of crops will also increase if the proposed system is used to gather the information about the irrigation outputs using IoT and different sensors. It provides security even to livestock. The farmers may also use remote technology to activate/deactivate the water pumps operated by renewable energy sources to keep the environment safe.

This article is systematized as follows. Section “Related work” deals with the related work on IoT and its potential agriculture applications. In section “System architecture and operation,” the system architecture is represented along with the design. Section “Proposed methodology” refers to the proposed methodology with implementation. Section “Results and discussions” describes the results and discussion part. The conclusion is discussed in section “Conclusion and future scope.”

2 Related Work

The authors in [21] have highlighted the potential of wireless sensors and IoT in agriculture as well as the challenges to be faced when this technique is combined with the conventional farming approaches. It investigates in depth IoT devices and communication methods related to the wireless sensors employed in the agricultural applications. The sensing technologies are required for specific agricultural operations, such as soil preparation, status of crop, irrigation, insect recognition, and pest identification. In [22], the real-time analysis of the data collected from sensors employed in crops is provided. It generates the results for farmers that are required to track the crop growth, hence reducing the farmer’s time and resources. The data obtained from the fields are stored in the cloud and managed through the integration of IoT devices to promote the automation. The idea proposed in the paper can improve the crop productivity by reducing the wastage of agricultural field resources. The findings of the experiment show the field temperature, soil moisture, and humidity and carry out the decision-making analysis. A Cuckoo Search Algorithm is used in [23] that allows for the provision of water for farming under any circumstances. By integrating with the IoT network, equipped with related sensors and wireless communication systems, a variety of parameters such as temperature, turbidity, pH, moisture, etc. are calculated. Using ThingSpeak, the sensor data is accessed in the cloud environment on this IoT platform. Further, the authors in [24] suggested a technique that can generate the messages to alert the farmers through the various platforms. By obtaining live data (temperature, humidity, soil moisture, etc.) from the field, the product helps farmers to take the required actions to allow them to do the intelligent plantation that raises their crop yields to help them in the saving of resources (water, fertilizers). The authors in [25] presented a review to summarize the existing state-of-the-art irrigation systems. In irrigation systems, there are the parameters that are controlled in terms of water quantity and quality, soil characteristics, and weather conditions. The approach gives an outline of the nodes and wireless techniques that are mostly used. Finally, the problems and best practices to incorporate the irrigation systems based on sensors are addressed.

The authors in [26] proposed a variety of features such as GPS-based remote monitoring, moisture and temperature sensing, scarring intruders, safety, leaf wetness, and proper irrigation facilities. The system makes continuous use of wireless sensor networks to assess the soil properties and environmental factors. In [27], an IoT-based smart farm control system is proposed to help the farmers achieve the effective farming. The combination of the current environment and agricultural production with the farmer in a simple way through Arduino Mega and GSM modules is also explored. The suggested approach helps users to manage and control all the events required during agriculture.

3 System Architecture and Operation

The proposed system architecture is discussed briefly in this section (as shown in Fig. 1). The main aim of this model is to handle the harvests via remote mobile network and to initiate the certain orders. The flow of work is conferred with the help of various flowcharts and block diagrams. The key outline of this work is to design and implement a virtual IoT-based intelligent plantation system to monitor the electrical devices such as pumps (without any interference) depending on the atmospheric constraints such as soil moisture and temperature. The module design consists of two parts: hardware and software.

Fig. 1
figure 1

Proposed system model

Hardware part consists of sensors while software part consists of middleware, communication part, and cloud part.

3.1 Sensor Part

This is the first layer of the structure suggested by the authors. The sensors are installed across the field for sensing or collecting the parameters. DHT11 sensor is employed to read the weather temperature and humidity of the field. The temperature ranges from 0 to 50 degrees centigrade, with the precision of 2 degrees. This sensor’s humidity varies from 20 to 80 percent with a precision of 5 percent. It is ideal for the remote atmospheric stations, home environmental control systems, and residence or greenery walled in the area of observation structures. This sensor measures the relative clamminess [28].

The sensors for soil moisture measure the volumetric content of the soil water. The soil moisture sensor employed in this device to assess the quality of the soil to check whether it is good for crops or not [29].

The sensor used for the humidity is DHT-22. The humidity sensor (or hygrometer) detects the relative humidity in the air, calculates, and records. Therefore, it tests both humidity and temperature of the air. Relative humidity is the ratio of real humidity in the air to the maximum amount of humidity that can be maintained at that air temperature [30].

Raspberry Pi is a credit card-sized device for connecting the sensors and actuators in various models with General Purpose Input Output (GPIO) pins, so that it can play a major role in connection to the sensors. It is used to keep track of the data produced by the different sensors connected to the farming field and to send it to the web server which can be used for data analysis or data visualization purposes.

3.2 Middleware Part

Under this part, there comes a high-level general purpose programming language called Python and a free operating system (i.e., Raspbian) optimized for the Raspberry Pi hardware.

3.3 Communication Part

The communication protocol called Message Queuing Telemetry Transport (MQTT) protocol is the basis of the communication part.

3.4 Cloud Part

Cloud computing is an evolving platform that can be used efficiently in today’s agriculture. The suggested model uses the cloud computing technology to record the data from different agricultural fields. The various channels are created in this layer, each corresponding to a particular constraint in the Ubidots cloud for storing the field data. The controller periodically sends the sensed data via communication protocol to the interface. Such types of data are designed in terms of time. In the Ubidots web service, status of field (temperature, soil moisture) can be tracked as a graph [31].

The advantages of the proposed system are that it preserves the water used for plantation, senses the parameters accurately, has low maintenance cost, and provides the acknowledgment to the user about the field conditions.

The sensor module deals with the sensing where the sensors such as soil moisture sensor and temperature sensor are placed in contact with the soil to be grown. These sensors are linked through the wireless connections to the control unit. The decision is taken by the microcontroller, based on the sensed values. Initially, the controller program needs to be installed. The threshold values for each parameter have to be predefined before reading the analog inputs from the sensors. During the implementation of system, the moisture threshold is set at 91. The temperature tolerance value is 28 degrees centigrade. The sensors are wired to the Raspberry Pi pins that require encoding in Python language for the implementation of applications. After that, the reading of the moisture sensor is checked. If the humidity goes beyond 90, then the temperature test is performed. When the temperature is below the threshold value, this ensures that the plant will live for a few more days without water. If the threshold value is exceeded, the plant must be irrigated. In this work, user awareness is included as a module. This allows the user to become fully aware of the farming and agriculture. The system is designed particularly for the farmers who depend on the work to nurture the field. They don’t need to stay near the field frequently. Instead, they can make use of this intelligent system and get worthwhile advices and field notifications. When there is low humidity and high temperature, the user receives the message about the plant’s condition and irrigation requests. The text message also recommends the fertilizers for improving the soil nutrients when the temperature sensor value stretches beyond the range.

4 Proposed Methodology

An IoT-based smart plantation system intends to make use of the features of embedded system to make the agricultural science effortless. The system reads the soil moisture, temperature, and humidity in this sensor connected with Raspberry Pi, and then the sensed data are given to Raspberry Pi. The controller is considered to be the decision maker. It examines the moisture and temperature value. At first, the threshold values of moisture and temperature are defined.

Figure 2 shows that whenever the sensed value of temperature goes beyond the limit, the Raspberry Pi monitors the temperature value. If the sensed value of temperature is higher than the threshold value, then plantation is done and heater is turned off as explained in the flow diagram. On the other hand, if the temperature is mild, all crops can tolerate the moisture in the dry soil conditions.

Fig. 2
figure 2

Workflow of temperature sensor

As explained in Fig. 3, if the soil moisture is dry, it will check the water tank level. If water tank level is less than 15, the acknowledgment is given to the user and the relay will get opened automatically to provide the supply of water.

Fig. 3
figure 3

Workflow of moisture sensor

  1. 4.1

    Virtual IOT Implementation Using Ubidots

  1. (a)

    Importing library file into Raspberry Pi (set up Raspberry Pi)

First step is to set up virtual Raspberry Pi. Integrated Development Environment (IDE) desktop version as well as online editor is used to upload the code to the board using various library modules.

Adafruit_DHT- For DHT11 sensor RPi. GPIO-For LDR sensor Adafruit_MCP3008- library to convert analog sensor data into digital Time- For using function like delay Adafruit_GPIO.SPI- To enable spi pins

  1. (b)

    Creating a device in Ubidots

Next step is to create a device. Click on “Add New Device” and select “Blank Device” in Ubidots window. Next step is to create two variables – one to assign the value of button (1 and 0) and the other one to store the value of the text where acknowledgment from the Raspberry Pi is displayed. A note of the device label and variable labels of all the variables is made that is being used in the code. In order to create a dashboard by clicking “Add New Dashboard,” click on “Add New Widget” and connect the Switch Widget to the Button.

  1. (c)

    Assigning authenticated values to the cloud

Each packet demands a Token. Clicking on “API Credentials” under the profile tab is the fastest way to retrieve. API key is primarily an exclusive and immutable key which is only used to generate the account tokens. Device Label, Device ID, Variable ID, and Token will be configured in the code.

  1. (i)

    Defining server address and port no. of cloud

Server_Address = "mqtt.ubidots.com" port = 1883 SPI_PORT = 0 SPI_DEVICE = 0 mcp = Adafruit_MCP3008.MCP3008(spi = SPI.SpiDev(SPI_PORT, SPI_DEVICE))

  1. (ii)

    Assigning the value of channel ID, write API (application programming interface) key, and topic for writing the data in cloud.

Channel_id = 1101269 # from cloud write_api_key = 'FMFCB72IVSU03247' topic= channels/"+str(channel_id)+"/publish/"+write_api_key Assigning the value of sensor type and related pin of sensor sensor_type = DHT.DHT11 #DHT11, DHT22, DHT21 sensor_pin = 4 GPIO.setmode(GPIO.BOARD) GPIO.setup(Moisture,GPIO.IN)

  1. (d)

    Assigning the value of sensor type and related pin of sensor

sensor_type = DHT.DHT11 #DHT11, DHT22, DHT21 sensor_pin = 4

  1. (e)

    Creating client object for cloud and connecting from cloud server

client = mqtt.Client() client.connect(Server_Address,port)#connected to cloud

  1. (f)

    Writing the data of sensors into console and publishing in to cloud

while True:    humidity, temperature = DHT.read_retry(sensor_type,sensor_pin)    print("Temperature : "+str(temperature))    print("Humidity : "+str(humidity))    Moisture_status = GPIO.input(Moisture)      if(light_status <= 15):      print("dry soil")      else:      print("wet soil")    Publishing the data in cloud    data="field1="+str(temperature)+"&field2="+ str(humidity)+"&field3=“+str(Moisture)+"&field4="+str(Camera)    client.publish(topic,data)    print("Data sent to Cloud")    time.sleep(15)

The callback function will be called when a new message is received in the subscribed topic. It will first display the received payload in the serial terminal. It then switches on or off the built-in LED of the Raspberry Pi and then publishes the state of LED through the pubTopic command. The serial monitor is started followed by opening up the browser and clicking on the button created in the Ubidots dashboard.

5 Results and Discussions

The results of the proposed system are simulated on virtual IOT and displayed on cloud platform Ubidots. The snapshots of the results are provided in this section. Ubidots helps to capture the data easily from sensors and convert data into useful information. Ubidots results are in the form of a graphic notation and are used for the administrative purposes to manage the system in an efficient manner. In this unit, the system findings are seen on the display screen.

Figure 4 represents the Ubidots cloud dashboard. Here, the Ubidots dashboard is created that consists of a button widget and a metric widget and three variables are assigned to it, i.e., temperature, pressure, and humidity. After pushing the button widget, command is sent to Raspberry Pi using MQTT protocol. MQTT protocol is used to send and receive the data from Ubidots cloud to the Raspberry Pi. When the data reaches Raspberry Pi, it sends back an acknowledgment signal to the Ubidots that will be displayed on the text widget. Firstly, an account in Ubidots needs to be set up followed by the configuration of the project on Ubidots so that Raspberry Pi can send the data. Dashboards are the human-machine interfaces where data are easily visualized. The project configuration is done with the help of Ubidots web interface.

Fig. 4
figure 4

Ubidots dashboard snapshot

After project configuration, the user can define the variables. One holds the temperature values, while the other holds the moisture and humidity values. The IDs of all these variables are used for the Raspberry Pi sketch. After configuring the variables, we can use them to send the data. After running the sketch of Raspberry Pi, it automatically starts sending data to the Ubidots. The user can create a simple dashboard to show the data sent by Raspberry and DHT11 and DHT22. Once the code has been uploaded to the virtual Raspberry Pi, the serial display button is clicked. As the board connects to Wi-Fi, the data is automatically transmitted to the cloud. Raspberry Pi receives the changed code in no time. Once the command is received and the LED is turned ON, it will send an acknowledgment back to the Ubidots server that will be displayed in the dashboard. Figure 5 shows the sending and retrieving data process of all three sensors from the cloud, and based on that data received, some action is to be initiated.

Fig. 5
figure 5

Terminal snapshot: sending and receiving data from the cloud

5.1 Analysis of Temperature Sensor

On the Ubidots website, a dashboard is created to provide the widgets to monitor and plot real-time graphs and sensor data. It is also used to trigger the alarm when the optimum value of a variable is exceeded. After the navigation to Ubidots dashboard, all the data sent from the sensor will be displayed in widgets.

The temperature, moisture, and humidity data are measured from the field where plantation is done. Ubidots technology provides the developers to easily capture the data of sensor and convert it into useful information. Figure 6 shows the analysis of temperature data in Ubidots server. Ubidots offers developers a platform that allows them to sense the data of sensor easily and transform it into graphical information. The result of this research is that the field temperature is successfully obtained. While the field is measured using a DHT sensor, the temperature results will be reflected on the board, and this data will be reached in real time as shown in Fig. 6. Figure 7 shows the readings of temperature sensed by sensor.

Fig. 6
figure 6

Analysis of temperature using Raspberry Pi integration with Ubidots

Fig. 7
figure 7

Readings of temperature sensed by sensor

5.2 Analysis of Humidity Sensor

Figure 8 shows the analysis of humidity data in Ubidots server. Sensor data cloud storage is obtained in CSV format files, as shown in Fig. 9. GUI libraries provide the resources needed to create the various graphical interfaces. On the cloud, the agronomist will program events or alarms. Figure 8 shows the graphical interface, created with the Ubidots humidity cloud platform. Some alerts are also created if the moisture level exceeds a certain level and an alert is sent to our mobile phone via SMS.

Fig. 8
figure 8

Analysis of humidity using Raspberry Pi integration with Ubidots

Fig. 9
figure 9

Readings of humidity sensed by sensor

5.3 Analysis of Moisture Sensor

Figure 10 shows the graphical analysis of the moisture, which was previously viewed in the serial monitor. This happens because the value of different sensor reading is passed as a string and stored in a variable. Figure 11 illustrates the moisture sensor values sensed by the sensor.

Fig. 10
figure 10

Analysis of moisture using Raspberry Pi integration with Ubidots

Fig. 11
figure 11

Readings of moisture sensed by sensor

Table 1 describes the deployed parameters range sensed by humidity sensor, temperature sensor, moisture sensor, and their respective threshold values.

Table 1 Deployed parameters

6 Conclusion and Future Scope

A smart plantation system is designed to observe the health status of plants/crops, and with the collected data, a specific action is triggered automatically and remotely. A camera is used to monitor the live status of plants/crops. The proposed system can collect the data using parameters such as temperature, humidity, and moisture within the plantation field by integrating the features of all hardware components using virtual IoT. This design improves the real-time efficiency in changing the agricultural climate and hence contributes to the achievement of the unattended target resulting in the production of smart planting crops [32]. The proposed work is an achievement and will record a competent technique for the real-time readings. With this system, one can increase the production of crops and help farmers whose livelihood depends on the better quality crops.

Future opportunities can be on the basis of the data collected by the existing sensors. Using data analytics and machine learning, the favorable atmospheric conditions can be defined/predicted based on data of humidity, temperature, light intensity, etc. Images captured can be utilized after the image processing algorithms to identify the health conditions of leaves, fruits, and flowers, which can certainly be used to certify the quality of fruits/flowers. Based on motor triggering frequency, how much care a plant will require can be defined/predicted. If the accurate gas sensors can be developed to sense the exact amount of exhale/inhale of oxygen/carbon dioxide and other gases, then it will be great to categorize the plants as per our need in the different geographic locations. The sensors which can sense the vibrations around a plant can be used to open a new area of research to measure the energy level of different plants and their impact on surroundings. Additionally, sensors could be used to analyze the air pressure and altitude, and a web interface or data feed service could also be built directly to the Internet. This scheme may also be used in the future as a part of the advancement of remote control of the Internet of Things and may be extended to other areas of modern agriculture facilities.