Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Uno R3 Based IR Sensor Intrusion Detector

View and Edit Project In Cirkit DesignerImage of Arduino Uno R3 Based IR Sensor Intrusion Detector

Circuit Documentation

Summary

This circuit is designed to detect the presence of an object using an IR sensor module and signal the detection through an LED. The core of the circuit is an Arduino Uno R3 microcontroller, which reads the output of the IR sensor and controls the LED accordingly. The IR sensor's output is connected to one of the digital pins of the Arduino, and the LED is driven by another digital pin through a current-limiting resistor to protect the LED from excessive current.

Component List

Arduino Uno R3

IR Sensor Module

LED: Two Pin (red)

Resistor

Wiring Details

Arduino Uno R3

IR Sensor Module

LED: Two Pin (red)

Resistor

Documented Code

// Code for Arduino Uno R3
// This code is designed to detect the presence of an object using an IR sensor and signal through an LED.

int irSensorPin = 12;     // Pin connected to IR sensor output
int ledPin = 8;           // Pin connected to LED

void setup() {
  pinMode(irSensorPin, INPUT);  // Set IR sensor pin as input
  pinMode(ledPin, OUTPUT);      // Set LED pin as output
  
  Serial.begin(9600);           // Initialize serial communication
}

void loop() {
  int sensorState = digitalRead(irSensorPin);  // Read IR sensor value
  
  if (sensorState == LOW) {  // If sensor detects an object
    digitalWrite(ledPin, HIGH);  // Turn on LED
    Serial.println("Someone entered or exited the classroom!");
  } else {
    digitalWrite(ledPin, LOW);   // Turn off LED
  }
  
  delay(100);  // Short delay to stabilize readings
}

The code is written for the Arduino Uno R3 microcontroller. It initializes the IR sensor and LED pins, reads the state of the IR sensor, and turns the LED on or off based on the presence of an object. Serial communication is also initialized for debugging purposes.