Obstacle Detection using IR Sensor

 Obstacle Detection using IR Sensor

Just Arduino Things | TW TechieTube

Detect an Obstacle and Make an Alarm system.


Principle:

Infrared rays are transmitted

Components Required:

  • Arduino UNO                 (1)                        
  • IR Sensor                        (1)
  • Breadboard                     (As per Requirement)
  • Jumper Cables                (As per Requirement)
  • Arduino Bus Cable         (1)

Construction:

A Simple project to detect object using the InfraRed Sensor.


Now connect the Sensors pins with the order given,

Vcc  - Arduino 5v/3.3v Pin
Gnd  - Arduino Gnd Pin
Data - Any Digital Pins except D1/D2 on UNO.
Incl.  an LED/Buzzer in D13 and Gnd for external value. 

As explained in the Video, the Code is written as Follows.

Code:

int led = 13;
int sensor = 2;

void setup() {
  pinMode(led, OUTPUT);
  pinMode(sensor, INPUT);
  Serial.begin(9600);
}

void loop() {
  int sensorval = digitalRead(sensor);
  Serial.println(sensorval);
  
  if (sensorval == HIGH) {
    digitalWrite(led, HIGH);
  }
  else {
    digitalWrite(led, LOW);
  }
}

Do make the Project, Take a Snap and Tag us @techwiz_india

Comments

Popular posts from this blog

Buzzer Alarm using Touch Sensor

Human Detection using PIR Sensor