Recently Farmer Suicides and Protests are all over the news. They have been committing suicides under pressure because of debts and money pressure. The main reason behind these problems is that they are not getting proper crop yield, sometimes their whole crop is destroyed by pest diseases, and also because of using primitive techniques to irrigate the field which results in overuse of water. So as a result a lot of freshwater also gets wasted. This has been our major objective behind the project. We will be providing a complete AI powered data analytics tool to the farmers to increase their Crop Yield by at least 60% and to use almost 50 per cent less water and also detect the diseases. Growing crops is a beautiful activity which makes a farmer proud of himself, for he has created a new life. Despite its beauty though, crop production requires varying farm activities and constant maintenance in order to provide a high and healthy yield.

Objectives & Purpose

We are building an IOT application for mobiles where the user can control the irrigation automatically or manually just by the touch of finger. IoT will be used to connect the valves in the farm through the wireless controllers that will be implanted on the fields which further can be accessed through Wireless devices like Mobile. Soil Moisture, Humidity, Temperature and Acoustic sensors will be deployed in the field which will collect the data about the soil and will be uploaded to a cloud server like ThingSpeak which the user can access and analyze about the quality of soil. Further, Machine Learning analysis by three different algorithms will be done on the data collected which will predict the crop yield and give instructions to increase it. Starting with the early crop stages, a farmer must closely monitor crops because of various crop insect pests and diseases. They tend to be the biggest threat to successful crop production. Depending on the crop type and growth stage, it's estimated that early pest detection can reduce yield loss by up to 20-40%. Therefore, farmers need to put all of their effort into constant crop monitoring. Therefore, through Deep Learning, image processing will be done on the leaves to identify pest diseases and alert the farmers before only so that they can take corrective measures. Also, through Artificial Neural Networks, we have created a web application which will recommend the best crops to grow in their land according to their soil parameters so that the user can get the maximum output and make profits.


1.) Saving Water with automated precision irrigation at the best possible time.
2.) Saving hundreds of man-hours and elimination the human factor.
3.) Machine Learning Analysis for Crop Recommendation based on the soil parameters.
4.) Combining sensors data and cloud intelligence to save even more resources.
5.) Pest Disease Detection through Deep Learning.


The implementation of the Machine Learning model was particularly challenging, as finding a suitable dataset online was difficult. Most datasets had a very small feature space, which hinders the model's ability to make inferences when two outputs share similar inputs. For the Crop Recommendation module, logistic regression was not able to give an accuracy greater than 75%. Given that an incorrect crop recommendation translates to wasted money for the user, this was unacceptable. After reading research papers on similar works, we decided to implement a multilayer perceptron with two hidden layers. We obtained an accuracy of 95% in the training set & 94.7% in the test set which is a huge achievement for us as the similar models or solutions that are existing cannot predict the crop with such high accuracy.

Cost Reduction

This is also a huge achievement that we are proud of, the main challenge to us was reducing the overall cost of this whole project because farmers cannot afford such huge prices of setting up this AI modules and system in their farm.
The second challenge was to provide internet signals to the whole farm because in such remote areas Internet is the major problem, Wi-Fi signals cannot reach such huge area covered by farms.
How we solved these problems
(Cannot Explain in the video as it would have taken a lot of time , though all this has been explained in the presentation file that I have included below To reduce the cost of the sensors, we can use a Drone video imagery and generate a heatmap of the whole farm, and then we can predict according to the texture of soil(from heatmap), that which areas have almost the same soil composition and then only apply the sensor module to one area only, that is how we can reduce the amount of senors that is used, for e.g. If previously we used 100 modules, now we have to use only 40. So that is a lot of cost reduction.
To solve the second challenge, we can set up a LORA network in the villages and then radiate the Wi-Fi Signals through TV White Spaces(shown in the presentation slide). TV white spaces are the unused spectrum in the TV satellite signals, which is wasted if we do not use it. So this technology solves this second problem of Internet.
But there is another problem, we are using drones for the imagery part, and drones are also expensive so in the place of drones we can use Helium Balloon Based video imagery which is a very cheap counterpart to drones.(explained in the presentation).

ANN Design

Data Preprocessing
The synthetic training data-set was loaded into a Pandas DataFrame & then split up into two matrices containing features (x) and targets (y) respectively. To mitigate the unfavorable effects of unbalanced feature ranges, and in an effort to smooth the optimization landscape, the features were normalized. This was done using sklearn's MinMaxScaler.

The structure of the ANN is {4 16 16 31}. The output layer is consists of a 1-hot encoded vector corresponding to one of the 31 different crop labels.

We used GridSearchCV to optimize the hyper parameters of the ANN. The following parameter values were obtained:

lr = 0.1 decay = 1e-9 momentum = 0.9 epochs = 1000 batch_size = 128

Training & Testing
The ANN obtained an accuracy of 0.923 in the training set, and an accuracy of 0.915 in the test set. This consistency suggests that overfitting has not occurred.

Exporting the ANN
Finally, the ANN is exported to the "layers" format used by TensorflowJS. This is done in the terminal by supplying the “tensorflowjs_converter" command a source and target path.


We faced problem in setting up the IoT module, also faced difficulty in finding the datasets of crop data for training the model like there were many null values in the dataset it took a lot of time to preprocess the data. It was difficult to find the best algorithm to achieve maximum accuracy, we tried three different algorithms and then came up with the conclusion that Deep Neural Networks was the bast model to achieve maximum accuracy so it took a lot of time.

What we learned

We learned how to deal with the complicated datasets present on the government websites as we invested a lot of time correcting it with encoding the data and other similar techniques, got to know how awesome it is to use IoT to control various things just by the click of a device.

Tech stack

IoT, CNN-Keras, Deep Neural Networks, Machine Learning, Deep Learning

We could not explain our whole project in detail in the YouTube video, so if you are interested please take our presentation through a video call so that we can explain all the details
Also Included our Presentation PDF in the Google Drive Link

Built With

Share this project: