Introduction: Arduino Radar Home Made

In this tutorial, we will learn how to make a cool looking Arduino Radar using ultrasonic sensor. Arduino radar allows you to detect objects within a short range. This project is easy and fun to make, obviously. You can use this project for showcasing in school science fair. I have added the video to help making this radar easily. Lets start making it…..

Overview To make this radar we need three basic components. First one is the Arduino which processes the data sent by the sonar sensor. Sonar sensor has a transmitter which produces and transmits ultrasonic sound wave which later is received by the receiver after reflecting from any object. However, servo motor is the third component which revolves with in a particular degree and helps the radar to detect objects.

Supplies

1.Arduino Board (i have used arduino Uno)

2.Servo motor (mg-996)

3.HC-SR04 Ultrasonic sensor

4.Bread board

5.Jumper wires

6.You will need arduino IDE and Processing IDE to run this radarproject. Processing IDE will get the values sent from arduino and illustrate the object area (red marked). Follow the links to download them.

Processing IDE: https://processing.org/download/support.html

Arduino IDE: https://www.arduino.cc/en/main/software

Step 1: Arduino Code

Arduino Code:

#include<Newping.h>

const int TriggerPin = 8;

const int EchoPin = 9;

const int motorSignalPin = 10;

const int startingAngle = 90;

const int minimumAngle = 6;

const int maximumAngle = 175;

const int rotationSpeed = 1;

Servo motor;

void setup(void) {

pinMode(TriggerPin, OUTPUT);

pinMode(EchoPin, INPUT);

motor.attach(motorSignalPin);

Serial.begin(9600);

}

void loop(void) {

static int motorAngle = startingAngle;

static int motorRotateAmount = rotationSpeed;

motor.write(motorAngle);

delay(10);

SerialOutput(motorAngle, CalculateDistance());

motorAngle += motorRotateAmount;

if(motorAngle <= minimumAngle || motorAngle >= maximumAngle)

{

motorRotateAmount = -motorRotateAmount;

}}

int CalculateDistance

(void) {

digitalWrite(TriggerPin, HIGH);

delayMicroseconds(10);

digitalWrite(TriggerPin, LOW);

long duration = pulseIn(EchoPin, HIGH);

float distance = duration * 0.017F; return int(distance); }

void SerialOutput(const int angle, const int distance)

{ String angleString = String(angle);

String distanceString = String(distance);

Serial.println(angleString + "," + distanceString);

}

Step 2: Proccessing Software Code

this code can used for proccessing app

If you are new to processing, it is a visual arts based software for learning to code. To download the application, visit the following link and choose your platform. Download Processing.
After downloading the Zip file (assuming the platform is 64-bit Windows), extract the contents of the zip file and you can find the processing application (.exe file).

The important thing is selecting com port according to your need, it very important to change your com with your connectivity.if you can doubt you can contact me and i will definity help you on comment box

Step 3: Circuit

Step 4: Working

Initially, upload the code to Arduino after making the connections. You can observe the servo sweeping from 00 to 1800 and again back to 00. Since the Ultrasonic Sensor is mounted over the Servo, it will also participate in the sweeping action.

Now, open the processing application and paste the above given sketch. In the Processing Sketch, make necessary changes in the COM Port selection and replace it with the COM Port number to which your Arduino is connected to. If you note the Processing Sketch, I have used the output display size as 1280×720 (assuming almost all computers now-a-days have a minimum resolution of 1366×768) and made calculation with respect to this resolution. In the future, I will upload a new Processing sketch where you can enter the desired resolution (like 1920×1080) and all the calculations will be automatically adjusted to this resolution. Now, run the sketch in the Processing and if everything goes well, a new Processing window opens up like the one shown below.

A Graphical representation of the data from the Ultrasonic Sensor is represented in a Radar type display. If the Ultrasonic Sensor detects any object within its range, the same will be displayed graphically on the screen.

Step 5: Final View

here ,if you put any obstacle in the front of ultra sonic sensor, this green will change to red and we get that how much distance to obstacle from ultra sonic sensor. thank you for view.

Arduino Contest 2020

Participated in the
Arduino Contest 2020