Automatic Barrier Opening System using arduino

Automatic Barrier Opening system


Hello! I am Shlok Jain. I have made Automatic Barrier Opening System. It's a very easy task to make this.

If you hane not viewed my youtube video then go and view it. Here it is.

Also don't forget to like, share, and subscribe my channel. 


Materials Required

  • Arduino UNO
  • Ultrasonic sensor
  • Servo motor
  • some jumper wires
  • breadboard



Steps to make it


Step 1:Make connections according to given circuit diagram.


Step 2: Now download arduino IDE.

Now open application. Clear everything written on it. And paste following code there.


                    
#include<Servo.h>

int trig=2 , echo=3;
Servo servo;

void setup()
{
  servo.attach(5);
  pinMode(trig,OUTPUT);
  pinMode(echo,INPUT);
}

void loop()
{
  long samay,dist;
  digitalWrite(trig,LOW);
  delay(2);

  digitalWrite(trig,HIGH);
  delay(10);

  digitalWrite(trig,LOW);

  samay=pulseIn(echo,HIGH);
  dist= samay*0.034/2;

  if(dist<10)
  {  
    servo.write(90);
    delay(2000);
  }

  else
  { 
    servo.write(0);   
  }
}
                        
                        



Step 3:Now connect arduino UNO board with computer/laptop with cable that comes with arduino uno.

And upload code.

Step 4:Now we are done!!!!!
Subscribe my youtube channel for more such videos.


My other projects
Distance measuring device without LCD, jumper wire , breadboard-https://arduinoprojectswithshlok.blogspot.com/2021/02/distance-measuring-device-arduino-based.html

Thief detecting robot-https://arduinoprojectswithshlok.blogspot.com/p/detecting-device-arduino-hello-i-am.html

Comments

Popular posts from this blog

Arduino IDE Dark Theme | Change Arduino IDE theme to dark