Arduino RADAR Model using Ultrasonic Sensor for Detection & Ranging

Arduino RADAR Model using Ultrasonic Sensor (Last Updated On: December 1, 2018)

Introduction:

In this project we have designed Arduino RADAR Model using Ultrasonic Sensor for Detection & Ranging. RADAR is an object detection system that uses radio waves to identify the range, altitude, direction and speed of the objects. The radar antenna transmits radio wave pulses that bounce off any object in their path. The object returns a portion of the wave received by the receiver which is in line of sight with the transmitter.

This Arduino RADAR project aims to achieve a radar system prototype based on an Arduino board, capable of
detecting stationary and moving objects.



Components Required:

For designing Arduino RADAR Model using Ultrasonic Sensor, we need following components.

1. Arduino UNO Board
2. Servo Motor SG90 - (Buy Online from Amazon)
3. Ultrasonic Sensor HC-SR04 - (Buy Online from Amazon)
4. LED - 2 nos
5. Buzzer
6. 16 x 2 LCD Display
7. Bread Board
8. Connecting wires
9. Mechanical Moving Parts & Arrangement as shown in video below.

Arduino RADAR Model using Ultrasonic Sensor:

Block Diagram:

Arduino RADAR Model using Ultrasonic Sensor

Circuit Diagram:

Arduino RADAR Model using Ultrasonic Sensor


Program/Source Code:

#include <Servo.h>
#include <LiquidCrystal.h>

Servo myservo;
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)

int pos = 0; // la position initiale du servo moteur
const int trigPin = 9;
const int echoPin = 10;
const int moteur = 11;
const int buzzer = 12;
const int ledPin1 = 14;
const int ledPin2 = 15;
float distanceCm, DistanceSec,duration;

void setup() {
myservo.attach(moteur); // attache le Servo moteur a la pin numéro 11
lcd.begin(16,2); // Initialiser l'interface de Lcd avec leurs Dimensions
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
DistanceSec=20;

}

void loop() {
for (pos = 0; pos <= 180; pos += 1) { // aller de 0 a 180 degée
// in steps of 1 degree
myservo.write(pos); // Programmer le Servo pour aller a la position (pos)
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH); //envoyer une impulsion de 10 micro seconds
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);
distanceCm= duration*0.034/2;
if (distanceCm <= DistanceSec)
{

if(distanceCm <= DistanceSec/2)
{

tone(buzzer, 10); // Send 1KHz sound signal...
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, HIGH);
delay(700);
noTone(buzzer); // Stop sound...
lcd.setCursor(0,0); // positionner le cursor a 0,0
lcd.print("Distance: "); // Printe "Distance" sur LCD
lcd.print(distanceCm); // Printe la valeur Obtenue sur LCD
lcd.print(" cm "); // Printe l'unité sur LCD
delay(10);
lcd.setCursor(0,1);
lcd.print("Angle : ");
lcd.print(pos);
lcd.print(" deg ");
delay(2000);
}
else
{
digitalWrite(buzzer, HIGH);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
lcd.setCursor(0,0); // positionner le cursor a 0,0
lcd.print("Distance: "); // Printe "Distance" sur LCD
lcd.print(distanceCm); // Printe la valeur Obtenue sur LCD
lcd.print(" cm "); // Printe l'unité sur LCD
delay(10);
lcd.setCursor(0,1);
lcd.print("Angle : ");
lcd.print(pos);
lcd.print(" deg ");
delay(2000);
}
}
else{
digitalWrite(buzzer, LOW);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
}

lcd.setCursor(0,0); // positionner le cursor a 0,0
lcd.print("Distance: "); // Printe "Distance" sur LCD
lcd.print(distanceCm); // Printe la valeur Obtenue sur LCD
lcd.print(" cm "); // Printe l'unité sur LCD
delay(10);
lcd.setCursor(0,1);
lcd.print("Angle : ");
lcd.print(pos);
lcd.print(" deg ");
delay(80); //attendre 100ms pour que le servo cherche sa position

}
for (pos = 180; pos >= 0; pos -= 1) { //
myservo.write(pos); //
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);
distanceCm= duration*0.034/2;
if (distanceCm <= DistanceSec){
if(distanceCm <= DistanceSec/2)
{
tone(buzzer, 10); // Send 1KHz sound signal...
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, HIGH);
delay(700);
noTone(buzzer); // Stop sound...
lcd.setCursor(0,0); // positionner le cursor a 0,0
lcd.print("Distance: "); // Printe "Distance" sur LCD
lcd.print(distanceCm); // Printe la valeur Obtenue sur LCD
lcd.print(" cm "); // Printe l'unité sur LCD
delay(10);
lcd.setCursor(0,1);
lcd.print("Angle : ");
lcd.print(pos);
lcd.print(" deg ");
delay(2000);
}
else
{
digitalWrite(buzzer, HIGH);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
lcd.setCursor(0,0); // positionner le cursor a 0,0
lcd.print("Distance: "); // Printe "Distance" sur LCD
lcd.print(distanceCm); // Printe la valeur Obtenue sur LCD
lcd.print(" cm "); // Printe l'unité sur LCD
delay(10);
lcd.setCursor(0,1);
lcd.print("Angle : ");
lcd.print(pos);
lcd.print(" deg ");
delay(2000);
}
}
else{
digitalWrite(buzzer, LOW);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
}

lcd.setCursor(0,0); //
lcd.print("Distance: "); //
lcd.print(distanceCm); //
lcd.print(" cm ");
delay(10);
lcd.setCursor(0,1);
lcd.print("Angle : ");
lcd.print(pos);
lcd.print(" deg ");
delay(80);
}
}

Working of the Project:

Arduino RADAR Model using Ultrasonic Sensor

Arduino board sends a signal of +5V to trig pin of Ultrasonic Sensor HC-SR04 which triggers the sensor.Then it provides rotational action at the servo motor mechanically fitted along with ultrasonic Sensor HC-SR04 so that it can detect the moving objects and locate within 180 degrees.



The Arduino sends a HIGH pulse width of (10 S) on the TRIGGER pin of the sensor to regenerate a series of
ultrasonic waves which propagate through the air, until it touches an obstacle and returns in the opposite direction towards the sensor pin ECHO. The sensor detects the width of the pulse to calculate the distance.
The signal on pin ECHO the sensor remains at the HIGH position during transmission, thereby measuring the duration of the round trip of ultrasound and thus determine the distance.

The LCD display displays the calculated distance and the angle of rotation. The buzzer is an additional component, it rings when there is a detection (Tone1 and Tone2) along with LEDs. These both LEDs along with buzzer determine the field where the object is located (near or distant).


Photos:Mechanical Arrangement

Arduino RADAR Model using Ultrasonic Sensor

Arduino RADAR Model using Ultrasonic Sensor

Arduino RADAR Model using Ultrasonic Sensor


Video Demonstration:



Leave a Reply

Your email address will not be published. Required fields are marked *