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
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.
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)
Now, let’s create the app
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.
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
Now, join the app code blocks and define the function as in 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
|A1 Pin||Analogue OUT|
Arduino to 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
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.
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.
|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.