Ultrasonic Tracking Radar
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
- 1x Arduino Uno
- 1x HC-SR04 Ultrasonic Sensor
- 1x Servo Motor (SG90 or similar)
- 1x Breadboard
- 9x or more Jumper Wires (at least 5 male- male , 4 male- female)
- 1x USB Cable (for Arduino)
- 1x Computer (with Arduino IDE and Processing installed)
- 1x Mount for attaching the sensor to the servo (any simple holder )
- OR
- 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
Arduino Radar System – Step-by-Step Build Guide
1. Prepare Your Workspace
- Place the Arduino Uno and breadboard on a flat surface
- Keep USB cable and all components nearby
- Do NOT power the system yet
2. Set Up Breadboard Power Rails
- Via the male to male - Jumper cables :
- Connect Arduino 5V to the breadboard + rail
- Connect Arduino GND to the breadboard – rail
- 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
- Attach sensor firmly to servo frame or even hot glue it if necessary
- OR
- If directly being attached, hot glue the servo onto the longest available servo arm with its pins facing up
- Ensure it faces forward and remains level
- Avoid loose mounting to prevent inaccurate readings
Uploading the Code
1. Upload the Arduino Code
- Download and open Arduino IDE
- Select Board: Arduino Uno
- Select correct Port (see next section)
- Code for Arduino #include <Servo
2. Identify the Correct COM Port
Method 1
- Unplug Arduino
- Open Arduino IDE → Tools → Port
- Plug Arduino back in
- Select the newly appeared port
Method 2
- Open Device Manager
- Expand Ports (COM & LPT)
- 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
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
- Servo should sweep
- Radar display should appear
- Objects should be detected
2. Test Detection Behavior
- 20–40 cm → normal detection
- >50 cm → ignored
- <10 cm → lock mode activates
- Move away → normal scan resumes
3. Calibration Check
- Test at 10, 20, 30, 40, 50 cm
- Verify accuracy and angle alignment
Common Mistakes
- Wrong COM port → no GUI output
- Servo jitter → power issue or no common ground
- Random lock mode → noise or reflections
- No detection → wiring or alignment issue
- 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
- 2. Servo Jitter
• Symptom: Shaking or unstable movement
• Fix: Use external 5V supply
• Ensure common ground between Arduino and power supply
- 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)
- 4. No Detection
• Symptom: Objects not detected
• Fix: Check TRIG/ECHO wiring
• Ensure object surface reflects sound (avoid soft materials)
• Verify sensor orientation
- 5. Inconsistent Distance Readings
• Symptom: Fluctuating values
• Fix: Tighten wiring connections
• Add small delay between readings in code
• Avoid angled surfaces
- 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
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.