Arduino Radar

26,718

209

16

Introduction: Arduino Radar

About: Aboutsciences is a platform where users can gather knowledge about sciences & technologies. Users can easily surf the website to know & innovate newer project ideas and technologies. AboutSciences off…

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.

Components

The listed components are needed to make a arduino radar using ultrasonic sensor.

  1. Arduino Board (i have used arduino Uno)
  2. Servo motor (mg-996)
  3. HC-SR04 Ultrasonic sensor
  4. Bread board
  5. Jumper wires

Step 1:

First of all, we have to cut a card board (15cm * 8cm). Then, glue arduino and servo motor on it.

Step 2:

Now, we have to make a “L” shape stand for Ultrasonic sensor (HC-SR04) which keeps it still on the servo motor.

Step 3:

Now, we have to connect sonar sensor to arduino. Be careful while connecting VCC and GND of the sensor to 5v and GND of arduino respectively. Later, connect the trig pin to 8 and echo pin to 9 of arduino.

Step 4:

After connecting sensor to arduino it’s time to attach servo motor with it. Again, be cautious about connecting VCC and GND of servomotor. Connect servo signal to pin 10 of arduino.

Step 5: Required Software for Arduino Radar:

You will need arduino IDE and Processing IDE to run this radar
project. 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 6: Arduino Code:

#includeconst 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 7: Processing IDE:

We can easily locate any object within the range (40 cm) by using processing IDE. If you don’t have the IDE on your pc just download it.
Before using this IDE, we have to configure the font.

For this, we have to install “OCRAEXT.TTF” file which is located in Radar.zip .

Then, go to tools/create Font. Select “OCRAExtended” from the list, choose font size 25 and click OK.

Step 8:

Now, we have to find the COM Port number. Go to Arduino IDE and find the Com port(COM3 in photo). Put the COM port number in line 13 of processing code (COM3 in photo).

Step 9: Final

Finally, pressing the Run button will show a processing window. It will show both servo angle of the radar and the object distance.

Follow our Blog to learn more interesting projects.... https://aboutsciences.com

You can download the Radar.zip file from here,

5 People Made This Project!

Recommendations

  • Make it Glow Contest

    Make it Glow Contest
  • First Time Author Contest

    First Time Author Contest
  • PCB Challenge

    PCB Challenge

16 Discussions

3
okrad123
okrad123

1 year ago

It is not a RADAR. It is a sonar.
RADAR is an acronym for "Radio Detection and Ranging."

0
kubanftw
kubanftw

Reply 3 months ago

This is correct. This is not a radar. It is 100% fundamentally and physically a sonar device haha.

0
JohnM1579
JohnM1579

Reply 1 year ago

You can call it anything you want. But, most of the people considers the project as the DIY version of a radar. So i renamed it as a arduino radar.

0
bud6333
bud6333

Reply 1 year ago

You refer to the sensors as sonar in step 3. So then why call it radar?

2
Ralphxyz
Ralphxyz

Reply 1 year ago

Bull, I agree with okrad123. It is misleading/misservice to call it Radar.

0
carter.boland
carter.boland

Question 3 months ago

Could you plug the radar into a program with a 3d field at all? So you could see a 3d design of what it detects?

0
666gaulois666
666gaulois666

Question 11 months ago

how can we increase the detection distance from 40 to 200. thanks

0
yosefsw10
yosefsw10

Answer 4 months ago

I haven't done the project yet but I'll say you need a stronger sensor with more range

0
Bina_Irwanda
Bina_Irwanda

5 months ago

Hello,
Nice to meet you ...
thank you very much for shared this project. I'll try program IDE and Processing.

Best Regard

0
timy_g
timy_g

9 months ago

the format/font does not work. can you update your video and HELP ME!?!?!?!?!?!??!?!?!

0
Ghloo
Ghloo

1 year ago

Whassup, guys, I was wondering, how are you powering the whole thing (arduino + servo)? Is it the arduino from laptop USB port and the servo off the arduino 5V pin? Is the current sufficient?

I am thinking this way, it looks much more convenient than an external power source and also the USB-C Port should be able to supply the current needed, I just want to be sure I am not crippling my laptop in the process.

0
User12911
User12911

Question 1 year ago

I cannot find any thing already written in the processing ide.plzz tell me where to get it fast.plzzz

15739096247911681155921.jpg
0
Vibrations
Vibrations

1 year ago

Is this something that you could use shocking someone or tasing them? My backyard neighbors are tasing me and I feel vibrations at my feet, but my husband cannot feel it. I have confronted him with this and doesn’t deny doing this but won’t stop and says they can’t be caught. Please help or direct me to anyone you think could help me. Thank you.

0
gegerio
gegerio

Question 1 year ago on Step 9

Radar.zip not contain neither ttf font nor processing code. Where are they? Thanks for the project.

0
JohnM1579
JohnM1579

Answer 1 year ago

Please check the newly updated file "radar_updated.zip". Thank you....