Fiverr gig
$15 โ€” I will help you with your project and simulate it for you
Hire me
๐ŸŒ IoT Projects

Motion Detection System

EmbedLab TeamDecember 9, 20246 min read
Motion Detection System

This is an arduino uno project with code for beginners, a simple security system for beginners simulated on proteus , with full project available for free!

Description of the Code

This Arduino project simulates a simple motion-activated servo mechanism using an IR sensor, a servo motor, and an LED. The system detects motion with the IR sensor and performs the following actions when motion is detected:

  1. IR Sensor Activation: When the IR sensor detects motion, it outputs a HIGH signal.
  2. LED Indicator: The LED connected to pin 13 turns on, providing a visual indication of detection.
  3. Servo Motor Motion:
    • The servo motor connected to pin 11 sweeps from 0ยฐ to 180ยฐ and back to 0ยฐ.
    • This sweeping motion mimics an automated action, such as opening and closing a barrier or scanning an area.
  4. System Reset: After completing the sweep, the LED turns off, and the system resets to wait for the next motion detection.

This code is ideal for applications such as automated gates, motion detection systems, or simple robotic arms.



Required Libraries, Components, and Software

Libraries:

  1. Servo.h: Built-in Arduino library for controlling servo motors.
    • Included by default in the Arduino IDE.
    • Used to create and control the servo object (myservo).

Components:

  1. IR Sensor Module:

    • Detects motion or obstacles.
    • Connected to Arduino's digital pin (IRSensor on pin 2).
  2. LED:

    • Provides a visual indication when motion is detected.
    • Connected to pin 13 with a current-limiting resistor (220โ„ฆ recommended).
  3. Servo Motor:

    • Performs sweeping motion from 0ยฐ to 180ยฐ and back.
    • Connected to pin 11 for control.
  4. Resistors:

    • 220โ„ฆ or 330โ„ฆ for the LED.
  5. Connecting Wires:

    • Male-to-male or male-to-female jumper wires.
  6. Breadboard:

    • For easy wiring and prototyping.
  7. Power Supply:

    • USB cable for powering the Arduino board.
  8. Arduino Board:

    • Any Arduino-compatible board (e.g., Arduino Uno, Nano, Mega).

Software:

  1. Arduino IDE:

  2. Proteus 8 Professional:

    • For simulating the Arduino project virtually.
    • Used to test circuit designs before actual hardware implementation.

Code Breakdown

  1. Libraries and Object Creation:

    • The Servo library is included for controlling the servo motor.
    • An object myservo is created to interact with the servo motor.
  2. Pin Configuration:

    • IRSensor (pin 2): Reads motion detection status.
    • LED (pin 13): Provides visual feedback.
    • Servo motor is attached to pin 11.
  3. Setup:

    • pinMode() configures the pins for the sensor and LED.
    • myservo.attach(11) initializes the servo motor.
  4. Loop:

    • The IR sensor's status is checked using digitalRead(IRSensor).
    • If motion is detected (HIGH signal):
      • The LED turns on.
      • The servo sweeps from 0ยฐ to 180ยฐ and back with a delay for smooth motion.
      • The LED turns off after the motion.

Schematic:

----------------------------------------------------------------------------------

Schematic




----------------------------------------------------------------------------------
Code:

#include <Servo.h>
int IRSensor = 2; // Connect IR sensor to Arduino pin 2
int LED = 13;     // Connect LED to Arduino pin 13
Servo myservo;    // Create Servo object

void setup() {
  pinMode(IRSensor, INPUT);  // Sensor pin set as INPUT
  pinMode(LED, OUTPUT);      // LED pin set as OUTPUT
  myservo.attach(11);        // Attach the servo to pin 11
}

int pos = 0; // Variable to track servo position

void loop() {
  int sensor_status = digitalRead(IRSensor); // Read IR sensor status

  if (sensor_status == HIGH) { // Check if sensor is activated
    digitalWrite(LED, HIGH);   // Turn LED ON

    // Sweep servo from 0 to 180 degrees
    for (pos = 0; pos <= 180; pos++) {
      myservo.write(pos);
      delay(15); // Small delay for smoother motion
    }

    // Sweep servo back from 180 to 0 degrees
    for (pos = 180; pos >= 0; pos--) {
      myservo.write(pos);
      delay(15); // Small delay for smoother motion
    }

    digitalWrite(LED, LOW); // Turn LED OFF
  }
}

----------------------------------------------------------------------------------------------------------------------------

Project Link:

https://drive.google.com/file/d/1vGt3nR66-63sC0BaXmTL4zHQs8RkpTye/view?usp=drive_link
----------------------------------------------------------------------------------------------------------------------------


  • Arduino Servo Project
  • Arduino IR Sensor Tutorial
  • Motion Detection with Arduino
  • IR Sensor Servo Motor Control
  • Arduino LED Servo Motion
  • Arduino Barrier Control System
  • Automated Motion Sensor Servo
  • Servo Sweep Arduino Example
  • IR Sensor with LED and Servo
  • Proteus Arduino Simulation
  • Arduino Motion Activated Servo
  • IR Sensor and Servo Control Code
  • Arduino Robotics Basics
  • DIY Motion Sensor Project
  • Home Automation with Arduin

  • ET

    EmbedLab Team

    Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.

    Related projects

    Top 5 IoT projects with Arduino UNO and ESP32 โ€” Blynk app, Wi-Fi and smart home
    ๐ŸŒ IoT Projects

    Top 5 IoT Projects with Arduino UNO & ESP32 โ€” Blynk, Wi-Fi & Smart Home Tutorials (2026)

    The top 5 IoT projects every Arduino UNO and ESP32 maker should build in 2026 โ€” Blynk IoT control, Wi-Fi blink, ESP-WROOM-32 dev board guide, ESP32 Proteus 8 simulation and an Arduino smart home parking system. Each pick links to the full tutorial with free Arduino IDE code, library and wiring.

    May 30 8 min
    Blynk IoT app controlling Arduino UNO and ESP32 over Wi-Fi
    ๐ŸŒ IoT Projects

    Blynk IoT with Arduino UNO & ESP32 โ€” Free Arduino IDE, Library & App Tutorial

    Complete Blynk IoT tutorial for Arduino UNO and ESP32 Arduino: install the Arduino IDE, add the Blynk Arduino library, wire LEDs, LCD and sensors, and control everything from the Blynk app over Wi-Fi โ€” a free, beginner-friendly Arduino IoT project.

    Nov 19 6 min
    Arduino UNO and ESP32 Blink IoT project with Blynk app
    ๐ŸŒ IoT Projects

    Arduino UNO Blink IoT Guide โ€” ESP32 Arduino, Blynk App & Arduino IDE Code

    Complete Arduino UNO Blink IoT guide using ESP32 Arduino and the Blynk app: free Arduino IDE code, Arduino library and LED wiring โ€” the easiest Arduino IoT project for beginners to download and try online.

    Oct 27 9 min
    How to Control LEDs Using Blynk and Arduino Uno: A Complete Guide
    ๐ŸŒ IoT Projects

    How to Control LEDs Using Blynk and Arduino Uno: A Complete Guide

    &nbsp; How to Control LEDs Using Blynk and Arduino Uno: A Complete Guide Controlling LEDs remotely using Blynk and an Arduino Uno is a simple yet powerful project for IoT (Internet of Things) enthusia

    Apr 4 4 min
    Proteus 8 Blynk
    ๐ŸŒ IoT Projects

    Proteus 8 Blynk

    Connect Proteus 8 with Blynk Using Arduino: A Complete Step-by-Step Guide Looking to seamlessly connect Proteus 8 with Blynk using Arduino ? This detailed tutorial covers everything from setting up a

    Apr 4 7 min
    Browse all 50+ projects