Wet & Dry Waste Smart Dustbin for House | Best science Project | Harish Projects

Image
 Watch Full Detailed video 👇🏻 Diagram in Video👆 //Arduino Code// //YouTube: Harish Projects //Order Electronic Parts & Project kit:  HarishProjects.com // #include <Servo.h> Servo servo1; const int trigPin = 12; const int echoPin = 11; long duration; int distance=0; int potPin = A0; //input pin int soil=0; int fsoil; void setup()  {   Serial.begin(9600); //Serial.print("Humidity"); pinMode(trigPin, OUTPUT);  pinMode(echoPin, INPUT);  servo1.attach(8); } void loop()  { //YouTube: Harish Projects //Order Electronic Parts & Project kit:  HarishProjects.com //      int soil=0;   for(int i=0;i<2;i++)   { digitalWrite(trigPin, LOW); delayMicroseconds(7); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); delayMicroseconds(10); duration = pulseIn(echoPin, HIGH); distance= duration*0.034/2+distance; delay(10);   }   distance=distance/2;   Serial.println(distance); if ...

Automatic watering for Plants Best Arduino Project


 



                                                           ...........ARDUINO CODE..........


int WATERPUMP = 13; //motor pump connected to pin 13

int sensor = 8; //sensor digital pin vonnected to pin 8

int val; //This variable stores the value received from Soil moisture sensor.


void setup() {

  

  pinMode(13,OUTPUT); //Set pin 13 as OUTPUT pin

  pinMode(8,INPUT); //Set pin 8 as input pin, to receive data from Soil moisture sensor.

  //Initialize serial and wait for port to open:

  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps

  while (! Serial);// wait for serial port to connect. Needed for native USB

  Serial.println("Speed 0 to 255");

}


void loop()

  { 

  if (Serial.available()) //loop to operate motor

  {

    int speed = Serial.parseInt(); // to read the number entered as text in the Serial Monitor 

    if (speed >= 0 && speed <= 255)

    {

      analogWrite(WATERPUMP, speed);// tuns on the motor at specified speed 

    }

  }

  val = digitalRead(8);  //Read data from soil moisture sensor  

  if(val == LOW) 

  {

  digitalWrite(13,HIGH); //if soil moisture sensor provides LOW value send LOW value to motor pump and motor pump goes off

  }

  else

  {

  digitalWrite(13,LOW); //if soil moisture sensor provides HIGH value send HIGH value to motor pump and motor pump get on

  }

  delay(400); //Wait for few second and then continue the loop.

}

Comments

Arduino UNO R3 said…
Namaste ji
I am suderssan studying 9std
I cannot upload this
stk500_recv():Programmer is not responding
stk500_getsync() attempt 1 of 10:not in sync

Popular posts from this blog

Smart Bridge - Automatic Hight increase when flooding | Best science Project

How to make Phone control RC car using Arduino #phoneControlCar

Inspire Award Project | Train accident Prevention project | Best science Project / Harish Projects