🌩️

Smart Irrigation

 
Automatic and smart care of plants by proper watering and their monitoring.
notion image
notion image
 

Story

 

The Idea:

To make the irrigation system in gardens, farms and backyards more smart and automatic. Also to monitor the soil conditions.

Problem:

I have observed many a times that in some parks, water is not given properly to plants. There is overwatering (like a lot) at some plaes and completely dry (where vegetation dies) in some other. Across the Globe. almost 30% of irrigation water is wasted in over watering. To solve that I planned to make a device that controls the irrigating system properly. So that there is no over watering and all plants get the "required" amount of water.

Solution:

To solve this problem we can make a Internet connected device that controls he irrigation system. For better controls we need to also monitor the temperature as soil temps above 35C are also harmful for plants. And by watering little water we can reduce the temps. For Soil Moisture, a generic sensor can do the Job but a capacitive one is recommended.

Parts:

Wemos D1 Mini // Small IOT device // Main MCU
Soil Moisture Sensor
DS18B20 temp. sensor // for soil temperature // along with 4.7kOhm Resistor if not inbuilt
A good MOSFET- Infineon CoolMos MOSFET // for DC switching // Most Irrigating Motors/ Pumps/ Solenoids operate in DC // And it has less V drop. // and less current to run.
notion image
1 / 3 • Soil Moisture Sensor
The wiring scheme (schematics) have been attached below.

Goals:

  • To keep the soil moisture appropriate to plant’s requirement.
  • No need to worry of plant’s wilting when no one’s there to water your plants.

Working:

The Soil Temperature and Moisture sensor data is read by the MCU which sends that data to Blynk Cloud (the easiest and quickest tool). Then we can see the data on our smartphones with Blynk App and its Eventor Widget (the best one for me) easily can check the conditions and we can do the switching (of water) job without long code.

Coding:

Connect your MCU to PC and do all installation of boards and Arduino IDE (google search is good for that info) and upload the code attached. The code is very self Explanatory and simple. Just don't forget to install Bkynk and Dallas Library.

Blynk Part:

Download and Open Blynk App and create your account to get Auth Token you enter in the code. Then configure your "App" something like this:
notion image
You can change the widgets and tabs etc..
And get Eventor Widget and do conditions something like this:
notion image
You can change the settings
You can also add Email and Phone Notifications.
Don't forget to change soil moisture values, because it is different for each soil, sensor and calibration method.
Don't Forget to make your device waterproof, but hot gluing a box, or using simple plastic bag (like I did).

The Project Is Complete!

Finishing:

If you want a permanent setup, solder the pieces together or get a custom PCB. There are some chances of Improvement, if not using Internet, Main one being the code, which needs to do the condition checking with simple "ifs" locally.
notion image
1 / 3 • I just put it in soil upside down as I realised that I had put Soil Moisure Sensor on wring side.

Conclusion:

The project works. I took it to several parks to test it out and it works there as well with little adjustments.
The CoolMos MOSFET works really well. To switch AC two of them can be used (but I used on 12V DC instead of max 600V for safety concern). It consumed less current than a relay so can be directly addressed from a even 3.3V MCU (though I don't know how did it work). Overall, being so small CoolMos SJ MOSFET is silent, efficient and reliable for its work.

Schematics

Just explore it
 
notion image

Code

 
Smart GardeningArduino
Code..Change the values of token, ssid, pass and other pin definitions according to your requirement.Code is very easy and self explanatory
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS D1
OneWire oneWire(ONE_WIRE_BUS);
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "<enter your auth token generated>";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "SSID";
char pass[] = "password for ssid";


BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
  sensors.requestTemperatures();
  float t = sensors.getTempCByIndex(0);
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, t);
  Blynk.virtualWrite(V7,analogRead(A0));
}

void setup()
{
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8442);
  sensors.begin();
  // Setup a function to be called every second
  timer.setInterval(5000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
}