How to make 360* RADAR

 

What is RADAR?

RADAR, electromagnetic sensor used for detecting, locating, tracking, and recognizing objects of various kinds at considerable distances. It operates by transmitting electromagnetic energy toward objects, commonly referred to as targets, and observing the echoes returned from them. The targets may be aircraft, ships, spacecraft, automotive vehicles, and astronomical bodies, or even birds, insects, and rain. Besides determining the presence, location, and velocity of such objects, radar can sometimes obtain their size and shape as well. What distinguishes radar from optical and infrared sensing devices is its ability to detect faraway objects under adverse weather conditions and to determine their range, or distance, with precision.


What is a Radar System?

RADAR stands for Radio Detection and Ranging System. It is basically an electromagnetic system used to detect the location and distance of an object from the point where the RADAR is placed. It works by radiating energy into space and monitoring the echo or reflected signal from the objects. It operates in the UHF and microwave range.

Working Principle


The radar working principle is very simple because it transmits electromagnetic power as well as examines the energy returned back to the target. If the returned signals are received again at the position of their source, then an obstacle is in the transmission way. This is the working principle of radar.

This project is 360 radar using 2 ultrasonic sensors.




In this Project, I used 2 ultrasonic sensors to cover full 360 Degree. This can be mapped using Processing 3.0 software.


What is Ultrasonic Sensor?

An ultrasonic sensor is an electronic device that measures the distance of a target object by emitting ultrasonic sound waves, and converts the reflected sound into an electrical signal. Ultrasonic waves travel faster than the speed of audible sound (i.e. the sound that humans can hear).
 
 

If you want to make this project, Watch the whole video.

Watch the video to make yours.





 

If you like this project do comment on YouTube video, and do not forget to subscribe my channel, link is below

 

https://studio.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g

If you have any doubt regarding this project, you can Telegram me at +919557024177.

If you have any suggestions or project idea, kindly reach out to my channel or Telegram me at above no.


Parts List :-

1. Arduino Uno: https://amzn.to/3lA9bHc

2. Ultrasonic Sensors ( 2 ): https://amzn.to/3nFvyO8

3. Jumper Wires: https://amzn.to/3tLKgnV

4. Servo motor : https://amzn.to/3CnuJxM


Steps to make this project:-

1. Gather components.

2. Place 2 ultrasonic sensors in a box.

3. Place servo and Arduino on controlling station

4. Place sensors on servo motor.

5. Upload the Arduino code

6. Download Processing 3 software

7. Copy and paste the processing code

8. Run the processing and select the port


Watch Radar is covering the whole distance.


Circuit Diagram:-

 


 

Just Copy the Arduino code and paste it in Arduino IDE

 

// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //

// 360 RADAR using 2 ultrasonic sensor //

// By MOHD SOHAIL //



#include <HCSR04.h>

#include <Servo.h>


UltraSonicDistanceSensor distanceSensor(6, 7);             //Create the 1st sensor object

UltraSonicDistanceSensor distanceSensor2(5, 4);             //Create the 2nd sensor object

Servo servoMotor;            //Create the Servo object


int delayTime = 5;            //Delay value to wait for the servo to reach the 1 angle difference

long d;                 //Distance from 1st sensor calculated

long d2;                //Distance from 2nd sensor calculated


void setup() {

  Serial.begin(9600);           //Initialize the Serial communication at 9600 bauds


  servoMotor.attach(2);         //Attach the servo to the Digital PWM pin 2

  servoMotor.write(180);        //Rotate the servo to the 180?

  delay(1000);              //Wait for the servo to reach 180?

  servoMotor.write(0);          //Rotate the servo to the 0?

  delay(1000);              //Wait for the servo to reach 0?


}


void loop() {

  for (int i = 1; i < 180; i++) {   //Move the Servo 180 degrees forward

    readSensors();            //Read the sensors

    Serial.print(i);          //Print the angle

    Serial.print(",");          //Print a ","

    Serial.print(d);          //Print the 1st distance

    Serial.print(",");          //Print a ","

    Serial.println(d2);         //Print the 2nd distance with end line

    servoMotor.write(i);        //Set the sensor at the angle

    delay(delayTime);         //Wait for the servo to reach i?

  }

  for (int i = 180; i > 1; i--) {   //Move the Servo 180 degrees backward

    readSensors();            //Read the sensors

    Serial.print(i);          //Print the angle

    Serial.print(",");          //Print a ","

    Serial.print(d);          //Print the 1st distance

    Serial.print(",");          //Print a ","

    Serial.println(d2);         //Print the 2nd distance with end line

    servoMotor.write(i);        //Set the sensor at the angle

    delay(delayTime);         //Wait for the servo to reach i?

  }

}


void readSensors() {

  d = distanceSensor.measureDistanceCm();

  d2 = distanceSensor2.measureDistanceCm();

}

 

 

Download Processing 3.0 Software and paste this code on it

 

import processing.serial.*;

import static javax.swing.JOptionPane.*;


Serial myPort;        // The serial port

String serialin;

int data[] = new int[360];

PFont f;


final boolean debug = true;


void setup() {

  String COMx, COMlist = "";

  size(1280, 720);

  f = createFont("Verdana", 32, true); // Arial, 16 point, anti-aliasing on

  textFont(f, 20);

  frameRate(60);

  for (int i = 0; i < 360; i++) {

    data[i] = 0;

  }

  try {

    if (debug) printArray(Serial.list());

    int i = Serial.list().length;

    if (i != 0) {

      if (i >= 2) {

        // need to check which port the inst uses -

        // for now we'll just let the user decide

        for (int j = 0; j < i; ) {

          COMlist += char(j+'a') + " = " + Serial.list()[j];

          if (++j < i) COMlist += ",  ";

        }

        COMx = showInputDialog("Which COM port is correct? (a,b,..):\n"+COMlist);

        if (COMx == null) exit();

        if (COMx.isEmpty()) exit();

        i = int(COMx.toLowerCase().charAt(0) - 'a') + 1;

      }

      String portName = Serial.list()[i-1];

      if (debug) println(portName);

      myPort = new Serial(this, portName, 9600); // change baud rate to your liking

      myPort.bufferUntil('\n'); // buffer until CR/LF appears, but not required..

    } else {

      showMessageDialog(frame, "Device is not connected to the PC");

      exit();

    }

  }

  catch (Exception e)

  { //Print the type of error

    showMessageDialog(frame, "COM port is not available (may\nbe in use by another program)");

    println("Error:", e);

    exit();

  }

}



void draw() {

  background(26, 26, 36, 200);

  textSize(18);

  stroke(255, 255, 255, 150);

  fill(255, 50, 200, 200);

  text("Arduino RADAR 2D Visualization", 20, 710);

  text(hour(), 1050, 710);

  text(":", 1075, 710);

  text(minute(), 1085, 710);

  text(":", 1110, 710);

  text(second(), 1120, 710);

  fill(36, 255, 100, 200);

  strokeWeight(3);

  circle(640, 360, 600);

  circle(640, 360, 500);

  circle(640, 360, 400);

  circle(640, 360, 300);

  circle(640, 360, 200);

  circle(640, 360, 100);


  for (int i = 0; i < 360; i++) {

    fill(255, 10, 255, 200);

    stroke(50, 10, 255, 150);

    point(float(640) +  (map_values(data[i]))*cos(radians(i)), float(360) + (map_values(data[i]))*sin(radians(i)));

  }


  while (myPort.available() > 0) {

    serialin = myPort.readStringUntil(10);

    try {

      String serialdata[] = splitTokens(serialin, ",");

      if (serialdata[0] != null) {

        serialdata[0] = trim(serialdata[0]);

        serialdata[1] = trim(serialdata[1]);

        serialdata[2] = trim(serialdata[2]);


        int i = int(serialdata[0]);

        data[179-i] = int(serialdata[1]);

        data[(179-i)+180] = int(serialdata[2]);

      }

    } 

    catch (java.lang.RuntimeException e) {

    }

  }

}


float map_values(float x) {

  float in_min = 0, in_max = 200, out_min = 0, out_max = 700;

  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;

}

  

Select the Port and Play. 

 

Post a Comment

0 Comments