Arduino Obstacle Avoiding Sensor Tutorial | Arduino IR Sensor Tutorial

Introduction: Arduino Obstacle Avoiding Sensor Tutorial | Arduino IR Sensor Tutorial

Hi guys in this instructables we will learn how to interface a obstacle avoiding IR sensor to arduino and with this sensor we can detect obstacles. If there will be an obstacle then led will glow otherwise not.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things You Need

For this instructables we will need following things :

Arduino uno

IR sensor

Jumper wires

Step 2: Schmatics

Please refer the shown schmatics and connect everything According to it.

Step 3: Code

Please copy the following code and upload it to your arduino Board :

const int IR_Sensor=2;

void setup() {

// initialize the digital pin as an output.

// Pin 13 has an LED on Arduino boards:

pinMode(13, OUTPUT);

//Pin 2 is connected to the output of IR_Sensor



void loop() {

if(digitalRead(IR_Sensor)==HIGH) //Check the sensor output


digitalWrite(13, HIGH); // set the LED on




digitalWrite(13, LOW); // set the LED off


delay(1000); // wait for a second


Step 4: Testing the Obstacle Avoiding Sensor

Place the object in front of IR proximity sensor and observe the change in LED connected to Pin 13 (on board LED)
When you remove object you will see it gets turned off.

Be the First to Share


    • LED Strip Speed Challenge

      LED Strip Speed Challenge
    • Sculpting Challenge

      Sculpting Challenge
    • Clocks Contest

      Clocks Contest