top of page
Search
Writer's pictureAKSHIT'S INNOVATION LAB

How to make a RADAR

Things used in this project

Hardware components

Ultrasonic Sensor

Servo

jumper wire

Arduino Uno

Bread Board

Software apps and online services

Arduino IDE : Software | Arduino

--------------------------------------------------------------------------------------

Hi friends welcome to Akshit Innovation Lab In this article we are going to learn to make a simple RADAR. RADAR is used in ships, aircrafts, and submarines RADAR system consists of a transmitter producing electromagnetic waves to find the properties of the object

Step 1

Connect Arduino's 10 pin to ultrasonic sensor's trig pin

Step 2

Connect Arduino's 11th pin to ultrasonic sensor's Echo pin

Step 3

Connect Arduino's +5v to breadboard

Step 4

Connect ultrasonic sensor's +5v to breadboard

Step 5

Connect ultrasonic sensor's ground to Arduino's ground

Step 6

Connect servo's signal pin (orange wire) to Arduino's 12 pin

Step 7

Connect servo's +5v (red wire) to breadboard

Step 8

Connect servo's Ground to Arduino's Ground

Now you have provided all the connections For more clarity on connections, refer the diagram below:



Steps to compile Arduino code from IDE to the Arduino board:

Step 1

Now you have to download Arduino IDE app which I have downloaded already

Step 2

Copy the code and post it in Arduino IDE app (refer code section)

Step 3

Now go to tools and select the board and port

Step 4

Now select the upload button

Step 5

Now the code is being compiled. Refer "sketch is compiled" in status

Now the code has been uploaded.

Steps to setup "processing 3" code (which contains RADAR code) in the laptop:

Step 1

Now you have to download "processing 3" app, which I have already installed

Step 2

Check the description for code. I have give the code in my website link. Copy the code and paste it in processing app

Step 3

Now open the Ardiuno app and check your port number. In my case it is 4. So I have hard coded the port as 4 in "processing 3" app. The hardcode has to happen in the 19th line (COM your port number here)

Now the coding part is done

Now start testing. When you keep your hand in sensor it will detect (refer red wave in radar)

Refer Video by clicking the following link:

CODE FOR ARDUINO

//AKSHITS INNOVATION LAB https://www.youtube.com/c/AKSHITSINNOVATIONLAB //



// Includes the Servo library


#include <Servo.h>.


// Defines Tirg and Echo pins of the Ultrasonic Sensor


const int trigPin = 10;


const int echoPin = 11;


// Variables for the duration and the distance


long duration;


int distance;


Servo myServo; // Creates a servo object for controlling the servo motor


void setup() {


pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output


pinMode(echoPin, INPUT); // Sets the echoPin as an Input


Serial.begin(9600);


myServo.attach(12); // Defines on which pin is the servo motor attached


}


void loop() {


// rotates the servo motor from 15 to 165 degrees


for(int i=15;i<=165;i++){


myServo.write(i);


delay(30);


distance = calculateDistance();// Calls a function for calculating the distance measured by the Ultrasonic sensor for each degree



Serial.print(i); // Sends the current degree into the Serial Port


Serial.print(","); // Sends addition character right next to the previous value needed later in the Processing IDE for indexing


Serial.print(distance); // Sends the distance value into the Serial Port


Serial.print("."); // Sends addition character right next to the previous value needed later in the Processing IDE for indexing


}


// Repeats the previous lines from 165 to 15 degrees


for(int i=165;i>15;i--){


myServo.write(i);


delay(30);


distance = calculateDistance();


Serial.print(i);


Serial.print(",");


Serial.print(distance);


Serial.print(".");


}


}


// Function for calculating the distance measured by the Ultrasonic sensor


int calculateDistance(){



digitalWrite(trigPin, LOW);


delayMicroseconds(2);


// Sets the trigPin on HIGH state for 10 micro seconds


digitalWrite(trigPin, HIGH);


delayMicroseconds(10);


digitalWrite(trigPin, LOW);


duration = pulseIn(echoPin, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds


distance= duration*0.034/2;


return distance;


}

-------------------------------------------------------------------------------------------------------------------------------

AKSHIT INNOVATION LAB

a robotics learning channel

24 views0 comments

Recent Posts

See All

Comments


bottom of page