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

Arduino Uno R3 Based IR Sensor Intrusion Detector

Image 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

  • Description: A microcontroller board based on the ATmega328P.
  • Pins: USB Port, Power Jack, Not Connected, IOREF, RESET, 3.3V, 5V, GND, VIN, A0-A5, SCL, SDA, AREF, Digital Pins 0-13.

IR Sensor Module

  • Description: A module that detects the presence of an object using infrared light.
  • Pins: Vcc, Gnd, Out.

LED: Two Pin (red)

  • Description: A red light-emitting diode used as an indicator.
  • Pins: Anode, Cathode.

Resistor

  • Description: A passive two-terminal electrical component that implements electrical resistance as a circuit element.
  • Value: 220 Ohms.

Wiring Details

Arduino Uno R3

  • Digital Pin 8 connected to the anode of the LED.
  • Digital Pin 12 connected to the Out pin of the IR sensor module.
  • 5V pin provides power to the Vcc pin of the IR sensor module.
  • GND pin provides a common ground reference.

IR Sensor Module

  • Vcc connected to the 5V output from the Arduino Uno R3.
  • Gnd connected to the GND pin on the Arduino Uno R3.
  • Out connected to Digital Pin 12 on the Arduino Uno R3.

LED: Two Pin (red)

  • Anode connected to Digital Pin 8 on the Arduino Uno R3.
  • Cathode connected to one pin of the resistor.

Resistor

  • One pin connected to the cathode of the LED.
  • The other pin connected to the GND pin on the Arduino Uno R3 (through the IR sensor module's Gnd pin).

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.