Towards fourth industrial revolution impact : Soil nutrient analysis based fertilizer recommendation system
Agriculture is considered key for human progress since ancient times but advancement in this sector is still a lot behind in almost 70% of areas of Pakistan. The major cause of the drop in yield is natural calamity and variations in the nutrients of soil
2025-06-28 16:29:51 - Adil Khan
Towards fourth industrial revolution impact : Soil nutrient analysis based fertilizer recommendation system
Project Area of Specialization Artificial IntelligenceProject SummaryAgriculture is considered key for human progress since ancient times but advancement in this sector is still a lot behind in almost 70% of areas of Pakistan.
The major cause of the drop in yield is natural calamity and variations in the nutrients of soil due to environmental changes. Overcoming the awful situations due to natural calamity challenges is arduous but technology can be adapted to understand the variations in the soil nutrients thereby helping the farmer community to find out positive solutions.
As per our research, one of the solutions to understand soil and fullfill its needs is soil sampling. It is very important to monitor the soil for a good yield. For this purpose, soil sampling is carried out to measure the nutrients left in your field following harvesting.
The soil analysis report does the following:
1. Tells you which nutrients are lacking or are in excess throughout the soil in a field.
2. Helps you determine the most favorable fertilizer plan to increase or maintain yields for the following year.
The previous solutions are somewhat not effective enough and following problems were identified during our research:
• Majorly farmers' choices or decisions regarding the crop, planting, and fertilizing are based on mere references, such as the history of use or advice from friends, fellow farmers, or extension officers when no consideration is made regarding specific soil fertility analysis.
• In recent years due to multiple fertilizers present in the market, farmers get confused and apply fertilizers famous around the area instead of the ones required by their fields. This leads to two significant problems:
1. Low yield
2. Soil pollution
• Research laboratories where soil analysis can be done are not easily accessible for every farmer. Mobile laboratories were introduced to solve the inaccessibility issues though farmers still do not take the time to take up their soils for testing terming it as a waste of time hence their failure.
To deal with the above problems, we propose a model that detects soil nutrients, soil temperature, and soil humidity using various sensors. Based on these factors/nutrients, it suggests the appropriate fertilizer that can be added to normalize the soil and increase yield as well as overcomes the tidious laboratory method practices and minimizes the gap between understanding of farmers with their soil's needs.
This project helps in achieving following objectives:
- To evaluate challenges experienced by farmers in determining soil fertility levels for crop fertilizer use.
- To design an NPK analysis/monitoring model and fertilizer recommendation for precision farming.
- To develop the analysis and recommendation model.
- To understand how soil factors influence crop yields.
- To understand how evaluation of machine learning tools can help in determining soil requirements.
- To validate the proposed model.
This project aims at developing a real-time soil nutrients detection and fertilizer recommendation model for farmers.

(figure 01: a display of overall idea)
The implementation follows 3 steps:
1. IOT based soil monitoring:
Some chemical and physical properties of soil, such as its moisture, temperature, soil nitrogen, phosphorous & potassium content heavily affect the yield of a crop.
In this step, a soil Nutrient Monitoring & Analysis System using which farmer can monitor all these parameters wirelessly on a mobile phone or the PC system.
Proposed Method:
Soil moisture,temperature, NPK (nitrogen, phosphorous,potassium)values are measured using Capacitive Moisture Sensor, Waterproof Temperature Sensor and Soil NPK Sensor respectively. All these sensors are interfaced with Arduino.
The data sensed from the circuit is then sent on to the server for monitoring. The server allows us to monitor the data in graphical and numerical format.
The agricultural field doesn’t have access to these networks. To solve this, we will use a Wireless Transceiver Module to send the data from Sensor Node to Gateway.

(figure 02: The real time physical soil monitoring system)
2. Machine learning based algorithm for fertilizer selection:
ML algorithm helps in determining suitable fertilizer required by soil for a better production and increase in yield, based on the basic nutrients in soil such as Nitrogen(N), Phosphorus(P) and Potassium(K).
Proposed Method:
- The algorithm to be used is called FFNN (Field Forward Neural Networks) which is used as a classification algorithm here.
- The RMS (root mean square function) will give us the difference between actual and predicted value. Based on this error loss, the optimization algorithm will improve our model's training.
- The classification is carried out by using SoftMax Activation Function at the last layer. It provides the probability of each class (fertilizer name) and the class having maximum probability will be our predicted fertilizer.

(figure 03: flowchart to carry out algorithm design)
3. How the recommendation can reach farmers (User Interface):
There are different ways to provide appropriate fertilizer recommendation derived from ML algorithm to farmers.
- In person recommendation
- Software application
- Web Application
Our approach:
In this project, we will use the third option i.e web application.
- The average values of soil analysis produced by real time system, that are available on the server, these values can be provided to the form available on website.
- On the back end of website, ML algorithm will be integrated by using Django framework.
- Upon inserting values, recommended fertilizers will be shown on the interface.
The purpose of web application is to provide an easy and simple user interface where farmers can insert their soil analysis report's values and get a suitable fertilizer recommendation.
(figure 04: Our designed UI for website)

Some properties of soil, such as its moisture, temperature, soil nitrogen, phosphorous & potassium content heavily affect the yield of a crop. Understanding the soil by adapting technology can be very useful for increase in production. This project helps in overcoming limitations for farmer community. Following are some advantages of this project:
- This approach helps farmer community to understand their soil and its needs well.
- Developing a real-time soil nutrients detection and fertilizer recommendation model for farmers replaces the tedious, time-wasting offsite soil testing practices.
- Helps in supplying the right amount of fertilizer for sustainable crop production and efficient balance between ecological and economic benefits.
- Helps in understanding how nutrients variability can be decomposed to effectively manage fertilizers in agriculture.
- Helps in understanding how soil factors influence crop yields.
- Helps in developing a precise and accurate model based on the evaluation of machine learning tools that can help in determining soil requirements.
Final deliverables include:
- A real time IOT device that can be installed on the fields to monitor important parameters of soil that effect the yield.
- A well-trained Machine Learning recommendation algorithm that helps in determining suitable fertilizer based on soil’s needs instead of guessing.
- A Django framework-based web application which provides a user interface for recommending fertilizers.
| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| Total in (Rs) | 76719 | |||
| Arduino UNO REV3 with cable | Equipment | 1 | 1850 | 1850 |
| ESP WROOM-32 development board | Equipment | 1 | 1299 | 1299 |
| NRF24L01+PA+LNA Transceiver Module | Equipment | 1 | 900 | 900 |
| Capacitive Soil Moisture Sensor v2.0 | Equipment | 2 | 1850 | 3700 |
| Waterproof Temperature Sensor | Equipment | 2 | 1800 | 3600 |
| MAX485 Modbus | Equipment | 2 | 800 | 1600 |
| 4.7K Resistor | Equipment | 10 | 12 | 120 |
| Power Adapter Supply AC to DC | Equipment | 1 | 2100 | 2100 |
| Jumper wires (Female to Female, Male to Male, Male to Female) | Equipment | 90 | 15 | 1350 |
| 4PC Breadboard Kit | Equipment | 1 | 2500 | 2500 |
| Soil EC NPK PH Sensor With RS485 Output | Equipment | 2 | 24000 | 48000 |
| Double A copier/printing paper 80G A4 Ream of 500 sheets | Miscellaneous | 1 | 1200 | 1200 |
| Printing | Miscellaneous | 350 | 10 | 3500 |
| Thesis binding | Miscellaneous | 1 | 2000 | 2000 |
| Thesis boards and posters | Miscellaneous | 1 | 3000 | 3000 |