More

    How to make radar system using Arduino in less then 5$

    This tutorial will show you a simple and easy technique to make an excellent Arduino-based radar system for less than a few dollars. For any instance, you can comment below.

    What is Radar system?

    The Radar system usually consists of a Transmitter that Transmits electromagnetic signals or waves, which are transferred to space with the help of any medium, usually an antenna. When those signals or waves strike any object, it gets back or bounces back and is reflected in different directions.

    So the reflected signal is then received by the radar antenna, and these signals are transferred to the receiver. With the help of these signals, which are processed, we can easily detect the geographical statistics of the object. The distance can be determined with the help of time taken by the signal from the radar system to the target and back to its place.

    Overview of the project

    In this project, you only need a few components. The list is given below in the table.

    Also read: How to Interface Arduino with MATLAB: Step-by-Step Guide

    According to the circuit diagram, the ultrasonic sensor is used for detection, and the breadboard is used for wiring all the wires. Make sure to download the code and upload it to Arduino to use your radar system using Arduino.

    Components Required

    The following components required for the radar system using Arduino.

    Circuit diagram

    Here the circuit diagram is shown below. Make sure to use precisely the same components as used in the circuit below.

    Arduino UNOUltrasonic Sensor
    ( +5V ) VCCVCC ( Positive + )
    GND ( Ground )GND ( Ground – )
    D10 PinTrig Pin
    D9 PinEcho Pin
    Arduino UNOServo Motor
    D3 PinOUT Pin ( Orange Colour )
    ( +5V ) VCCVCC        ( Red Colour )
    GND ( Ground )GND       ( Black Colour )

    According to the circuit diagram, you can follow the below steps to make it entirely without any problems.

    Steps to make Radar system using Arduino

    First, you must arrange the following components, as shown in the figure below. It should be noted that if you want to buy online, you can follow the above guidelines of Amazon online links to buy precisely the same components from the list above.

    Now arranging the components as shown below. First, we attach the Arduino to the breadboard to make it easy for us to wire correctly.

    Arduino based radar system

    Add glue on the breadboard so the servo motor can be easily attached.

    Arduino based radar system
    Arduino based radar system

    Now we have to glue on the servo motor so that the ultrasonic sensors can be easily attached to it.

    Arduino based radar system

    Now we attach the ultrasonic sensor to it. Now placing the above components on the breadboard and attach it so that it can be fixed. So that it can look exactly like this below.

    Arduino based radar system

    Now its the time to wire up properly the wiring can be set according to the circuit diagram or follow up the figure for further guidelines.

    Arduino based radar system

    Now it’s the time to attach the wires of Ultrasonic sensor to the Arduino.

    Arduino based radar system

    Code for Arduino based radar system

    #include <Servo.h>
    
    const int trigPin = 9;
    const int echoPin = 10;
    
    long duration;
    int distinCM;
    
    Servo radarServo;
    
    void setup() 
    {
      pinMode(trigPin, OUTPUT);
      pinMode(echoPin, INPUT);
      Serial.begin(9600);
      radarServo.attach(11);
    }
    void loop() 
    {
      for(int i=0;i<=180;i++)
      {
        radarServo.write(i);
        delay(50);
        
        digitalWrite(trigPin, LOW); 
        delayMicroseconds(2);
        digitalWrite(trigPin, HIGH); 
        delayMicroseconds(10);
        digitalWrite(trigPin, LOW);
        duration = pulseIn(echoPin, HIGH);
        distinCM = duration*0.034/2;
        
        Serial.print(i);
        Serial.print("*");
        Serial.print(distinCM);
        Serial.print("#");
      }
      
      for(int i=180;i>=0;i--)
      {
        radarServo.write(i);
        delay(50);
        digitalWrite(trigPin, LOW); 
        delayMicroseconds(2);
        digitalWrite(trigPin, HIGH); 
        delayMicroseconds(10);
        digitalWrite(trigPin, LOW);
        duration = pulseIn(echoPin, HIGH);
        distinCM = duration*0.034/2;
        
        Serial.print(i);
        Serial.print("*");
        Serial.print(distinCM);
        Serial.print("#");
      }
    }

    Arduino_Radar_Arduino_Code.ino by GitHub

    Uploading this code to the Arduino Program in Pc as shown below.

    Arduino based radar system

    Now download the processing software: download software

    This software helps you and display the records on the screen just like a radar system.

    Arduino based radar system

    Uploading the Code to Processing software

    Now uploading the code to the processing software will help you to watch live objects on the screen.

    import processing.serial.*;
    import processing.opengl.*;
    import toxi.geom.*;
    import toxi.processing.*;
    
    ToxiclibsSupport gfx;
    
    
    Serial port;
    String serialAngle;
    String serialDistance;
    String serialData;
    float objectDistance;
    int radarAngle, radarDistance;
    int index=0;
    
    void setup() 
    {
      size (1280, 720);
      gfx = new ToxiclibsSupport(this);
      smooth();
      
      //println(Serial.list());
      
      //String portName = Serial.list()[0];
      String portName = "COM4";
      port = new Serial(this, portName, 9600);
      
      //port = new Serial(this,"COM4", 9600);
      port.bufferUntil('#');
    }
    
    void draw() 
    {
      //fill(10,255,10);
      noStroke();
      
      fill(0,4); 
      rect(0, 0, 1280, 720);
      fill(10,255,10);
      
      //Radar Arcs and Lines
      pushMatrix();
      
      translate(640,666);
      noFill();
      strokeWeight(2);
      stroke(10,255,10);  
      arc(0,0,1200,1200,PI,TWO_PI);
      arc(0,0,934,934,PI,TWO_PI);
      arc(0,0,666,666,PI,TWO_PI);
      arc(0,0,400,400,PI,TWO_PI);
      strokeWeight(4);
      line(-640,0,640,0);
      line(0,0,-554,-320);
      line(0,0,-320,-554);
      line(0,0,0,-640);
      line(0,0,320,-554);
      line(0,0,554,-320);
      
      popMatrix();
     
      //Ultrasonic Lines
      pushMatrix();
      
      strokeWeight(5);
      stroke(10,255,10);
      translate(640,666);
      line(0,0,640*cos(radians(radarAngle)),-640*sin(radians(radarAngle)));
      
      popMatrix();
    
      //Object Detection Lines
      pushMatrix();
      
      translate(640,666);
      strokeWeight(5);
      stroke(255,10,10); // red color
      objectDistance = radarDistance*15;
    
      if(radarDistance<40)
      {
        line(objectDistance*cos(radians(radarAngle)),-objectDistance*sin(radians(radarAngle)),633*cos(radians(radarAngle)),-633*sin(radians(radarAngle)));
      }
      
      popMatrix();
    }
    
    void serialEvent (Serial port) 
    {
      serialData = port.readStringUntil('#');
      serialData = serialData.substring(0,serialData.length()-1);
      
      index = serialData.indexOf("*");
      
      serialAngle= serialData.substring(0, index);
      serialDistance= serialData.substring(index+1, serialData.length());
      
      radarAngle = int(serialAngle);
      radarDistance = int(serialDistance);
    }
    

    Arduino_Radar_Processing_Code.pde by GitHub

    Uploading code to the processing software as shown below.

    Arduino based radar system
    Arduino based radar system
    Arduino based radar system
    Arduino based radar system
    NOTE: it should be noted that you choose exactly the same port no to which your Arduino board is connected.

    Also read: The Best Arduino Starter Kits for Beginners: Your Guide to Online Purchases in 2023

    By clicking play button in the processing software you will see a screen like this the red area shows that there are objects which are detected.

    Arduino based radar system

    For any problem feel free to comment below or if you face any problem in buying components for Arduino based radar system Email us or use contact us form.

    Recent Articles

    spot_img

    Related Stories

    Leave A Reply

    Please enter your comment!
    Please enter your name here

    Stay on op - Ge the daily news in your inbox