Inspiration
This week, I built a mini radar system that scans its surroundings like a tiny watchtower guarding hidden treasure 🏴☠️. It keeps sweeping the area, and the moment something sneaks into its restricted zone, it suddenly comes alive—flashing, beeping, and warning like a guardian on high alert.
I’ve always been fascinated by radars—whether in airports, cartoons, or movies—so I thought, why not try building one myself?
Software
Tinkercad
I tested the buzzer loop game on Tinkercad Circuits by setting up the power, wires, and buzzer virtually. It let me see how the design works and fix mistakes safely before building it—like a quick rehearsal before the real thing.
Components
Breadboard
Jumper Wires
5V Adaptor
Buzzer
RGB LED
220 Ohm Resistor
Ultrasonic Sensor
Servo Motor
Circuit Design on Tinkercad
I started by adding the main components I needed:
Arduino UNO
Breadboard
Power supply
Buzzer
RGB LED
220Ω resistor
Ultrasonic Sensor
Servo Motor
After placing them, I connected the circuit and ran a simulation on Tinkercad to check for possible errors, short circuits, or burnouts. This helped ensure the design was safe and functional before moving forward.
Wiring the Circuit
To wire the radar circuit, I followed these steps:
Power Rails Setup (External Power Supply + Arduino Ground)
Connected the + terminal of the external 5–6V power supply to the positive (+) rail of the breadboard.
Connected the – terminal of the external power supply to the negative (–) rail of the breadboard.
Connected the Arduino GND pin to another rail of the breadboard and then connected it with the negative (–) rail of the external power supply to create a common ground between the Arduino and the external power.
Connecting the Servo Motor
Connected the servo motor where its:
Red wire (V+) to the +5V external power rail (not the Arduino 5V — to avoid overloading it)
Brown wire (GND) to the – power rail (common ground)
Orange wire (Signal) to Arduino pin 9.
Connecting the Ultrasonic Sensor (HC-SR04)
Connected the VCC pin to the Arduino 5V pin.
Connected the GND pin to the common ground rail.
Connected the Trig pin to Arduino pin 3.
Connected the Echo pin to Arduino pin 4.
Connecting the RGB LED
Placed a common cathode RGB LED on the breadboard.
Connected the longest leg (cathode) to the GND rail.
Connected the Red and blue legs each through a 220Ω resistor: Red → Pin 6 & Blue → Pin 7
Connecting the Buzzer
Placed the active buzzer on the breadboard.
Connected its positive leg to Arduino pin 5.
Connected its negative leg to the GND rail.
Final Check
Make sure all grounds (Arduino GND, external power GND, sensor GND, servo GND, LED GND, buzzer GND) are connected together.
Power up the Arduino from USB and an external adapter.
Upload your code and test.
How it Works
This radar system uses an ultrasonic sensor mounted on a servo motor to scan the surroundings and detect nearby objects. The Arduino controls the sensor, LEDs, buzzer, and servo. When the sensor detects an object closer than 50 cm, the system immediately stops the servo at the exact position where the object is detected, turns on the red LED and buzzer, and switches off the green LED. If no object is detected, the green LED remains on, the red LED and buzzer stay off, and the servo continues sweeping from 0° to 180° to scan the area.
CODE BLOCKS
Condition:
if (distance ≤ 50 cm) — This checks if the ultrasonic sensor detects an object within 50 cm.
Actions:
Set pin 6 HIGH → Turns red LED ON as a visual warning.
Set pin 7 LOW → Turns green LED OFF to indicate danger/stop.
Set pin 9 to 0 → Stops the servo motor immediately (by sending 0 speed/position).
Set pin 5 to 127 → Activates the buzzer at half power (PWM 127/255) to give an audible warning.
Wait 1 sec → Keeps the system in this alert state for one second.
Result:
When an object is too close, the system stops scanning, lights the red LED, and sounds the buzzer while holding the servo still at the exact detected position.
Actions:
Set pin 6 LOW → Turns red LED OFF.
Set pin 7 HIGH → Turns green LED ON to indicate safe scanning.
Set pin 5 to 0 → Turns buzzer OFF.
Rotate servo on pin 9 to 0° → wait 0.5 sec
Rotate servo on pin 9 to 30° → wait 0.5 sec
Rotate servo on pin 9 to 60° → wait 0.5 sec
Rotate servo on pin 9 to 90° → wait 0.5 sec
Rotate servo on pin 9 to 120° → wait 0.5 sec
Rotate servo on pin 9 to 150° → wait 0.5 sec
Rotate servo on pin 9 to 180° → wait 0.5 sec
Result:
If no object is nearby, the system keeps scanning the area by rotating the servo in 30° steps from 0° to 180°, turning the green LED ON and buzzer OFF.
Implementation
After validating in the simulation that the system was functioning as intended, I downloaded the generated Arduino code from Tinkercad. I then connected the components on a breadboard in real life according to the same circuit design and uploaded the code to the Arduino board to run the system on actual hardware.
Final Outcome
Connection of External Power
When I connected the servo motor, it drew too much current from the Arduino’s 5V pin, which caused the board to keep resetting and the servo to move inconsistently. I paused to research how to safely power servos and discovered that they should be powered from an external power supply. I then connected the servo’s positive wire to the external supply, its ground to the supply ground, and also linked that ground to the Arduino’s GND to complete the circuit. After doing this, the servo worked smoothly and the Arduino stayed stable.