An Optimization Clustering and Classification Based On Artificial Intelligence Approach For Internet of Things in Agriculture
An Optimization Clustering and Classification Based On Artificial Intelligence Approach For Internet of Things in Agriculture
Corresponding Author:
Panana Tangwannawit
Faculty of Sciences and Technology, Phetchabun Rajabhat University
Phetchabun, Thailand
Email: [email protected]
1. INTRODUCTION
Artificial intelligence (AI) is a technology to enable machines, computers, and statistical tools and
equipment to create software that can imitate human capabilities especially on the very complex tasks e.g.,
memories, classification, reasoning, decision, prediction, and even communication with human beings, all
through algorithms. In some cases, AI can be improved through self-learning which consists of 3 levels:
machine learning [1], machine intelligence [2], and machine consciousness [3]. Machine learning is one of
AI capabilities which the machine can learn on its own.
This research used a combination of internet of things (IoT), big data, and AI technology and
integrated into agricultural system as a more effective alternative to help solve existing problems the farmers
are facing. This could improve the speed, increase crop yields, and enable more effective use of natural
resources for the users, or farmers which are the main objectives for this study. This research integrateds AI,
IoT, and big data with 3 main actions: i) to analyze the classification of data to find optimum amount of
water required, ii) to compare the algorithm of watering system, and iii) to improve the automated watering
system based on the algorithm obtained.
𝑛 = ∑𝑧𝑖=1 = 𝑥𝑖 𝑤𝑖 + 𝑏 (1)
𝑃(𝐵|𝐴)×P(𝐴)
𝑃(𝐴|𝐵) = (2)
𝑃(𝐵)
performance metrics used for experiment is accuracy and the evaluation of the algorithm operation is based
on root mean square error (RMSE). Accuracy, with the (3):
𝑇𝑃+𝑇𝑁
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = ( ) × 100 (3)
𝑇𝑃+𝑇𝑁+𝐹𝑁+𝐹𝑃
2.3. Maize
Maize has tall stems which can range from 60 cm up to 6meters tall depending on the species. The
diameter of the stem ranges from 1.27-5.08 cm. It takes approximately 100-120 days to be fully grown [18].
It is considered one of the economic crops in Thailand. In 2019-2020, it was found that the land for growing
these crops throughout the country were declining. This is due to the fact that the land for growing these
crops were left empty and farmers were unable to grow these crops due to drought from delays of rain and
insufficient amount of natural water reserve. While the growing or crop is declining, there are still increasing
demands of the maize in the country especially in farming business where maize is the main ingredient to
make animal food for up to 7.41 million tons per year, while the annual supply is only 4.62 million tons [19].
The data classification methodology, it will be divided into 2 data sets. First, training set is a set of
data used to train AI. This type of data is used to find variable which help the model function properly. While
test set can measure the efficiency before bringing them to build AI. After that, choosing pattern for AI is
conducted to select the appropriate algorithm.
3. RESEARCH METHOD
From Figure 1 showed the steps to find algorithm is as follows:
3.1. IoT
Based on previous research, devices for the router node were installed which consists of Arduino
Uno R3, soil moisture sensor, temperature and humidity sensor (DHT11), NODEMCU ESP8266 module,
and battery pack as one set of installation. The entire research required 20 sets of the mentioned system to
cover 1,200 square meters of land for the experiment with one set of the device with coordinator node,
consisted of Arduino Uno R3, NODEMCU ESP8266, and water pump, shown in Figure 2. Each type of
sensors receives the data in a form of analog and digital which required python language to improve by
collecting data from the sensors through arduino board. Arduino board was used to read and deliver the data
to cloud system through web service. Cloud system received the data and record them into database, firebase,
by collecting, separating the data based on different measurements such as humidity and temperature from
soil moisture sensor and DHT11. This information was passed through a wireless model NODEMCU
ESP8266. The humidity and temperature sensors operated by having NODEMCU ESP8266 linked with wifi,
sending the information through to firebase with data collection conditions to capture at 8 different times
which was pre-designed since the start of the programming of arduino ide.
Figure 2. The prototype IoT and design of hardware sensors for maize area
humidity and temperature from each station. Data was then pulled from cloud system to analyze the
appropriate value to predict the right amount of water to grow the crops in the future.
3.3. AI
From Figure 3, the steps to finding best algorithm for prediction. There are several tools available
for the application of machine learning algorithms to data cleansing, imputation data, clustering, and
prediction data. After a review of data science tools, RapidMiner is one of the best tools for data science and
machine learning because it allows extremely fast and easy in data analytics [29].
Sensors captured the data every day for 30 consecutive days at 8 different time points: 1 am, 4 am,
7 am, 10 am, 1 pm, 4 pm, 7 pm, and 10 pm. In total, there will be 20 data sets x 8 different time points x
30 days = 4,800 records. There might be some data lost when collecting from the sensors, so this research
used cleansing and imputation with deep learning algorithm and assigned rectified linear unit (ReLU)
technique to collect temperature and humidity data.
After that, classifying the quality of the plantation with attributes such as time, station, temperature,
humidity, and soil moisture were then tested with the k-mean clustering technique to identify the appropriate
cluster. The result showed that the most appropriate cluster is cluster 3 where the elbow point and the best
point from average within centroid distance is 34.643 and from davies bouldin is 0.959 as shown in Table 2.
After all 3 points were identified, different classes were created by giving high, medium, and no water to the
crops.
Next, these 3 different classes were used in the experiment to provide the appropriate amount of
water and monitor by using several sensors consisted of soil moisture sensor, DHT11 sensors to measure the
temperature and soil moisture. It was found that for the class that require high amount of water, it needs a
total of 15 minutes to water them, while 10 minutes is required for the class with medium amount of water.
These conditions would create the soil that is moist enough to provide the appropriate condition for
plantation. By analyzing the data with data selection, training data and test data were used with cross
validation method to compare each model and create optimized parameter to find the most appropriate value
in each model. From Table 3, the results from optimization of artificial neural network showed that the most
appropriate value that was used to compare with other algorithms is the value of number of folds at 7 folds
and training cycle at 18 cycles with accuracy at 99.37% and RMSE value=0.0166. The results from
optimization of decision tree showed that the most appropriate value that was used to compare with other
An optimization clustering and classification based on … (Sakchai Tangwannawit)
206 ISSN: 2252-8938
algorithms is the value of number of folds at 7 folds and gain ratio as criterion with the accuracy at 99.35%
and RMSE=0.0053.
Table 3. Results from the algorithm comparison of the analysis of data on humidity and temperature
Algorithm Accuracy RMSE
Artificial neural network 99.37% 0.0166
Decision tree 99.35% 0.0053
Naïve bayesian 97.46% 0.0338
Deep learning 99.60% 0.0039
The results from optimization of naïve bayes showed that the most appropriate value that was used
to compare with other algorithms is the value of number of folds at 11 folds with accuracy at 97.46% and
RMSE=0.0338. The results from optimization of deep learning showed that the most appropriate value that
was used to compare with other algorithms is the value of number of folds at 9 folds with accuracy at 99.60%
and RMSE=0.0039. From the optimization, the best model was then created by looking at the accuracy and
root mean square error, RMSE. The results showed that deep learning algorithm provided the highest
accuracy at 99.60% with root mean square error at 0.0039. From Figure 4, the design and improvement of the
automated watering system was divided into 2 main parts:
was written in the Arduino board to control the water pump system in releasing the appropriate amount of
water into the experiment area.
4.2. Calculate the amount of water required to grow the maize through statistical methodology
Watering the crops through statistical methodology required the calculation of amount of water
needed for each type of plants with details as follows: evapotranspiration means the total amount of water
lost from the planting area to the atmosphere in the form of steam which consisted of transpiration and
evaporation process. The coefficient of water usage in each type of plants is unequal. The same type of plant
might also have different water usage coefficient depending on the age as well. The water usage coefficient
of maize can be referred from the data from department of agriculture [30] as shown in Table 4.
Finding the amount of water usage of the plants referring to 𝐸𝑇𝑝 can be calculated by relying on the
statistic of the climate in Thailand from Meteorological Department, Ministry of Digital Economy and
Society [31]. 𝐸𝑇𝑝 of the planting area in Phetchabun province [32] was calculated as shown in Table 5.
Table 5. Amount of water used by plants referred to the planting area in Phetchabun province [31]
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
ETp 3.33 4.05 4.96 5.18 4.16 3.69 3.58 3.43 3.22 3.69 3.73 3.41
𝐸𝑇 = 𝐾𝑐 × 𝐸𝑇𝑝 (5)
= 0.63 × 4.16
= 2.6208 𝑚𝑚 𝑝𝑒𝑟 𝑑𝑎𝑦
The amount of water required to grow maize in a month is equal to 2.6208×30= 78.624 mm. Total amount of
water needed for 1,200 square meters=1,200 square meters x (78.624/1000 mm)=94.3488 cubic meters per
month or approximately 94,349 liters per month which when compared to the amount of water used through
the automated watering controller, it would require significantly less amount of water to grow the plants in
the same area, with only 13,099 liters required for the automated water control. This can help save up to
13.89% of water usage within the 1,200 square meter planting area.
5. CONCLUSION
This research used deep learning to identify the missing value which is a popular technique used for
this type of research for data cleansing and imputation purpose. After that, the data underwent clustering to
different groups with k-mean technique. Based on the temperature and soil moisture data, 3 classes of
optimized data were obtained and used to identify the appropriate prediction value. By comparing the best
accuracy value and RMSE value, it was found that deep learning algorithm resulted in the best value. Once
algorithm was received, it was then written into the arduino board of the coordinator router to regulate the
watering system. Sensor data from the router was further analyzed to provide the right amount of water based
on the class predicted. Results from the experiment showed that after 30 days of testing, the new system can
save 13.89% water more than the conventional system. For future work, more sensors should be installed to
collect more information for further analysis such as sunlight sensors and mineral detectors in soil. This
methodology can be applied to other types of plants and drone system can also be incorporated to collect data
in a form of videos to analyze the growth of the crops or identify pests as well.
ACKNOWLEDGEMENTS
This research is supported by Faculty of Information Technology and Digital Innovation, KMUTNB
and Faculty of Sciences and Technology, PCRU. This research is supported by the Thailand Science
Research and Innovation, and Phetchabun Rajabhat University, with project No. 65A145000002.
REFERENCES
[1] P. Hebron, Machine learning for designers. O’Reilly Media, 2016.
[2] N. Buduma, Fundamentals of deep learning: designing next-generation machine intelligence algorithms. O’Reilly Media, 2017.
[3] A. Julianto and A. Sunyoto, “A performance evaluation of convolutional neural network architecture for classification of rice leaf
disease,” IAES International Journal of Artificial Intelligence (IJ-AI), vol. 10, no. 4, pp. 1069–1078, Dec. 2021, doi:
10.11591/ijai.v10.i4.pp1069-1078.
[4] B. Annanurov and N. Noor, “A compact deep learning model for Khmer handwritten text recognition,” IAES International
Journal of Artificial Intelligence (IJ-AI), vol. 10, no. 3, pp. 584–591, Sep. 2021, doi: 10.11591/ijai.v10.i3.pp584-591.
[5] S. Verma, G. T. Thampi, and M. Rao, “ANN based method for improving gold price forecasting accuracy through modified
gradient descent methods,” IAES International Journal of Artificial Intelligence (IJ-AI), vol. 9, no. 1, pp. 46–57, Mar. 2020, doi:
10.11591/ijai.v9.i1.pp46-57.
[6] C. C. Aggarwal, “Training deep neural networks,” in Neural Networks and Deep Learning, Cham: Springer International
Publishing, 2018, pp. 105–167.
[7] O. I. Abiodun, A. Jantan, A. E. Omolara, K. V. Dada, N. A. Mohamed, and H. Arshad, “State-of-the-art in artificial neural
network applications: a,” Heliyon, vol. 4, no. 11, Nov. 2018, doi: 10.1016/j.heliyon.2018.e00938.
[8] L. Kanagasabai, “Shrinkage of power loss by enriched brain storm optimization algorithm,” IAES International Journal of
Artificial Intelligence (IJ-AI), vol. 8, no. 1, pp. 1–6, Mar. 2019, doi: 10.11591/ijai.v8.i1.pp1-6.
[9] R. S. El-Sayed and M. N. El-Sayed, “Classification of vehicles’ types using histogram oriented gradients: comparative study and
modification,” IAES International Journal of Artificial Intelligence (IJ-AI), vol. 9, no. 4, pp. 700–712, Dec. 2020, doi:
10.11591/ijai.v9.i4.pp700-712.
[10] M. Morgan, C. Blank, and R. Seetan, “Plant disease prediction using classification algorithms,” IAES International Journal of
Artificial Intelligence (IJ-AI), vol. 10, no. 1, pp. 257–264, Mar. 2021, doi: 10.11591/ijai.v10.i1.pp257-264.
[11] T. A. Assegie, R. L. Tulasi, and N. K. Kumar, “Breast cancer prediction model with decision tree and adaptive boosting,” IAES
International Journal of Artificial Intelligence (IJ-AI), vol. 10, no. 1, pp. 184–190, Mar. 2021, doi: 10.11591/ijai.v10.i1.pp184-
190.
[12] S. Marzukhi, N. Awang, S. N. Alsagoff, and H. Mohamed, “RapidMiner and machine learning techniques for classifying aircraft
data,” Journal of Physics: Conference Series, vol. 1997, no. 1, Aug. 2021, doi: 10.1088/1742-6596/1997/1/012012.
[13] M. H. Ali and N. K. Ali, “IoT based security system and intelligent home automation multi monitoring and control systems,”
IAES International Journal of Robotics and Automation (IJRA), vol. 8, no. 3, pp. 205–210, Sep. 2019, doi:
10.11591/ijra.v8i3.pp205-210.
[14] A. H. Ali, A. H. Duhis, N. A. L. Alzurfi, and M. J. Mnati, “Smart monitoring system for pressure regulator based on IOT,”
International Journal of Electrical and Computer Engineering (IJECE), vol. 9, no. 5, pp. 3450–3456, Oct. 2019, doi:
10.11591/ijece.v9i5.pp3450-3456.
[15] V. S. Padala, K. Gandhi, and P. Dasari, “Machine learning: the new language for applications,” IAES International Journal of
Artificial Intelligence (IJ-AI), vol. 8, no. 4, pp. 411–421, Dec. 2019, doi: 10.11591/ijai.v8.i4.pp411-421.
[16] S. Chen et al., “Internet of things based smart grids supported by intelligent edge computing,” IEEE Access, vol. 7, pp. 74089–
74102, 2019, doi: 10.1109/ACCESS.2019.2920488.
[17] S. Chatterjee, A. K. Kar, and M. P. Gupta, “Success of IoT in smart cities of india: an empirical analysis,” Government
Information Quarterly, vol. 35, no. 3, pp. 349–361, Sep. 2018, doi: 10.1016/j.giq.2018.05.002.
[18] “Agricultural economics of mize.” Office of Agricultural Economics, Ministry of Agriculture and Cooperatives, 2020.
[19] “The study report project on suatainable consumtion and production of maize supply chain in Thailand,” Mimistry for the
Environment, Nature Conservation, 2018.
[20] P. Tangwannawit, “Development of of smart internet of things (IoT) for local vegetables,” in The 15th National Conference and
International Conference on Applied Computer Technology and Information Systems, 2019, pp. 134–146.
[21] A. Riansyah, S. Mulyono, and M. Roichani, “Applying fuzzy proportional integral derivative on internet of things for figs
greenhouse,” IAES International Journal of Artificial Intelligence, vol. 10, no. 3, pp. 536–544, Sep. 2021, doi:
10.11591/ijai.v10.i3.pp536-544.
[22] P. Tangwannawit and K. Saengkrajang, “An internet of things secosystem for planting of coriander (Coriandrum sativum L.),”
International Journal of Electrical and Computer Engineering (IJECE), vol. 11, no. 5, pp. 4568–4576, Oct. 2021, doi:
10.11591/ijece.v11i5.pp4568-4576.
[23] N. Seman and N. Atiqah Razmi, “Machine learning-based technique for big data sentiments extraction,” IAES International
Journal of Artificial Intelligence (IJ-AI), vol. 9, no. 3, pp. 473–479, Sep. 2020, doi: 10.11591/ijai.v9.i3.pp473-479.
[24] S. Tangwannawit and P. Tangwannawit, “Artificial intelligence theory and applications.” Artificial Intelligence Association of
Thailand, pp. 36–80, 2020.
[25] A. M. Abdu, M. M. M. Mokji, and U. U. U. Sheikh, “Machine learning for plant disease detection: an investigative comparison
between support vector machine and deep learning,” IAES International Journal of Artificial Intelligence (IJ-AI), vol. 9, no. 4, pp.
670–683, Dec. 2020, doi: 10.11591/ijai.v9.i4.pp670-683.
[26] A. Ullah, “Artificial bee colony algorithm used for load balancing in cloud computing: review,” IAES International Journal of
Artificial Intelligence (IJ-AI), vol. 8, no. 2, pp. 156–167, Jun. 2019, doi: 10.11591/ijai.v8.i2.pp156-167.
[27] N. A. K. Rosili, R. Hassan, N. H. Zakaria, S. Kasim, F. Z. C. Rose, and T. Sutikno, “A systematic literature review of machine
learning methods in predicting court decisions,” IAES International Journal of Artificial Intelligence (IJ-AI), vol. 10, no. 4, pp.
1091–1102, Dec. 2021, doi: 10.11591/ijai.v10.i4.pp1091-1102.
[28] N. A. Mashudi, N. Ahmad, and N. M. Noor, “Classification of adult autistic spectrum disorder using machine learning approach,”
IAES International Journal of Artificial Intelligence (IJ-AI), vol. 10, no. 3, pp. 743–751, Sep. 2021, doi:
10.11591/ijai.v10.i3.pp743-751.
[29] “RapidMiner reviews,” Gartner. https://www.gartner.com/reviews/market/data-sciencemachine-learning-
platforms/vendor/rapidminer/reviews (accessed Feb. 28, 2021).
[30] “Reference crop evapotranspiration by penman monteith.” Department of Agriculture, Thailand, 2019.
[31] “Water usage of the plants.” Meteorological Department, Ministry of Digital Economy and Society, 2019.
[32] P. Tangwannawit and K. Saengkrajang, “Technology accept ance model to evaluate the adoption of the internet of things for
planting maize,” Life Sciences and Environment Journal, vol. 22, no. 2, pp. 262–273, 2021, doi: 10.14456/lsej.2021.13.
BIOGRAPHIES OF AUTHORS