Crop Recommendation Using Iot And Machine Learning

DOI : 10.17577/IJERTCONV11IS05036

Download Full-Text PDF Cite this Publication

Text Only Version

Crop Recommendation Using Iot And Machine Learning

Anusha K1

Dept. of E&C, Davanagere. Karnataka, India.

Anusha D J 2 Sunidhi K R3

Dept. of E&C, Dept. of E&C,

Jain institute of Technology, Jain institute of Technology.

Davanagere, Karnataka, India. Davanagere, Karnataka, India.

Trupthi G G4 Kiran Kumar K M5

Dept. of E&C, Dept. of E&C,

Jain institute of Technology, Jain institute of Technology.

Davanagere, Karnataka,India. Davanagere, Karnataka, India.


Agriculture plays a significant role in our daily lives. Farmer is a backbone of our country who needs agriculture for their duty. Farmers are facing problem in choosing right crops to grow. Changing in climatic conditions are the major problems that are faced among the farmhand. Remote technologies can be used to improve growing of crops from traditional agriculture to precision agriculture. The recently developed technologies include data analysis and IoT (Internet of Things). To cultivate the accurate crop at accurate time this can be done using Machine Learning Algorithm. The soil parameters such as nutrients, potassium, pH of soil and weather parameters such as temperature and humidity are collected from sensors like DHT11. The geolocations are fetched using the GPS receiver by communicating with the satellite.

Keywords: Agriculture, Precision Agriculture, Crop Recommendation System, KNN Algorithm, IoT, Machine Learning, Crops


The planned system is a smart agriculture system which helps farmers to grow crops and it increases the yield rate of productivity. This system is based on IoT and Machine Learning Algorithm. It finds

useful in agricultural sectors for farmers. The soil quality and weathers parameters are measured and stored in data collected. The dataset consists of parameters like nutrients, potassium, pH of soil, temperature, humidity of various places. This system is very helpful for illiterate peoples to choose which crop has to be sown.

Crop recommendation using IoT and machine learning is an emerging field in agriculture that aims to optimize crop production by leveraging the power of data analytics and automation. This approach involves the use of sensors and IoT devices to collect data such as soil moisture, temperature, humidity, and nutrient levels. This data is then analyzed using machine learning algorithms to make informed decisions about which crops to plant, when to plant them, and how much fertilizer and water to apply. The ultimate goal of crop recommendation systems is to increase yields, reduce waste, and improve the overall sustainability of agriculture. By providing farmers with accurate and timely recommendations based on real-time data, these systems can help them make. Overall, crop recommendation using IoT and machine learning is an exciting area of research with the potential to revolutionize the way we approach agriculture. By combining the power of data analytics, automation, and agricultural knowledge, we can work towards a more sustainable and efficient future for


informed decisions and optimize their resources. Moreover, these systems can also help to reduce the environmental impact of agriculture by minimizing the use of fertilizers and pesticides, and reducing water waste.


  1. Increase crop yield: One of the primary goals of a crop recommendation system is to increase crop yield.

  2. Reduce input costs: A crop recommendation system can help farmers reduce input costs by recommending the right amount of fertilizer, water, and pesticides based on real-time data.

  3. Optimize resource utilization: The system can help farmers make informed decisions about resource utilization by analyzing data on soil quality, weather patterns, and crop health.


    Crop recommendation using IoT and machine learning is a growing field of research, with a number of studies investigating its potential applications and benefits. Some keys are:

    [1] A study published in the Journal of Agricultural Science and Technology suggested that using machine learning algorithms to analyze data from soil sensors can significantly improve crop yield and reduce water usage. The study found that a crop recommendation system based on machine learning algorithms could increase crop yield by up to 28% while reducing water usage by up to 37%.

    algorithms to optimize crop management practices. The review noted that such systems can improve the efficiency of resource utilization, reduce waste, and increase sustainability in agriculture.

    [4] A study published in the Journal of Intelligent Systems reported the development of a crop recommendation system based on IoT sensors and machine learning algorithms for maize cultivation. The system was able to predict maize yield with an accuracy of 96.87% and recommend the optimal planting time and amount of fertilizer and water required for maximum yield.

    [5] A research article published in the Journal of Applied Remote Sensing explored the use of remote sensing technology to collect data on crop health and soil moisture for a crop recommendation system based on machine learning algorithms. The study found that the system could accurately predict crop yield and recommend the optimal irrigation and fertilization techniques for maximum yield.

    Overall, these studies demonstrate the potential of crop recommendation using IoT and machine learning to improve crop yield, reduce input costs, and increase sustainability in agriculture. Further research in this field could lead to more efficient and sustainable crop management practices, benefiting farmers and the environment alike.

    [2] Another study published in the International Journal of Agricultural and Biological Engineering explored the use of a crop recommendation system based on IoT sensors and machine learning algorithms to optimize nitrogen fertilizer application. The study found that the system could reduce nitrogen fertilizer usage by up to 44% while increasing crop yield by up to 27%.

    [3] A review article published in the Computers and Electronics in Agriculture journal highlighted the potential of using IoT sensors and machine learning



    Figure 1. Block diagrams of the proposed project

    Figure. shows various building blocks of the proposed project. IoT module esp32 development board is used. It is associated with a GPS module, push button, and LCD display, a flask web framework is used to receive the request from the IoT module, and the KNN Machine Learning algorithm is used to analyze data and recommend the crop. In this project using the GPS module to fetch the geo-locations of the particular field and it invokes by pressing the push button. Then the request is sent Flask web framework server which is connected to the machine learning model. Themodel includes the KNN algorithm and Euclidean distance based on k it creates the matrix then will build the voting model and will select the highest voted crop. Then the recommended crop is displayed on the LCD display.


    Figure 2: Design methodology of the proposed system

    • Location is taken using GPS from an Android application.

    • Co-ordinate values are sent to the rest soil grid website which returns the soil parameters of that particular location.

    • Here weve taken one such soil parameter for examle board work calculations.

      Data acquisition module:

      Their common function is to convert analogic signals like light, temperature, speed, etc. into digital signals for the computer.


      • KNN Algorithm is a Machine Learning Algorithm that is based on Supervised Machine Learning.

      • It is used to train machines using labeled data.

      • The model just needs to map the inputs with the outputs.

      • In this project, the KNN Algorithm is used to classify the data and split the data into training and testing.

      • It uses the Euclidean distance equation to classify the data and to find the nearest neighbor.

      • In KNN Algorithm the K value must be always an odd number to classify the data. Because the result is based on a voting system.

    Figure 3: KNN Algorithm



    The proposed project is to help farmers in choosing the correct and appropriate crops. Did this project by taking 2200 datasets of different crops that include soil parameters like nitrogen, phosphorus, pH of soil, and weather parameters like temperature and humidity. Taken 1700 for training and 500 datasets for testing. By considering these parameters will find crops by applying the KNN algorithm. The project, can achieve 85% accuracy and it is good efficiency.

    Figure 4: IoT Prototype

    The geometric parameters are read from the GPS module, then it invokes a request after pressing the push button. Then the request is sent to a Flask web framework server which is connected to the machine learning model.

    Figure 5: IoT Prototype displaying the result

    After completing the machine learning process, it will predict an appropriate and suitable crop and it will be displayed LCD display.


    In conclusion, crop recommendation using IoT and machine learning has great potential to revolutionize the agricultural industry by optimizing resource utilization, reducing input costs, and increasing crop yields while maintaining sustainability. By integrating data from IoT sensors, such as soil moisture and temperature sensors, with machine learning algorithms, crop recommendation systems can provide farmers with real-time information on crop health and environmental conditions, enabling them to make informed decisions about crop management practices. However, there are still challenges to be addressed in the implementation of these systems, such as the need for reliable and secure IoT infrastructure, the high cost of sensors and data storage, and the need for effective data analysis and interpretation. Nevertheless, ongoing research and development in this field hold promise for the future of agriculture, enabling farmers to make better use of resources, improve crop quality, and ultimately increase food production to feed a growing global population.


    1. Project could be further improved by increasing the volume of observation i.e., soil test data.

    2. AI models could be used to get more accurate results.



[1] M.V.R. Vivek, D.V.V.S.S. Sri Harsha, P.

Sardar Maran, A Survey on Crop Recommendation Using Machine Learning, International Journal of Recent Technology and Engineering (IJRTE) ISSN: 2277-3878, Volume- 7, Issue-5C, February (2019):120- 125

[2] Pradeepa Bandara, Thilini Weerasooriya, Ruchirawya T.H., Crop Recommendation System, International Journal of Computer Applications (0975 8887) Volume 175 No. 22,

October (2020):22-25

[3] C. Brouwer and M. Hei Bloem, Irrigation Water Management: Irrigation Water Needs, manual 6 Reading, ITALY: Food and Agriculture Organization of the United Nations, 1987.

[4] Dhruv Piyush Parikh, Jugal Jain, Tanishq Gupta, and Rishit Hemant Dabhade. Machine Learning Based Crop Recommendation System, International Journal of Advanced Research in Science, Communication and Technology (IJARSCT), Volume Issue 1, June (2021):891-897

[5] Dhruvi Gosai, Chintal Raval, Rikin Nayak, Hardik Jayswal, Axal Patel, Crop Recommendation System using Machine Learning, International Journal of Scientific Research in Computer Science, Engineering and Information Technology, May-June-2021, Volume 7, Issue 3 Page Number: 554-557

[6] Rohit Kumar Rajak, Ankit Pawar, Mitalee Pendke, Pooja Shinde, Suresh Rathod, Avinash Devare, Crop Recommendation System to Maximize Crop Yield using Machine Learning Technique, International Research Journal of Engineering and Technology (IRJET) Volume: 04 Issue: 12 | Dec-2017:950-953

[7] Kamatchi, S. Bangaru, and R. Parvathi. "Improvement of Crop Production Using Recommender System by Weather Forecasts." Procedia Computer Science 165 (2019): 724732.

[8] Medar, Ramesh, Vijay S. Rajpurohit, and Shweta Shweta. "Crop yield prediction using machine learning techniques." In 2019 IEEE 5th International Conference for Convergence in Technology (I2CT), pp. 1-5. IEEE, 2019.

[9] Jain, Sonal, and Dharavath Ramesh. "Machine Learning convergence for weather-based crop selection." In 2020 IEEE International Students' Conference on Electrical, Electronics and Computer Science (SCEECS), pp. 1-6. IEEE, 2020.

[10] 2019 10th International Conference on Computing, Communication, and Networking Technologies, Low-cost iot+ml design for smart farming with multiple applications, Fahad Kamraan Syed, Agniswar Paul, Ajay Kumar, Jaideep Cherukuri.

[11] 2020 International Conference for Emerging Technology (INCET) Machine learning Implementation in IoT based Intelligent System for Agriculture, Bhanu K N, Jasmine H, Mahadevaswamy H S.

[12] 2018 International Conference On Advances in Communication and Computing Technology (ICACCT) Plant disease detector, Jagadish Kashinath Kamble.

[13] Indian J.Sci.Res. 17(2): 181-182, 2018 Crop

handan android based crop and fertilizer advisor, Sundrameenakshi.G, Jayasuriya.A, Srioviya.G, Sumathi V.P.

[14] 2018 Open Access International Journal of Science & Engineering Android application for crop yield prediction and crop disease detection, Mayuresh Deodhar, Rushikesh Bhave, Kevin Bhalodia, Mansing Rathod.

[15] 2018 Fourth International Conference on Computing Communication Control andAutomation (ICCUBEA) Agro Consultant: Intelligent Crop Recommendation System Using Machine Learning Algorithms, Zeel Doshi, Rashi Agrawal, Subhash Nadkarni, Prof. Neepa Shah.