Table of Contents

Radar Guard

Introduction

This project is a radar-like security system that detects objects using an ultrasonic sensor. Its main purpose is to monitor an area and alert when an object is detected nearby. The idea started from the concept of creating a simple motion detection system using basic electronic components and Arduino. I believe it is useful for others and for myself because it teaches how to integrate sensors, LEDs, a buzzer, a servomotor, and an LCD display into one functional project, while also being a practical solution for learning about automation and basic security systems.

General Description

This project is a radar-based security system using an ultrasonic sensor and servomotor to detect nearby objects and give visual and audio alerts. When no object is detected, two green LEDs are lit. When an object is detected within a certain range, the system lights two red LEDs, sounds a buzzer, and displays “Object Detected” on the LCD screen. The sensor continuously scans the area by rotating with the help of a servomotor.

Ultrasonic Sensor

Arduino Board (UNO)

LCD Display (I2C)

LEDs (Red and Green)

Buzzer

Servomotor

1k Resistors

Hardware Design

Name Connection (pins) Link
Ultrasonic Sensor HC-SR04 TRIG → 11, ECHO→ 10 Ultrasonic Sensor
Servomotor Metalic Digital MG996 Signal → 12 Servomotor
LCD Display LCD 1602 with I2C SDA → A4, SCL → A5 LCD Display
Red LEDs Anodes connected together → 3 LEDs
Green LEDs Anodes connected together → 4 LEDs
Buzzer Positive → 2 Pasive Buzzer
Arduino UNO - Kit Plusivo Microcontroller Starter

Software Design

Development Environment

The application was developed using the Arduino IDE.

Libraries and 3rd-Party Sources

1. Servo.h: library for controlling servo motors. It handles the PWM signal generation required for precise positioning of the servo.

2. Wire.h: I2C communication library. This provides the low-level functions needed for communicating with I2C devices like the LCD display.

3. LiquidCrystal_I2C.h: A third-party library that builds upon Wire.h to provide high-level functions for controlling I2C LCD displays. It simplifies the process of initializing, writing to, and controlling the backlight of the LCD.

4. avr/interrupt.h: Part of the AVR-libc, this header provides interrupt-related functions and definitions for the AVR microcontroller, enabling the implementation of interrupt service routines.

Algorithms and Structures Implemented

1. Interrupt-Driven Sensor Reading

I implemented a timer-based interrupt system to handle the ultrasonic sensor readings at regular intervals without blocking the main program flow:

2. Non-Blocking State Machine

Rather than using blocking delay functions, I implemented a non-blocking state machine using the millis() function:

3. Object Detection Algorithm

A simple threshold-based detection algorithm determines the presence of objects:

4. Servo Scanning Algorithm

I implemented a continuous scanning motion for the servo motor in “safe” mode:

5. Alarm System

When an object is detected, a multi-component alarm activates:

Implemented Functions

Project Innovation

The novelty of this project lies in the integration of interrupt-driven sensor processing with real-time multi-component coordination. Unlike basic proximity detection systems, this project combines continuous servo scanning with non-blocking alarm systems, creating a dynamic radar-like surveillance system. The use of Timer2 interrupts for sensor reading while maintaining smooth servo operation and responsive LCD updates represents a different approach to embedded system design.

Project Architecture and Validation

The system follows a modular architecture where the ISR handles time-critical sensor operations while the main loop manages user interface components. Validation was performed through systematic testing:

Sensor Calibration Process

The HC-SR04 ultrasonic sensor calibration involved:

Performance Optimizations

The demonstration video showcases (the video is in the archive)

Results Obtained

The project yielded a fully operational proximity detection system that successfully integrates the core concepts learned in laboratory sessions (I2C communication, timers, interrupts, and buzzer control) while incorporating additional components like the ultrasonic sensor and servomotor. The implemented system accurately detects objects within 15cm range, provides clear visual feedback through an LCD display and LED indicators, generates audible alerts via the buzzer when objects are detected, and maintains a continuous scanning motion with the servomotor during safe conditions. Testing confirmed reliable performance with consistent object detection, accurate distance measurements, responsive alarm activation, and stable operation across extended usage periods.

Conclusion

My proximity detection system successfully demonstrates the application of multiple technologies learned throughout laboratory sessions. I effectively implemented I2C communication for the LCD display, configured hardware timers and interrupts for sensor readings, and utilized a buzzer for audio alerts. Building upon this foundation, I successfully integrated new components not covered in labs: an ultrasonic distance sensor for proximity detection and a servomotor for continuous scanning motion.

Download

radar_guard.zip

Journal

Bibliography/Resources

Software Resources

Hardware Resources

Export to PDF