smart AGRICULTURE part1|| vcb ea.


Components required:

1.  Arduino uno
2. 5V Motor pump
3. Bread board
4. OLED display
5. Capacitive soil moisture sensor

Circuit connections are given below the code. Demo video is also available.

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>

#define OLED_RESET 4

Adafruit_SSD1306 display(OLED_RESET);

const int AirValue = 790;   

const int WaterValue = 390;

int intervals = (AirValue - WaterValue)/3;  

int soilMoistureValue = 0;

int soilmoisturepercent=0;

  void setup() {

  // put your setup code here, to run once:

  pinMode(A0,INPUT);

  pinMode(4,OUTPUT);

  Serial.begin(9600);

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //initialize with the I2C addr 0x3C (128x64)

  display.clearDisplay();

}

void loop() {

  // put your main code here, to run repeatedly:

  soilMoistureValue = analogRead(A0);  //put Sensor insert into soil

  Serial.println(soilMoistureValue);

  soilmoisturepercent = map(soilMoistureValue, AirValue, WaterValue, 0, 100);

  Serial.println(soilmoisturepercent);

if(soilMoistureValue >0 && soilMoistureValue <=500)

 {

  Serial.println("Very Wet");

  digitalWrite(4,LOW);

 } 

else if(soilMoistureValue >500 && soilMoistureValue <=600)

 {

  Serial.println("Wet");

  digitalWrite(4,LOW);

 }

else if(soilMoistureValue >600)

 {

  Serial.println("Dry");

  digitalWrite(4,HIGH);

 }

if(soilMoistureValue >0 && soilMoistureValue <=500) 

 {

  Serial.println("Very Wet");

  display.setCursor(0,0);  //oled display

  display.setTextSize(2);

  display.setTextColor(WHITE);

  display.println("s-moisture is good");

  display.display();

  delay(250);

  display.clearDisplay();

 } 

else if(soilMoistureValue >500 && soilMoistureValue <=600)

 {

  Serial.println("Wet");

  display.setCursor(0,0);  //oled display

  display.setTextSize(2);

  display.setTextColor(WHITE);

  display.println("s-moisture enough");

  display.display();

  delay(250);

  display.clearDisplay();

 }

else if(soilMoistureValue >600)

 {

  Serial.println("Dry");

  display.setCursor(0,0);  //oled display

  display.setTextSize(2);

  display.setTextColor(WHITE);

  display.println("motor turned on");

  display.display();

  delay(250);

  display.clearDisplay();

 }

}

soil moisture value of 615 indicates that the soil moisture percentage is 43. soil moisture percent and soil moisture value are inversely proportional. so, soil moisture value of 610 indicates soil moisture percent is around 45. so if soil moisture percent is less than 45,i.e., soil moisture value is greater than 610 indicates that the soil is dry, so that motor will be turned on.

Subscribe here to vcb ea

INTERFACING WITH OLED DISPLAY :

     oled display: 

   the picture above is oled display. If you observe it has 4 pins. connect vcc to 5V of           arduino and connect "GND" to ground of arduino uno.
   Connect SCL pin to A5 of arduino uno and connect SDA pin to A4 of arduino uno.
   OLED display communicates with arduino through I2C serial communication.

   LIBRARIES TO BE INCLUDED ARE :

    1.)SSD 1306
    2.)Adaifruit gfx
   Insallation procedure is shown through the images below
  Step 1:     sketch ->include library -> manage library 
   
sketch ->include library -> manage library

  Step 2: type ssd1306 , install it ,and then type adaifruit gfx and install it. and then          you  are done with installing required libraries for working of display.
  Check this tutorial to install those libraries.
  Subscribe here to vcb ea
    
   

circuit connections


                                 

working procedure is explained in the video.

Well , nothing is new in this right?, Thats why we came up with a new idea, this idea is originated by discussing on "are there any ways to use water effeciently in between two fields and transfer water from one field to another field if it is needed"???? 
ohhh!!!, is this possible??
yes, it is!!. how ??

Inter connection of water resources



If you found this helpful, please subscribe to my channel. Subscribe here your support is appreciated.



  

Comments

Post a Comment

Popular posts from this blog

controlling servo motor based on the speed measured by the ultrasonic sensor in tinker cad

basic interfacing with servo motor.