Radar Report
Radar Report
TABLE OF CONTENTS
1. Introduction
3. System Design
o Circuit Diagram
o Flowchart
4. Implementation
o Code Explanation
7. Future Enhancements
9. Conclusion
10. References
1. Introduction
The Arduino-based radar system is an innovative project designed to simulate the functionality of a
radar system using an Arduino microcontroller, a servo motor, and an ultrasonic sensor. The system
rotates the ultrasonic sensor to scan the surroundings, measuring distances and detecting objects
within its range. This project provides practical experience in integrating hardware and software,
making it ideal for computer science and engineering students.
Circuit Diagram
The circuit diagram illustrates how the components are connected.
Connections:
o Trig Pin of the HC-SR04 sensor to pin 8 on the Arduino.
Flowchart
The flowchart shows the logical flow of the system's operation.
Start: Initialize the servo motor and the ultrasonic sensor.
Loop: Sweep the servo motor from 15 to 165 degrees.
Measure Distance: At each angle, measure the distance to the nearest object.
Store Data: Log the distance and angle to the Serial Monitor.
Reverse Sweep: Sweep the servo motor back from 165 to 15 degrees.
Repeat: Continue the scanning process.
4. Implementation
The implementation involves coding the Arduino to control the servo motor and measure distances
using the ultrasonic sensor. Here’s the complete code:
cpp
#include <Servo.h>
const int trigPin = 8;
const int echoPin = 9;
long duration;
int distance;
Servo myServo;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
myServo.attach(10);
}
void loop() {
for(int i = 15; i <= 165; i++) {
myServo.write(i);
delay(30);
distance = calculateDistance();
Serial.print(i);
Serial.print(",");
Serial.print(distance);
Serial.print(".");
}
for(int i = 165; i > 15; i--) {
myServo.write(i);
delay(30);
distance = calculateDistance();
Serial.print(i);
Serial.print(",");
Serial.print(distance);
Serial.print(".");
}
}
int calculateDistance() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
return distance;
}
Code Explanation
Libraries and Pin Definitions: Includes the Servo library and defines the pins for the
ultrasonic sensor.
Setup Function: Initializes the pins and attaches the servo motor.
Main Loop: Sweeps the servo motor and measures distances, logging them to the Serial
Monitor.
Distance Calculation: Measures the time taken for the ultrasonic pulse to return and
calculates the distance.
During testing, the radar system was able to accurately measure distances within the specified range.
The results were logged to the Serial Monitor, demonstrating consistent performance across multiple
tests.
Test Scenarios
1. Empty Room: The system was tested in an empty room to verify baseline performance
without obstacles.
2. Object Detection: Various objects of different sizes and materials were placed at different
distances to test detection accuracy.
7. Future Enhancements
Data Logging: Integrate an SD card module to store distance measurements for later analysis.
Advanced Algorithms: Implement machine learning algorithms to analyze the data and
detect patterns or anomalies.
Improved Interface: Develop a graphical user interface (GUI) to visualize the data in real-
time.
Power Management: Ensuring a stable power supply is crucial. Using a dedicated power
source for the servo motor can prevent power issues.
9. Conclusion
The Arduino-based radar system is a successful demonstration of integrating hardware and software
for object detection and distance measurement. This project offers valuable hands-on experience and
can be further enhanced with additional features and technologies. By addressing the challenges and
implementing future enhancements, this project can evolve into a more robust and versatile system.
10. References
Arduino Documentation