Skip to main content

RADAR SYSTEM

 Radar

Project Overview :

This project involves creating a radar-like system using an Arduino microcontroller, an ultrasonic sensor (HC-SR04), and a servo motor. The ultrasonic sensor is mounted on the servo motor, allowing it to rotate and measure distances in different directions. The Arduino controls the servo motor to scan the sensor's field of view, and the sensor detects objects and calculates their distances based on the time it takes for sound waves to bounce back. The Arduino then processes this data and displays it, simulating a radar display.

Material :

  1. Arduino board (e.g., Arduino Uno)
  2. 2.Ultrasonic sensor (HC-SR04)
  3. 3.Servo motor
  4. Jumper wires
  5. Breadboard
  6. LCD display or OLED display (for visualizing the radar display)

Circuit Setup:

  1. Connect the ultrasonic sensor to the Arduino board. The sensor typically has four pins: VCC, GND, Trigger, and Echo.
  2. Connect the VCC pin of the sensor to the 5V pin on the Arduino, and the GND pin to the GND pin.
  3. Connect the Trigger pin of the sensor to a digital pin (e.g., pin 9) on the Arduino.
  4. Connect the Echo pin of the sensor to another digital pin (e.g., pin 10) on the Arduino.
  5. Connect the servo motor to the Arduino to control the rotation of the sensor.
  6. Connect the control wire of the servo motor to a PWM pin (e.g., pin 3) on the Arduino.

Code :

#include <Servo.h>
#define TRIG_PIN 9
#define ECHO_PIN 10
#define SERVO_PIN 3
Servo servo;
void setup() {
  Serial.begin(9600);
  servo.attach(SERVO_PIN);
}
void loop() {
  // Scan from 0 to 180 degrees
  for (int angle = 0; angle <= 180; angle += 10) {
    // Move the servo to the current angle
    servo.write(angle);
    delay(500); // Adjust the delay as needed
    
    // Perform distance measurement
    long duration, distance;
    digitalWrite(TRIG_PIN, LOW);
    delayMicroseconds(2);
    digitalWrite(TRIG_PIN, HIGH);
    delayMicroseconds(10);
    digitalWrite(TRIG_PIN, LOW);
    duration = pulseIn(ECHO_PIN, HIGH);
    distance = duration * 0.034 / 2;
    // Print the angle and distance
    Serial.print("Angle: ");
    Serial.print(angle);
    Serial.print(" degrees, Distance: ");
    Serial.print(distance);
    Serial.println(" cm");
  }
  // Reset the servo to starting position
  servo.write(90);
  delay(1000); // Delay before next scan
}


Code File : Click Here

Processing Code :

import processing.serial.*;

Serial arduino; // Serial port for Arduino communication

int canvasWidth = 600; // Canvas width
int canvasHeight = 600; // Canvas height

int angle = 0; // Current angle
int distance = 0; // Current distance

void setup() {
  size(canvasWidth, canvasHeight);
  arduino = new Serial(this, "COM3", 9600); // Replace "COM3" with the appropriate serial port
}

void draw() {
  background(255);
  drawRadar();
}

void drawRadar() {
  // Draw radar circle
  stroke(0);
  noFill();
  ellipse(width/2, height/2, 500, 500);
  
  // Draw radar lines
  float x = width/2 + cos(radians(angle)) * distance * 5; // Scale distance for visualization
  float y = height/2 + sin(radians(angle)) * distance * 5;
  line(width/2, height/2, x, y);
  
  // Draw angle text
  textAlign(CENTER, CENTER);
  textSize(16);
  fill(0);
  text("Angle: " + angle + "°", width/2, height/2 + 250);
  text("Distance: " + distance + " cm", width/2, height/2 + 280);
}

void serialEvent(Serial port) {
  String data = port.readStringUntil('\n'); // Read data from Arduino
  if (data != null) {
    data = data.trim(); // Remove whitespace
    String[] values = data.split(" "); // Split data into angle and distance
    if (values.length == 2) {
      angle = int(values[0]);
      distance = int(values[1]);
    }
  }
}

Processing File: Click Here

Processing Software : Click Here

How it works ?

  1. The ultrasonic sensor is mounted on a servo motor, allowing it to rotate and measure distances in different directions.
  2. The Arduino rotates the servo motor in steps, scanning from 0 to 180 degrees.
  3. At each angle, the Arduino triggers the ultrasonic sensor to send out a sound wave and measures the time it takes for the wave to bounce back (the echo).
  4. Based on the time taken, the Arduino calculates the distance to any object in that direction.
  5. The Arduino then prints the angle and distance to the serial monitor for visualization.

Visualization:

You can visualize the radar display by connecting an LCD or OLED display to the Arduino and updating the display with the angle and distance data obtained from the ultrasonic sensor.

Uses :

  1. Object Detection: The radar system can be used to detect objects in different directions, making it useful for applications such as obstacle detection and avoidance in robotics or autonomous vehicles.
  2. Surveillance: The radar system can be used for surveillance purposes, monitoring the presence of objects or individuals within a certain range.
  3. Security: It can be used as a security system to detect unauthorized intrusions or movements in restricted areas.
  4. Navigation: The radar system can assist in navigation by providing real-time information about obstacles or hazards in the environment, enabling safe and efficient movement.
  5. Environmental Monitoring: It can be used for environmental monitoring applications, such as monitoring the presence of objects or wildlife in natural habitats.
  6. Research and Development: The radar system can be used for research and development purposes, such as studying object detection algorithms, sensor fusion techniques, and autonomous navigation systems.

Overall, the Arduino-based radar system offers a versatile and cost-effective solution for various applications requiring object detection and monitoring capabilities.

***************************************************************************************************





Comments

Popular posts from this blog

Security Alarm using Arduino and PIR sensor

  Security Alarm using Arduino and PIR Sensor Project Overview : To create a security alarm system that detects unauthorized access or intrusion and alerts the user through audible and/or visual alarms. Components : 1. Arduino board (such as Arduino Uno) 2. PIR motion sensor module 3. Buzzer or piezo speaker 4. LED (optional for visual indication) 5. Breadboard  6. Jumper wires Hardware Setup : Connect the PIR motion sensor module to the Arduino. The sensor typically has three pins: VCC, GND, and SIGNAL. Connect VCC to 5V, GND to GND, and SIGNAL to a digital input pin (e.g., pin 2) on the Arduino. Connect the buzzer or piezo speaker to the Arduino. Connect one terminal of the buzzer to a digital output pin (e.g., pin 3) on the Arduino and the other terminal to GND. Optionally, connect an LED to a digital output pin (e.g., pin 4) on the Arduino for visual indication. Software Setup :  Arduino Code : #define PIR_PIN 2 // Digital pin connected to PIR sensor #define BUZZER_PI...

Automatic Door Opening System Using Arduino and PIR Sensor

Project Overview:   The project aims to create an automatic door opening system using an Arduino microcontroller , a PIR (Passive Infrared) sensor, and a servo motor. The system detects motion using the PIR sensor and automatically opens the door by activating the servo motor. After a specified delay, the door closes automatically.   Materials: - Arduino Uno board - PIR sensor - Servo motor - Jumper wires - Breadboard - USB cable for Arduino - Computer for programming and testing   Software Requirements: - Arduino IDE (Integrated Development Environment)   Hardware Setup: 1. Connect the PIR sensor to the Arduino as follows:    - Signal pin of the sensor to digital pin 2 of the Arduino    - VCC pin of the sensor to 5V pin of the Arduino    - GND pin of the sensor to GND pin of the Arduino 2. Connect the servo motor to the Arduino as follows:    - Signal wire of the servo motor to digital pin 3 of the Arduino...

Exploring the Fascinating World of Robotics

  In the realm where science fiction meets reality, there exists a field that continually pushes the boundaries of human imagination and technological innovation: robotics. From the fictional realms of Isaac Asimov's visionary tales to the real-world applications in manufacturing, healthcare, space exploration, and beyond, robotics has captured the fascination of both dreamers and engineers alike. Unveiling the Marvels of Robotics At its core, robotics is the interdisciplinary field that merges mechanical engineering, electrical engineering, computer science, and artificial intelligence to create machines—robots—that can perform tasks autonomously or semi-autonomously. These machines range from the size of nanobots, manipulating matter at the molecular level, to towering humanoid robots mimicking human movements with remarkable precision. Applications in Everyday Life The impact of robotics extends far beyond the confines of research laboratories. In manufacturing, robots have revo...