IoT-Based Smart Agriculture System( IOT Project )

Most of us have a small garden, farmland or a plantation area. Our busy schedule, however, doesn’t allow us to maintain it well. But with the use of technology, we can easily achieve it. Work on high level projects based on IOT, AI, ROBOTICS in india with Society Of Computer Science.

So, today we are going to make an IoT-based smart agriculture system that can monitor soil moisture. Through this device, we will be able to automatically irrigate a piece of land and wirelessly spray fertilizers and pesticides using our phone while we are busy with other work.

So, let’s first gather the components for the project.

Bill Of Materials


fig 2

After that, we create a loop function where we create several ‘if’ conditions. Then, we have to create a ‘for’ function that will read the soil sensor data upto 160 times. Out of that, an average reading will be obtained which we can map (i.e. convert) in the range of 100 to get the moisture level output of soil in the range from 0 to 100 per cent. Best Technical Project By Society Of Computer Science in IOT, ROBOTICS, AI Based.

The earlier created ‘if’ condition will check the moisture percentages. In case that percentage is very low, then irrigation will automatically take place as per needed. (Refer fig 3,4,5)

fig 4
fig 5

Now, let’s create the app 

App Building ( Grayaaple Pvt. Ltd. Help For Your Application Building )

First, we create a layout of the app. This app uses an extension plugin that visualises the soil data in the form of a circular ring. (Society Of Computer Science Unit Of Grayapple Pvt. Ltd.)

You can download the .aia file attached here that includes all the pre-made features for that. Now, import it to your Kodular creator. In this app, we have added the following components using which, we have created a Smart Agriculture System app layout (Refer fig 6,7)


  • Circular bar extension
  • Bluetooth Client
  • List picker 
  • 4 Buttons 
  • 2 Text View
fig 6
fig 7

Now, join the app code blocks and define the function as in fig 8.

fig 8


Now connect the components together as described in the table below.

Connect the +ve wire of the 24 volt DC adaptor to the COM pin of the relay and -ve wire of the adaptor to the -ve wire of the valve.    

Arduino to Soil sensor connection

ArduinoSoil Sensor 
A1 PinAnalogue OUT 

Arduino to Relay

PIn 6Relay In 1 
PIn 7Relay In 2 

Relay to solenoid valve

Note: Supply power to the relay module with a separate 5V DC and not with Arduino pin and also check the relay type.Arduino to Bluetooth HC 05 connection

Testing After connecting the electronic components, cross-check that all of them are connected to the correct power source. Then put the soil sensor and pipe of the solenoid valve into the soil.Now install the app that we have made and then tap on the connect button (Refer fig 10). You will see a list of Bluetooth devices for connection. Select HC05. (Refer fig 11).After a successful connection, the Smart Agriculture System app will display the live soil sensor data as in Fig 12. If the soil moisture is below 50 per cent, then it means that the soil is dry and needs water, which will be automatically provided to it. After getting a sufficient amount, the supply will turn off. You can also spray fertilizers or pesticides using the app by tapping the spray on/off button. For that, you need to make an additional setup with the pipe to spray pesticides and fertilizers.

fig 10
fig 11
fig 12

Troubleshooting You might come across some errors while using the app (due to version or Bluetooth connectivity) as shown in Fig 13, 14. To get rid of them, simply go back or tap anywhere outside the error message box.

fig 13
fig 14

Download Source code

Relay Solenoid valve
Relay NO1Solenoid valve1 VCC
Relay NO2Solenoid valve2 VCC(if using fertilizer spray system)
ArduinoBluetooth HC 05 

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat
Welcome to Society Of Computer Science.

How may i help you?