Saturday, July 13, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

IoT-Based Smart Agriculture System

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. 

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

BOM for Smart Agriculture System


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.

- Advertisement -

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 3.
Fig 4.
fig 5.

Now, let’s create the app 

App 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. 

- Advertisement -

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
App layout creation for IoT Based Smart Agriculture System
Fig 6. App layout creation
Fig 7.App layout view in phone

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

Fig 8.Fig 8. App code blocks 


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

Arduino Soil Sensor 
A1 Pin Analogue OUT 

Arduino to Relay

Arduino Relay
PIn 6 Relay In 1 
PIn 7 Relay 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

IoT Based Smart Agriculture System Connection
Fig 9.Connection

TestingAfter 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.App layout view in phone
Fig 11.
Fig 12. Showing the data.

TroubleshootingYou 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. Version erro
Fig 14. Bluetooth connectivity error

Download Source code

Relay  Solenoid valve
Relay NO1 Solenoid valve1 VCC
Relay NO2 Solenoid valve2 VCC(if using fertilizer spray system)
Arduino Bluetooth HC 05 

If you found this IoT project useful then you may also like
Top 30+ IoT Projects | IoT Project Ideas for Enthusiasts.

Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.


  1. This is a very interesting project..As well I saw the bill of quantities 1180 rupees ..what is this amount in USD?
    I am from Zimbabwe and am looking at implementing similar smart projects considering our good weather and soil for agriculture..

    +263772312243 ( phone/whatsapp)


Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components