Introduction: Arduino Analog Ultrasonic Radar

About: I am a retired Electronic Systems Engineer now pursuing my hobbies full time. I share what I do especially with the world wide student community.

This Instructable presents an improved Arduino based Ultrasonic Radar System.

Standard digital outputs of the "HC-SR04" and "Grove Ultrasonic" sensors provide information only on the distance to the nearest target. By processing a signal derived from an intermediate point on the Seeed Studio Grove Ultrasonic Sensor it is possible to derive an "Analog Echo Signal" from targets.

This permits target echoes even from of targets behind each other to be displayed on a "Plan-Position-Indicator (PPI)" display. The software also highlights the estimated target positions. Overall this Radar provides a better "Situation Awareness" compared to other Radar projects built using on the standard digital distance display.

Step 1: Evaluating the Grove Ultrasonic Sensor for Use As an Analog Radar Sensor

The following methodology was used in order to get a feel of the electronic circuitry of the "Grove Ultrasonic Sensor"

Electronic Setup

1. Additional wires were connected on the sensor PCB and test points brought out for probing using an Oscilloscope:

The Transmitter output point at Pin 14 of the MAX232

The Receiver output at R 17

The Band-Pass-Filter output at Pin 8 of the LM324

The 7.5 Gain stage output at Pin 7 of the LM324

The MCU Pin 9 output

2. The Sensor was connected to an Arduino with :

Pin 1 GND

Pin 2 +5V

Pin 3 Additional connection to Pin 9 of MCU

Pin 4 Sig connected to Arduino Pin 13

The detector circuit input is connected to Pin 3 above

3. A simple Sketch was programmed on the Arduino which performed the following:

Set Pin 13 as output and generate a 5 uSec positive pulse for the Sig input

Set Pin 13 as input

Generate a 300 uSec test pulse on Pin 12 of the Arduino. (the H/L transition of this pulse would be used as a trigger for capturing waveforms)

Compute the time for which Pin 13 / Sig remains High (corresponds to distance)

Print the two-way-time in uSec and the computed distance

Test Code

long duration, distance;    
  pinMode(signalPin, OUTPUT);
  digitalWrite(signalPin, LOW);
  digitalWrite(testPin, LOW);
  digitalWrite(signalPin, HIGH);
  digitalWrite(testPin, HIGH);
  digitalWrite(testPin, LOW);
  duration = pulseIn(signalPin,HIGH);
  distance = (duration/2) / 29.1;

  //distance = ((duration/2) +200)/ 29.1; //more accurate includes Tx pulse duration
    Serial.println(" cm");
    Serial.println(" us");

Hardware Setup

The Grove Sensor is placed flat on the table

A vertical stand is used to locate 3 targets at 10 cm, 45 cm and 75 cm

The room roof forms the 4th target at 2m

Test Results

First oscilloscope capture

Shows the 5 uSec Sig trigger pulse and the 350 uSec test pulse generated by the Arduino.

The Sensor generates eight 40 kHz pulses and then sets the Sig pulse to High starting the distance measurement process

The Sig state is set to Low as soon as the Echo pulses are received.

The Sig pulse High time is a measure of distance

Strictly we should add 200 uSec to this corresponding to the Eight transmitted pulses and not use only the Sig High duration as a measure of two way distance.

Second oscilloscope capture

Provides a clearer picture of the trigger and responses of the circuit

We can observe a widening of the received pulse train which is not restricted to Eight Pulses probably because of "Resonance" in the "Ultrasonic Detector" or "Hi-Q" of the circuitry. This would limit the "Range Resolution" of objects place in line with the Sensor.

Third oscilloscope capture

Provides the waveforms at a larger distance of 17 cm

Fourth oscilloscope capture

Shows the "Detector Circuit" output for four inline targets providing an " Analog Output" showing four peaks with amplitude and width corresponding to the echos from the targets

This demonstrates the feasibility of building an "Analog Radar" by using the "Detector Outputs" by adding a suitable scanning mechanism for the "Sensor" in Azimuth.

Step 2: Radar Hardware and Test Scenario

The hardware implementation is simple:

1. The sensor is modified by adding a jumper wire from the collector of Q2 to the NC pin on the Sensor Connector. This will be fed to the detector-circuit to derive the "Analog Ultrasonic Echoes" from targets.

2. The Servo motor is mounted in a rectangular cutout on top of a plastic cup. A semi-circular groove is cut for Sensor connecting cable to traverse as the servo rotates. A reinforcement is made below the servo mounting using a suitably bent steel wire fastened with hot glue.

3. The sensor itself is mounted on the servo using the bell-crank stuck to an available circular plastic piece. The connecting cable is folded and fixed into the plastic piece using hot glue.

4. A close up shows the overall mounting arrangement.

5. The connections of the Servo and Ultrasonic Sensor are made directly to the Arduino Uno and the detector circuit is implemented on the bread-board.

6. The Fritzing Breadboard shows the detailed connectivity.

Target Scenario

The target scenario consists of tubes of different diameters all using sound reflecting materials placed at distances of 10 cm, 25 cm, 40 cm, 60 cm, 70 cm, 75 cm, 110 cm and the wall at 130 cm.

The diameter / size of the targets is suitably chosen keeping three factors:

The radar-cross-section ( in ultrasonic terms) which along with distance determines the reflected echo amplitude

The echo duration ( corresponding to radar pulse width) which determines the resolution in distance (Range)

And sensor beam-width ( which determines angular-resolution)

The placement of reflective targets is therefore based on these factors:

Avoid bright echoes masking targets behind them.

The angular spacing is based on the criteria that the angular resolution depends on the beam-width of the sensor. This being quite large at 30 degrees widens the echoes in Azimuth

And distance between targets in the same Azimuth must be greater than the return-pulse width based time to distance.

Watch the Sensor scan in Azimuth using the Servo-Motor commanded by the Arduino UNO

Step 3: Software

Plan-Position-Indicator(PPI) Images from the Application

  1. All target echoes plotted and target locations marked
  2. One target removed but marking still present
  3. Marking removed
  4. Target echo restored but will be marked in next sweep

Arduino Software


Varies the Servo Position for angles from -80 to 80 degrees

At each angle it initiates a echo measurement, acquires the echo analog response and sends the 256 values out via the serial port

Processing Software


Acquires the Azimuth Angle followed by 125 Analog Echo values from the serial port

Creates a PPI indicator and plots distance and intensity for each angle

Sweeps 0 Deg to -80 deg to +80 deg, then +80 to -80 and return continuously

At 80 Deg position it estimates target positions and marks circles on the PPI