Ultrasonic Tracking Radar

by Rishabh_patel in Circuits > Arduino

162 Views, 1 Favorites, 0 Comments

Ultrasonic Tracking Radar

WhatsApp Image 2026-03-29 at 18.33.20 (3).jpeg
WhatsApp Image 2026-03-29 at 18.33.20 (2).jpeg
WhatsApp Image 2026-03-29 at 18.33.20 (1).jpeg
WhatsApp Image 2026-03-29 at 18.33.20.jpeg
WhatsApp Image 2026-03-29 at 18.33.19 (1).jpeg
WhatsApp Image 2026-03-29 at 18.33.19.jpeg

This is a Ultrasonic sensor based tracking radar ,That "locks on" to your object when its 12 or less centimeters away from it .

Supplies

Components List

  1. 1x Arduino Uno
  2. 1x HC-SR04 Ultrasonic Sensor
  3. 1x Servo Motor (SG90 or similar)
  4. 1x Breadboard
  5. 9x or more Jumper Wires (at least 5 male- male , 4 male- female)
  6. 1x USB Cable (for Arduino)
  7. 1x Computer (with Arduino IDE and Processing installed)


  1. 1x Mount for attaching the sensor to the servo (any simple holder )
  2. OR
  3. 1x hot glue stick and gun ( if you are going to directly stick your sensor on a servo arm)


All these parts could be individual found on Amazon by name

All hardware needed maybe found under the name "Ultrasonic Radar Kit "

Just ensure all used parts are present in your kit.


Downloads:

Arduino IDE : https://support.arduino.cc/hc/en-us/articles/360019833020-Download-and-install-Arduino-IDE

Processing 4 : https://processing.org/download

Arduino Ultrasonic Radar Tracking System – Step-by-Step Build Guide

WhatsApp Image 2026-03-29 at 18.33.20 (2).jpeg
WhatsApp Image 2026-03-29 at 18.33.20 (3).jpeg

Arduino Radar System – Step-by-Step Build Guide

1. Prepare Your Workspace

  1. Place the Arduino Uno and breadboard on a flat surface
  2. Keep USB cable and all components nearby
  3. Do NOT power the system yet

2. Set Up Breadboard Power Rails

  1. Via the male to male - Jumper cables :
  2. Connect Arduino 5V to the breadboard + rail
  3. Connect Arduino GND to the breadboard – rail
  4. Use these rails to power the sensor and servo

If the servo jitters, use an external regulated 5V supply.

3. Wire the Ultrasonic Sensor (HC-SR04)

Using the male - Female Jumper cables

VCC → + rail

GND → – rail

TRIG → Pin 10

ECHO → Pin 11

Ensure TRIG and ECHO are not swapped.

4. Wire the Servo Motor

Red → + rail (or external 5V)

Brown/Black → – rail

Yellow/Orange → Pin 12 ( directly to Arduino via male - male cable )

Ensure common ground between Arduino and servo.

5. Mount the Sensor on the Servo

  1. Attach sensor firmly to servo frame or even hot glue it if necessary
  2. OR
  3. If directly being attached, hot glue the servo onto the longest available servo arm with its pins facing up

  4. Ensure it faces forward and remains level
  5. Avoid loose mounting to prevent inaccurate readings

Uploading the Code

image_2026-03-29_185654563.png
image_2026-03-29_185819165.png

1. Upload the Arduino Code

  1. Download and open Arduino IDE
  2. Select Board: Arduino Uno
  3. Select correct Port (see next section)

  4. Code for Arduino #include <Servo

2. Identify the Correct COM Port

Method 1

  1. Unplug Arduino
  2. Open Arduino IDE → Tools → Port
  3. Plug Arduino back in
  4. Select the newly appeared port

Method 2

  1. Open Device Manager
  2. Expand Ports (COM & LPT)
  3. Find Arduino Uno (COMx)

The same COM port must be used in both Arduino IDE and Processing.


Press the blue arrow in the IDE which means to upload the code to the Arduino

wait a few second for the code to complete uploading. After which you will see the system start sweeping



Setting Up the GUI

image_2026-03-29_185542292.png
image_2026-03-29_190234778.png
WhatsApp Image 2026-03-29 at 18.33.20 (1).jpeg

1. Update COM Port in Processing GUI

Download and open Processing GUI 4

Open a new Sketch and paste the provided code


At line 14 of the code, replace COM4 in your code with your actual port if different; As found in the Arduino IDE.


Code for Processing GUI import processing


Hence, Run the program via the Play button on top , This will make the Radar Screen appear

Testing and Use

1. Initial Test

  1. Servo should sweep
  2. Radar display should appear
  3. Objects should be detected

2. Test Detection Behavior

  1. 20–40 cm → normal detection
  2. >50 cm → ignored
  3. <10 cm → lock mode activates
  4. Move away → normal scan resumes

3. Calibration Check

  1. Test at 10, 20, 30, 40, 50 cm
  2. Verify accuracy and angle alignment



Common Mistakes

  1. Wrong COM port → no GUI output
  2. Servo jitter → power issue or no common ground
  3. Random lock mode → noise or reflections
  4. No detection → wiring or alignment issue


  1. 1. Wrong COM Port

• Symptom: No data in GUI

• Fix: Match COM port in Arduino IDE and Processing

• Use Serial.list() to identify correct port


  1. 2. Servo Jitter

• Symptom: Shaking or unstable movement

• Fix: Use external 5V supply

• Ensure common ground between Arduino and power supply


  1. 3. Random Lock Mode Trigger

• Symptom: Lock mode activates unexpectedly

• Fix: Reduce noise by stabilizing sensor mount

• Adjust threshold slightly in code (e.g., 10 cm → 8–9 cm)


  1. 4. No Detection

• Symptom: Objects not detected

• Fix: Check TRIG/ECHO wiring

• Ensure object surface reflects sound (avoid soft materials)

• Verify sensor orientation


  1. 5. Inconsistent Distance Readings

• Symptom: Fluctuating values

• Fix: Tighten wiring connections

• Add small delay between readings in code

• Avoid angled surfaces


  1. 6. GUI Not Responding

• Symptom: No radar display or frozen screen

• Fix: Ensure baud rate matches Arduino code

• Close Arduino Serial Monitor before running GUI

Now It Works

WhatsApp Image 2026-03-29 at 18.33.19 (1).jpeg

Have fun testing with it.

you can upgrade this project by properly enclosing it

or even adding additional ultrasonic sensors to improve directional accuracy

Or even add a LiDAR sensor that uses light to complete the same functionality and is often more accurate

making your whole system more accurate.