You are on page 1of 6

Deep Learning and IoT for Smart Agriculture using

WSN
Aruul Mozhi Varman S Arvind Ram Baskaran
Department of Electronics and Communication Engineering, Department of Electronics and Communication Engineering,
Amrita Vishwa Vidyapeetham, Amrita Vishwa Vidyapeetham,
India. India.
aruulmozhivarman@outlook.com lf2ram@gmail.com

Aravindh S Prabhu E
Department of Electronics and Communication Engineering, Department of Electronics and Communication Engineering,
Amrita Vishwa Vidyapeetham, Amrita Vishwa Vidyapeetham,
India. India.
soniaravindh@gmail.com e prabhu@cb.amrita.edu

Abstract—Main objective of the smart agricultural system is to appropriate soil parameters. These information sources are the
improve the yield of the field. In this paper, two main streams are basement on which the predicted values are compared. Sensors
adopted: (i) predicting the suitable crop for the next crop rotation for the system were selected based on the literary sources, so
(ii) improvising the irrigation system of the field by selective
irrigation. The above goal is achieved by periodically monitoring that the system is capable of monitoring the soil parameters of
the field. The monitoring process involves collecting information a crop. When the field is large there are chances of obtaining
about the soil parameters of the field. A wireless sensor network mundane results and also the overall information of the field
(WSN) is established to collect these data and have a hindsight isn’t obtained when only a single node is used. In order to
of it by sporadically uploading it to cloud. This uploaded data avoid redundant data and also to obtain the information from
forms the basis for analytics. Through experimentation, Long
Short Term Memory (LSTM) networks is found to be the suitable different parts of the field, a WSN is required. Zigbee modules
algorithm. The inferred results are compared with the optimal are used for the wireless communication in the network. The
values and the best-suited crop is intimated to the user through measured soil parameters from various nodes in the field are
SMS service. transmitted to the cloud through a gateway. Through stream
Index Terms—IoT, Machine Learning, Agriculture, Wireless analytics, the vast data is channeled to an online database.
Sensor Network, Smart Irrigation
Machine learning (ML) workspace is created with predictive
I. I NTRODUCTION experiment and a training model. The data accumulated in
the database is used to train the model periodically, the
Traditionally farmers have adopted crop rotation technique trained model is used in the predictive experiment to infer the
to improve their yield. As the current climate variation is outcome. Farmer queries through SMS, the query is channeled
transmuting it has become very difficult for the farmers to through stream analytics to the ML workspace and the inferred
determine the profitable crop for the next rotation. The growth output is sent back through Twilio.
of crop depends on environmental conditions as well as soil
parameters. Determination of crop only through soil testing or II. BACKGROUND
only by analyzing the weather pattern of the environment can’t A. Sensors
give a clear insight. Developing a system which integrates In order to have quantitative results of the condition of soil
soil quality and other environmental conditions would be apt. various sensors were used. DHT11 is digital humidity and
Designing a system which predicts the most suited crop for temperature sensor which produces a calibrated digital output.
the field would help the farmer to have a preplanned insight The sensor contains a resistive sense of wet components which
for his next rotation. Most of the developing countries are makes it unique to be used in agricultural fields. It also
facing a shortage of water. Countries which are dependent contains a negative temperature coefficient (NTC) temperature
on agriculture as its backbone, waste massive liters of water measurement device, and all these are connected with an 8-bit
because of lack of water management system. Irrigating the high-performance microcontroller. The advantage of using this
field when required and as well as till the optimum requirement sensor is that it has long term stability, faster response, low
would conserve mammoth amount of water. cost, strong anti-interference ability. Moreover, it has precise
Literary sources were collected from Agriculture University, calibration with relatively less error.
Coimbatore, regarding the widely produced crop along with its LM35 is an integrated circuit with an ability to measure
the temperature precisely. The output of the sensor is directly

978-1-5090-6621-6/17/$31.00 ©2017 IEEE


2017 IEEE International Conference on Computational Intelligence and Computing Research

Fig. 1. System Structure

proportional to the surrounding temperature, which can be pressure, sound etc. Every node consists of an array of sensors
scaled to get the actual temperature. The circuitry is sealed integrated with a micro controller. The acquired data is sent
in order to avoid oxidation. It can give precise output when to the coordinator through wireless modules. The concept of
the temperature ranges from -55 C to 150 C. For every one WSN is widely used when we want to acquire the data of
degree Celsius change, the output varies by 10mV. every part of the field.
DS18B20 is a digital thermometer which measures the
C. Cloud Computing and Services
temperature in Celsius. This temperature sensor is durable,
doesn’t get damaged in a rough and rugged environment. 1) IoT Hub and Stream Analytics: Internet of Things (IoT)
Some common applications where these are used include hub connects front-end smart devices with a cloud based server
Thermostatic Controls, Industrial systems, Thermally sensitive using light weight protocol like Message Query Telemetry
systems. This sensor can be considered as a durable device Transport (MQTT) and Advanced Message Queuing Protocol
which would be resistant to diverse situations in the soil. (AMQP). Azure Stream Analytics seamlessly integrates with
Soil moisture sensor is used to get an intuition of the Azure IoT Hub and other services to enable powerful real-
amount of water content in the soil. A customary peasant time analytics on data from IoT and other connected devices.
would analyze soil moisture for irrigating the agricultural field. Stream processing analyzes and performs actions on real-time
Soil moisture sensor uses LM393 comparator circuit to check data through the use of continuous queries.
whether the humidity is greater or lesser than the ideal thresh- 2) Online database and Power BI: Power BI is a cloud
old humidity (set by the user). The scope of the sensor is that it service platform that provides users with tools for aggregating,
has adjustable threshold level and provides a two state binary analyzing, visualizing and sharing data. Dashboards provide an
output (high or low). Simple array of sensors can be integrated overall view for users with their most important data in one
with an embedded system, if complex DSP can be used [15]. place and get updated in real time.
Field programmable gate array (FPGA) implementation of the 3) Machine Learning: ML is an important part of artificial
sensor node improves the node’s efficiency by running at lower intelligence. Instead of explicitly programming a computer
clock speed while performing on par with general purpose to solve the problem, it learns with the provided examples.
microprocessor [14]. ML models based on the input data finds pattern and uses
statistical analysis to predict the output within a credible range.
B. Wireless Sensor Network ML algorithms are often categorized as being supervised or
A WSN may consist many clusters of nodes which are unsupervised or reinforcement learning. Supervised algorithms
placed under the control of coordinator. They are generally require user to provide both input features and its target. Once
used to acquire data of physical parameters like temperature, the training is complete, the trained algorithm is used for
2017 IEEE International Conference on Computational Intelligence and Computing Research

inferring new data. In case of unsupervised learning, the user A. Remote Wireless Sensor Network
need not provide the target. The literature survey obtained from Agricultural University,
4) Twilio: Twilio is a cloud communications platform as a Coimbatore elucidates about the ideal parameters such as air
service (PaaS). Twilio allows the users to programmatically temperature, soil temperature, humidity and moisture level
make and receive phone calls, also send and receive text in addition to soil drainage, soil texture, rooting conditions,
messages using web service APIs. erosion hazard for a well-flourished growth of various crops.
III. R ELATED W ORKS These parameters are utilized to predict the best-suited crop for
The context of sensor networks is becoming ubiquitous the field and to perform smart irrigation. In order to measure
in every field of work. The purpose of it in an agricultural these parameters, the following sensors are used: LM35,
study is to inspect water requirements, weather, crop, and DHT11, DS18B20 and Soil moisture sensor. The information
soil information. It has several advantages and also improves obtained from these sensors are collected using WSN and sent
the traditional efficiencies [1],[9]. The use of WSN has many to the cloud through a gateway. Other parameters such as
outstanding capabilities in analyzing an agricultural land. The effective soil depth, texture, soil drainage and erosion hazard
following are some of the salient features which shows notable results are less invariant hence these parameters are obtained
headway while implementing a WSN system. 1) Insightful using manual soil testing. These immutable values are stored
decision making: In a large area, this feature enhances the as a dictionary in the database (cloud).
energy efficiency of the overall network, and hence, the In order to analyze the entire study area using WSN, two
network lifetime increases. Using this method, multiple sensor clusters were formed each consisting of two nodes and a
nodes amalgamate themselves, and collectively take the final router. Each node and router has a set of sensors along with
decision [2]. 2) Effective Topology Configuration: For long a micro-controller and a Zigbee for connecting to the WSN.
lasting battery life and also for less energy consumption the Mesh topology is used to connect all the Zigbee with one
nodes gets active only while sending data, rest of the time another as it is highly reliable in delivering the information.
it is configured in ’sleep mode’. Only the coordinator is The data from these nodes and routers are concatenated and
always active which requires a constant power supply. Using sent to coordinator which is the only node connected to the
topology management techniques [3], the sensor nodes can gateway. Even the coordinator plays a role in the collection
collaboratively take these decisions. 3) Self-sufficient system: of sensor readings. Entire quantum of data is uploaded from
The network could be outlined for autonomous purposes [4] the coordinator to the IoT through the gateway. The gateway
with which smart irrigation system can be designed with no is established using a GSM module.
human intervention. Fig. 2 is the map of the study area and the topology
A continuous stream of data is uploaded to the cloud undertaken is also mentioned for collecting sensor details, the
through coordinator by the WSN. In order to perform process- area corresponds to Ettimadai, Coimbatore.
ing and analysis of such stream of data using analytics, it is
required to store the data to an online database. IoT is intended
for connectivity of different entities, effective accessibility, and
processing of data [5]. As the use of IoT in the contemporary
world is increasing rapidly, it is necessary to acknowledge the
advancements, benefits, and challenges involved in it [6].
Based on the collected data weather is forecast, with the
addendum of other info regarding the soil suitable crop is
suggested. The weather forecast is carried with the help of
ML. As the data is sequential and time dependent, LSTM and
Gated Recurrent unit (GRU) are apt [11]. Best algorithm is
chosen based on convergence time and loss [11].
IV. M ETHODOLOGY
Prediction of crops using WSN [8], in this journal the
suitable crop is suggested to the user by comparing the soil
parameters with a predefined data set. This method has several
lacunae while predicting a crop for the field. This method Fig. 2. Area of Study
could be highly inappropriate as predicting a crop just by
analyzing the soil parameters only on one particular day. As
plant growth is a long term process, it is futile to predict a crop B. Configuring Zigbee
by this method. Hence in order to overcome this disadvantage Entrenchment of a WSN requires proper configuring of
and accomplish the task, the following methodology is used. Zigbee in the same modes for flawless communication [12]. X-
The project is composite of three major blocks as shown in Fig. CTU is a free software tool available from Digi International
1: 1) Remote WSN 2) Cloud 3) Twilio and mobile Application. to interface with Zigbee modules. The suite provides a GUI
2017 IEEE International Conference on Computational Intelligence and Computing Research

and terminal interface to configure the modules as well as a V. R ESULTS


built in tool to test the Zigbee range and reliability of packet
transmissions. Every Zigbee module is set in the same PAN Soil temperature, atmospheric temperature and humidity
ID, appropriate baud rate and also proper designation of each level in the area of study was measured from seven nodes in
Zigbee is burned in its firmware. the WSN. The values were collected and uploaded periodically
in an interval of five minutes duration. The sensor reading was
C. IoT Hub noted for twelve months duration and this massive quantum
of data was streamed to store in the database. Maximum and
The acquired data in the form of JavaScript Object Notation minimum values for respective parameters was determined and
(JSON) is converted to string format and is forwarded to IoT was used to train ML model. Table I gives the values of a
hub. Through stream analytics, the data is redirected to SQL sample used to train a ML algorithm.
database. The time series data stored in the database is used Based on the obtained data set three different ML models
by the ML studio to train a model. The model burgeons itself were trained using RMSProp optimizer and their validation
by acquiring more and more data, becoming more accurate. losses were calculated in terms of mean square error.
ML Models considered:
D. Machine Learning
• GRU Validation Loss: 9.2752 Training Time: 48.52s
Earlier a problem was approached through rule based tech- • LSTM Validation Loss: 2.1354 Training Time: 57.62s
niques which use if/else statements to solve. Heuristic classifi- • Feed Forward Neural Network (Under Fitting) Valida-
cation approach succeeded it, doesn’t give an optimal solution tion Loss:115.9542 Training Time:39.01s, Feed Forward
rather satisfies the immediate cause. This technique makes Neural Network (Over Fitting) Validation Loss:8.3786
educated guesses. We have used learning based classification Training Time:76.25s
which uses neural networks to solve the cause. The advantage
of using this technique is, it learns any deviation in the data The trained feed forward neural network fits a function by
set and uses this variation to alter the algorithm. We have matching the features with the corresponding targets but it
implemented three approaches in learning based classification doesn’t learn the sequence in the data. So it under fits the data.
system which are 1) Feed forward 2) LSTM 3) GRU on the When trained with higher epoch the model doesn’t generalize
data set and their accuracy was verified with the validation well and starts to overfit the data. Hence feed forward network
set. Feed forward was the first artificial neural network and isn’t a suitable model.
the simplest where information flows in one direction (for- Model with minimum validation loss and considerable train-
ward) through the input nodes, through the hidden layers ing time has to be considered. Based on observed results
and the output is obtained from the output layer. LSTM is LSTM model is chosen. With this as the proposed model soil
based on recurrent neural network (RNN) architecture which parameters are predicted for the next entire year 2017.
recollects at arbitrary intervals. This approach is well suited Fig. 3 represents the predicted minimum and maximum hu-
for classification and in the prediction of time series data set. midity levels for July 2017. Similary Fig. 4 and Fig. 5 depicts
GRU is also based on RNN architecture which was recently the predicted minimum and maximum soil and atmospheric
introduced. This approach is faster than LSTM, since it has temperature respectively for July 2017.
fewer parameters. LSTM is found to be an suitable algorithm These predicted values along with the results from soil
for the given data set and hence the soil parameters are testing are compared with the literary sources. From the
predicted with this approach. comparison, Solanum lycopersicum (tomato) is found to be
the best crop followed by Abelmoschus esculentus (ladies’
E. Twilio and Mobile Application fingers). The obtained results were convincingly accepted by
local experts. Upon the user’s request through SMS the appeal
A web app is designed to take Chronological details (time
is attended by inferring periodically updated prediction, the
of sowing) from the user to predict the suitable crop. ML
upshot is sent to the user through Twilio.
Studio API is actuated by the web application which initiates
the inference project, here the future parameters of the soil
are evaluated and is mapped with the suitable crop from the VI. C ONCLUSION
literature survey. The processed output is sent to the user’s
Instead of suggesting crop based on a day’s environmental
mobile through Twilio API.
conditions as did in [8] the proposed model is a learning based
classification approach, the prediction is more accurate and
F. Smart Irrigation System
helps in analyzing the entire soil parameter pattern for the
Soil moisture is the crucial parameter which determines future tenure more reliably. As the future pattern is determined
the water content in the soil [13]. Every node in the WSN for a fixed period of time it becomes simpler to suggest a
measures the moisture as one of its particulars. An optimal suitable crop that can be sowed, this would help the user to
value for it is set, below which the nearby motor is triggered make a more pre-deterministic approach towards agriculture
and set on till the soil moisture level reaches its optimum. rather based on personal intuition.
2017 IEEE International Conference on Computational Intelligence and Computing Research

TABLE I
S ENSOR DATA

Node Atmospheric Temperature Soil Temperature Humidity


Type Max Min Max Min Max Min
Node11(N11) 32.65 17.36 30.91 18.28 68.71 55.83
Node12(N12) 32.17 17.20 31.81 17.62 68.70 56.48
Router1(R1) 33.31 17.59 32.17 17.94 68.17 55.50
Node21(N21) 32.42 17.14 32.01 17.68 68.82 54.99
Node22(N22) 32.53 16.50 32.86 17.33 67.76 55.94
Router2(R2) 31.98 17.26 31.80 18.50 68.76 54.93
Coordinator(C) 31.45 17.27 32.13 18.67 69.07 56.40
Table I shows the Maximum (Max) and Minimum (Min) of the sensor values from the nodes at Ettimadai, Coimbatore on 6th January 2016.

Fig. 3. Predicted Max and Min humidity from (01-07-2017 to 31-07-2017)

Fig. 4. Predicted Max and Min soil temperature from (01-07-2017 to 31-07-2017)
2017 IEEE International Conference on Computational Intelligence and Computing Research

Fig. 5. Predicted Max and Min atmospheric temperature from (01-07-2017 to 31-07-2017)

VII. F UTURE SCOPE [7] Soumyalatha and S. G. Hegde, ”Study of IoT: Understanding IoT Archi-
tecture, Applications, Issues and Challenges,” International Conference
Collection of the gargantuan amount of data and processing on Innovations in Computing & Networking., Bengaluru., KA, 2016.
it in the cloud using server client architecture becomes a Her- [8] S. Sangeetha et al., ”Prediction of Crop and Intrusions Using WSN,”
culean task. The major hurdles faced are Latency and Capacity. International Conference on Advanced Computing, Networking and
Informatics., Bhuveneshwar., OR, 2015.
To improve the response time a distributed framework based [9] J. LiE and E. Xu, ”Development on Smart Agriculture by Wireless
on fog architecture could be established. Unlike the cloud Sensor,” International Conference on Industrial Economics and Industrial
were computing and services are centralized to a node, fog Security., Beijing., 2014, pp 41-47.
[10] S. Yang, ”IoT Stream Processing and Analytics in The Fog,” IEEE
architecture pushes it to the logical extremes of the network Communication Magazine, pp. 21-27, Aug. 2017.
[10]. [11] Junyoung Chung et al., ”Empirical Evaluation of Gated Recurrent Neural
The ideal sowing time for a crop determines its progress of Networks on Sequence Modeling,” arXiv:1412.3555v1 [cs.NE], Dec.
2014.
growth and also its quality. Prediction of the sowing time can [12] T.V.Aneeth and R.Jayabarathi, ”Energy-Efficient Communication in
be done by neural networks trained with quantum amount of Wireless Sensor Network for Precision Farming,” International Con-
data, thereby predicting the best time to sow the best suited ference On Artificial Intelligence And Evolutionary Computations In
Engineering Systems., Chennai., TN, 2015.
crop. [13] T. K. Ramesh et al., ”Automated irrigation system with partition facility
Smart agriculture effectiveness can be improved by pre- for effective irrigation of small scale farms,” Ecology, Environment and
dicting the ideal time for manuring, applying fertilizer and Conservation, vol. 21, no. 1, pp. 369-375, 2015.
[14] R. I. Vigneshu et al., ”Design and implementation of digital household
pesticides. energy meter with a flexible billing unit using FPGA,” International
Journal of Applied Engineering Research, vol. 10, no. 11, pp. 28331-
R EFERENCES 28340, Jul. 2015.
[15] S. Karthick et al., ”Low Power Systolic Array Based Digital Filter for
[1] I. F. Akyildiz and I. H. Kasimoglu, ”Wireless sensor and actor networks:
DSP Applications,” The Scientific World Journal, vol. 2015, pp. 1-6,
research challenges,” Ad Hoc Networks, vol. 2, pp. 351-367, Oct. 2004.
Jan. 2015.
[2] A. U. Rehman et al., ”A review of wireless sensors and networks’
applications in agriculture,” Computer Standards & Interfaces, vol. 36,
pp. 263-270, Feb. 2014.
[3] H. Ren and M. Q. H. Meng, ”Game-Theoretic Modeling of Joint
Topology Control and Power Scheduling for Wireless Heterogeneous
Sensor Networks,” in IEEE Transactions on Automation Science and
Engineering, vol. 6, no. 4, pp. 610-625, Oct. 2009.
[4] S. Misra and A. Jain, ”Policy controlled self-configuration in unattended
wireless sensor networks,” Journal of Network and Computer Applica-
tions, vol. 34, pp. 1530-1544, Sep. 2011.
[5] A. Farahzadi et al., ”Middleware Technologies for Cloud of Things - a
survey,” Digital Communications and Networks, 2017.
[6] R. Gupta and R. Gupta, ”ABC of Internet of Things: Advancements,
benefits, challenges, enablers and facilities of IoT,” 2016 Symposium
on Colossal Data Analysis and Networking (CDAN), Indore, 2016, pp.
1-5.

You might also like