Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Based IR Sensor Object Detection System

Image of Arduino UNO Based IR Sensor Object Detection System

Circuit Documentation

Summary of the Circuit

This circuit consists of an Arduino UNO microcontroller board interfaced with an infrared (IR) sensor. The IR sensor is used to detect the presence of an object within its range. The Arduino UNO reads the output from the IR sensor and sends a serial message indicating whether an object is detected or not. The IR sensor is powered by the 5V supply from the Arduino and is grounded to the Arduino's ground (GND). The output of the IR sensor is connected to the digital pin D6 of the Arduino UNO.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13
  • Purpose: Acts as the central processing unit of the circuit, reading sensor data and providing debug output via serial communication.

IR Sensor

  • Description: An infrared sensor used for object detection.
  • Pins: out, gnd, vcc
  • Purpose: Detects the presence of an object and provides a digital output signal to the Arduino UNO.

Wiring Details

Arduino UNO

  • 5V: Provides power to the IR sensor.
  • GND: Common ground with the IR sensor.
  • D6: Receives the digital output signal from the IR sensor.

IR Sensor

  • VCC: Connected to the 5V output from the Arduino UNO.
  • GND: Connected to the ground (GND) on the Arduino UNO.
  • OUT: Sends the digital output signal to digital pin D6 on the Arduino UNO.

Documented Code

The following code is written for the Arduino UNO microcontroller to interact with the IR sensor:

void setup() 
{
  Serial.begin(9600);
  pinMode(6, INPUT);
  Serial.println("Serial Working");
}

void loop() 
{
  int ss = digitalRead(6);
  if (ss == LOW)
  {
    Serial.println("Object Detected");
  }
  else
  {
    Serial.println("Object Not Detected");
  }
}

Code Explanation

  • setup() function: Initializes the serial communication at 9600 baud rate and sets the digital pin D6 as an input to read the data from the IR sensor.
  • loop() function: Continuously reads the digital input from pin D6. If the pin reads LOW, it means the IR sensor has detected an object and prints "Object Detected" to the serial monitor. If the pin reads HIGH, it prints "Object Not Detected" to the serial monitor.

This code allows the Arduino UNO to provide immediate feedback on the status of object detection via the IR sensor.