Nekhil
Published © Apache-2.0

Arduino Based Radar System

I have developed a visual experience of radar by processing ID with ultrasonic sensor, servo motor and Arduino.

BeginnerFull instructions provided1 hour12,186
Arduino Based Radar System

Things used in this project

Hardware components

Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Arduino UNO
Arduino UNO
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Screwdriver-Jackly-32-in-1-Magnetic-Screwdriver-Set-Repair-Tool-Kit Screwdriver-Jackly-32-in-1-Magnetic-Screwdriver-Set-Repair-Tool-Kit Screwdriver-Jackly-32-in-1-Magnetic-Screwdriver-Set-Repair-Tool-Kit Screwdriver-Jackly-32-in-1-Magnetic-Screwdriver

Story

Read more

Schematics

connection

describing connection

Code

Arduino code

Arduino
code
#include<Servo.h>
int trigPin=2;
int echoPin=3;

long duration;
int distance;
Servo servo;

void setup()
{
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600);
  servo.attach(9);
}

void loop()
{
  for(int i=15;i<=165;i++)
  {
    servo.write(i);
    delay(100);
    distance=calculateDistance();
    
    Serial.print(i);
    Serial.print(",");
    Serial.print(distance);
    Serial.print(".");
  }
  for(int i=165;i>15;i--)
  {
    servo.write(i);
    delay(100);
    distance=calculateDistance();
    
    Serial.print(i);
    Serial.print(",");
    Serial.print(distance);
    Serial.print(".");
  }
}

int calculateDistance()
{
  digitalWrite(trigPin,LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin,HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin,LOW);
  
  duration=pulseIn(echoPin,HIGH);
  distance=duration*0.034/2;
  return distance;
}

Credits

Nekhil

Nekhil

13 projects • 42 followers
HARD CORE TINKERER

Comments