Skip to content

About

Arduino + HC-SR04 radar with a real-time Processing sweep display. Servo sweeps the sensor 180 degrees and objects inside 40 cm light up red on a green phosphor-style scope.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Ultrasonic Radar

A working radar scope built from an Arduino, an HC-SR04 ultrasonic sensor, and a servo. The sensor sweeps 180 degrees back and forth while a Processing sketch renders a classic green phosphor radar display in real time: fading sweep trail, range rings every 10 cm, and anything inside 40 cm painted red at its exact angle and distance.

Arduino HC-SR04 Processing 4 40cm range

Radar scope: sweep at 72 degrees, object return at 27 cm
What the display renders: sweep trail, range rings, and a red return at 27 cm (frame reproduced from the display's drawing code with simulated serial data)

How it works

servo sweeps 15°-165°            serial "angle,distance."           Processing 4
HC-SR04 pings at each step   →   9600 baud, '.' terminated      →   radar scope UI

The Arduino steps the servo one degree at a time, fires the HC-SR04 at each step, and streams angle,distance. packets over serial. The Processing sketch buffers on the . terminator, splits on the comma, and redraws:

  • Sweep line at the live servo angle, with a translucent black overlay each frame so old sweeps fade out like a real scope
  • Red return line from the measured distance out to the edge of the scan area when an object is inside 40 cm
  • Range rings marked at 10 / 20 / 30 / 40 cm, plus live angle and distance readouts in the corners

The parser is defensive on purpose: null reads, empty lines, and malformed packets are dropped instead of crashing the display mid-demo.

Hardware

Part Pin
HC-SR04 TRIG D10
HC-SR04 ECHO D11
Servo signal D12
Both 5V + GND

Running it

  1. Flash arduino/radar_arduino/radar_arduino.ino to the board.
  2. Open processing/radar_display/radar_display.pde in Processing 4.
  3. Set the COM port in setup() (currently COM16; check Arduino IDE > Tools > Port) and make sure the Arduino Serial Monitor is closed, since only one program can hold the port.
  4. Run. Wave a hand inside 40 cm of the sensor.

Note: the Arduino sketch is the standard sweep implementation written to match the display's exact serial protocol. If you have the club's original board sketch, drop it in; angle,distance. at 9600 baud is the only contract.

Built for a Compsci & Robotics Club session at Hodan Nalayeh SS.

About

Arduino + HC-SR04 radar with a real-time Processing sweep display. Servo sweeps the sensor 180 degrees and objects inside 40 cm light up red on a green phosphor-style scope.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages