Acoustic Radar Display




Introduction: Acoustic Radar Display

About: 55+ years in electronics, computers, and teaching ... now retired.

This instructable describes how to make an ultrasonic “radar-style” display using an Arduino microcontroller, an ultrasonic sensor, and a small stepping motor.

An optional sensor modification allows multiple objects to be detected with each ping.

Construction is simple ... all you need are two drills, a sharp knife, a pair of side-cutters , and a soldering iron.

Photo 1 shows the basic parts. The “insert” shows a random-dot test pattern. Dots representing primary objects are shown in red ... dots representing secondary objects are shown in blue.

Photo 2 shows the assembled unit.

Photo 3 shows an actual screen shot of seven objects. [1]

The video clip shows the unit in operation.


The azimuth and distance of each primary object are shown in red. Any echo from a secondary object is shown in blue. Without the sensor modification you will only see the red objects.

Since the sonic pulses expand in a cone-like manner, distant objects appear wider. The actual bearing of each object is the midpoint of each continuous (red or red/blue) line.

Continuous lines containing both red and blue dots are a single object, part of which is in shadow.

Step 1: Wiring Diagram

The wiring diagram is shown in photo1.

An optional modification is shown in photo2. This modification is the SAME for both the HC-SR04 and the HY-SRF05 ultrasonic sensors and allows multiple echos to be detected. [1]


For a full explanation see my instructable

If you have an HC-SR04, the integrated circuit to which you solder the wire is labelled U2

Step 2: Parts List

The following parts were obtained locally:

  • 1 only plastic food container.
  • 1 only sub-miniature micro-switch.
  • 1 only male header strip (used for attaching wires from sensor).
  • 1 only female header strip (used to mount sensor).
  • 1 only piece of 20 gauge aluminium (scrap) sheet 40mm x 55mm.
  • 6 only 9mm nylon spacers tapped 3mm.
  • 3 only cable-ties.
  • 13 only 3mm x 6mm bolts.
  • 1 only 3mm nut.
  • 4 only 4mm x 10mm bolts.
  • 2 only 4mm nuts.

The following parts were obtained from

  • 1 only Arduino Uno R3 microcontroller complete with USB cable.
  • 1 only 28BJY-48 5 volt stepping motor complete with ULN2003 controller.
  • 1 only 5mm bore brass hex shaft to wheel coupler for model cars.
  • 1 only HY-SRF05 (or HC-SRF04) ultrasonic sensor.

Step 3: How It Works


All parts are housed inside a plastic food container. Power is obtained from your USB port.

The circuit comprises an Arduino, an ultrasonic sensor, a stepping-motor, and a micro-switch for moving the sensor to its “home” position. The micro-switch is necessary as it is not possible to rotate the stepping motor by hand due to its 64:1 internal gearing.

When first powered up the Arduino rotates the sensor to its “home” position, as determined by the micro-switch, then “polls” the display until it gets a response.

The 28BJY-48 stepping motor has a “stride angle” of 5.625/64 degrees which means that 1 degree steps are not possible (even though our graticule is labelled 0..180 degrees).

Fortunately, 180/stride-angle = 180*64/5.625 = 2048 which is evenly divisible by 8. If we increment a number from 0..2048 and divide by 8 there are 256 occasions when we get a remainder of zero ... we simply send a “ping” whenever the remainder is zero. This equates to a “ping” every PI/256 radians or 0.703125 degrees.

Software [1]

The display then takes control and continually asks the Arduino to supply the following data:

  • Azimuth
  • Distance1
  • Distance2
  • Direction

The “distance(s)” for each “azimuth” are then displayed on the screen. The “direction” information is used to create the illusion of “dots” appearing behind the “beam” as it rotates.

The Arduino automatically moves to the next “ping” position whenever data is sent to the display.


The “Processing 3” software used for writing the display may be downloaded from

Processing 3 supports 2D and 3D graphics and is very similar to the Arduino IDE (Integrated Development Environment). The main visual differences are a “graphics window” when the code is running and the use of a “draw()” function instead of the Arduino “loop()”.

Step 4: The Display

The Graticule

I chose to create a 180 degree graphics display as it provides a “radar shadow” in which to stand while experimenting. Such a display is also compatible with a servo motor should I wish to use one. A full 360 degree display can be obtained by tweaking the code.

The following photos explain how the graticule was created:

Photo 1

  • The graticule comprises a number of “arcs” and “lines”. Angled labels are shown in this photo but were later dropped in favour of horizontal text which is easier to read.

Photo 2

  • Shows a red line depicting the “beam”. The text in the label is now horizontal.

Photo 3

  • The red line in photo 2 has been rotated 0..180 degrees through 256 azimuth positions. In this photo the outer parts of the graticule are not covered as the beam-width is too narrow. This results in some strange artifacts.

Photo 4

  • Increasing the beam-width has eliminated these artifacts.

Photo 5

  • Random dots have been introduced to represent primary (red) and secondary (blue) echos. The range, which can be changed, has been set to exactly 100cm to match the display. A fading beam pattern has also been introduced. The technique used to create this “fading beam” is explained further on.

Photo 6

  • The color scheme has been changed to add a touch of realism.


The animated portions of the graphics display use 3D graphics to greatly simplify the code. To understand how this is possible let’s draw a “30 degree line” of constant radius from an XY start coordinate of (0,0).

2D graphics requires the use of sin(30) and cos(30) to calculate the XY end coordinates of the line:

X=cos(30)*radius = 0.866*radius
Y=sin(30)*radius = 0.5*radius

3D graphics doesn’t require the use of trigonometry. We simply rotate the XY grid coordinates about the Z-axis then draw a horizontal line .... no maths required!!!

pushMatrix();		//preserve our current grid coordinates
rotateZ(radians(30));	//rotate our XY grid coordinates about the Z-axis
line(0,0,radius,0);	//draw a “horizontal” line on the rotated grid
popMatrix();		//restore our grid coordinates

Either way works but this second method lends itself to “ping” intervals of PI/256 radians.

Fading Lines

The fading beam pattern uses a clever technique found at

The beam is given its own virtual screen. Prior to drawing any line the “alpha” (opacity) of all previous lines is reduced by a small amount. Ultimately the earliest lines become invisible which gives the illusion of a fading “fan” pattern.

This virtual screen, which is never erased, is then merged with the contents of the main screen whenever the display is refreshed.

Step 5: Mounting Bracket

The drilling template for a suitable mounting bracket is shown in photo 1.

Position the two outer “mount” holes below the transmit (T) and receive (R) sensors. I find that best results are obtained if the sensor rotates around the receive (R) sensor rather than midway between the two sensors. The three holes allows you to experiment.

Details of how to “cut and fold” aluminium may be found in my instructable

Step 6: Assembly

USB cable-hole

Do not try and drill a cable-hole for the USB connector though the side of the plastic container as plastic tends to split and chip. Instead, melt a hole using the tip of a hot soldering iron then trim with a sharp knife. Take care not to breath the fumes.


Replace one of the 4mm “grub-screws” in the shaft-extender with a 4mm x 10mm bolt. This bolt is used to activate the micro-switch.


Position the micro-switch such that it is activated by the 4mm bolt when the shaft rotates in a clockwise direction.

I used two turns of 20 gauge copper wire to attach the micro-switch to the case as 2mm nuts and bolts were not readily available.

Remaining components

Layout is not critical. The motor shaft was positioned centrally. The Arduino and motor controller were mounted on nylon spacers which allow the wires to be tucked underneath.

Mounting the sensor

Photo 1

  • shows the sensor assembly. The HY-SR0F-5 socket has been fashioned from a female-header socket. All unwanted pins have been removed and a 3mm hole drilled through the plastic. The header is then attached to the bracket by means of a 3mm nut and bolt.

Photo 2

  • shows a side view of the sensor assembly. The wires from the header are cable-tied to the bracket. This “strain-relief” prevents unwanted cable movement as the sensor rotates. Note also the “grey” wire attached to pin 10 of IC1. This wire is optional and feeds the secondary echos to the Arduino.

Attach the sensor assembly to the shaft extender after the micro-switch has operated following power-up. The shaft is then in its “home” position.

Step 7: Software Installation

Install the following code in this order:

Arduino IDE

Download and install the Arduino IDE (integrated development environement) from if not already installed.

Processing 3

Download and install Processing 3 from

Acoustic Radar Sender [1]

Copy the contents of the attached file, “acoustic_radar_sender_2.ino”, into an Arduino “sketch”, save, then upload it to your Arduino Uno R3.

Close the Ardino IDE but leave the USB cable connected.

Acoustic Radar Receiver

Copy the contents of the attached file, “acoustic_radar_receiver.pde” into a Processing “Sketch”.



"acoustic_radar_sender_2.ino" fixes a "scan-creep" bug in "acoustic_radar_sender_1.ino" . My thanks to for pointing it out.

Step 8: Testing

Click the top left “Run” button in your Processing window and your project will burst into life.

Try detecting different objects:

  • Nearby objects require the transmit (T) sensor to be low to prevent the "beam" passing over the top.
  • More distant objects require a larger surface area as much of the acoustic energy is lost as the beam spreads ... plus the return echo also spreads.
  • Experiment with the three mounting holes.
  • You may wish to try mounting the sensor vertically so that the transmit and receive beam-widths overlap.

  Click here   to view my other instructables.

Be the First to Share


    • Jewelry Challenge

      Jewelry Challenge
    • Raspberry Pi Contest

      Raspberry Pi Contest
    • Anything Goes Contest 2021

      Anything Goes Contest 2021


    sub john
    sub john

    Question 24 days ago on Introduction

    Nice project, would it be possiable to change this to work on lidar i don't know enough about code to beable to change it. I had a idea about putting it on a 12ft model submarine
    Thanks John


    Answer 21 days ago

    Hi John
    Thank you or your interest in my project :)

    As yet I haven't played with LIDAR devices but they should be able to detect objects above the surface. Not certain about under-the-water as things can get murky fairly quickly.

    A waterproof sonar sensor may work below the surace. If so you would need to change the speed of sound from 343 meters-per-second to 1480 meters-per-second.

    Your idea sounds plausible but either way you would need to play with the code.


    10 months ago

    In the above video instead of getting red line i need dots...
    you can get arduino code and processing app code in the above video
    can you please modify the code for getting dots instead of red lines..plzz


    Reply 9 months ago

    is it possible to use the uwaterproof ultrasonic sensor jsn-sro4t v3 for this experiment


    Reply 9 months ago

    Thank you for your interest in my project :)
    Sorry ... I don't know as I haven't got one to try.
    Providing your sensor has the range it should work.


    Reply 9 months ago

    okay. the whole circuitary is different.


    Reply 9 months ago

    Suggest you try the sensor in my instructable
    and see if it works.

    Be aware that different sensors may have different pinouts.

    If your sensor works then should be able to adapt it to my circuit.


    Reply 9 months ago

    Thank you for asking ... but regret I do not have the time.
    Suggest you contact the author of this project.


    3 years ago

    How far can those sensors detect objects? Can they work at say 2-3 metres distance?


    Reply 3 years ago

    The HC-SR04 and HY-SRF05 sensors have a maximum range of around 4 meters. I have restricted this range to 1 meter in my code.


    Reply 9 months ago

    how to not restrict it to 1 m??


    Reply 9 months ago

    Thank you for your interest in my projectn :)
    Your question is answered in my reply to "newtoeu" in the comments below.


    1 year ago

    what is the necessary change to display second time around echo ?......basically distance after 2m must ba agin measured from the origin (i.e 250 must be 50)...and so on ......


    1 year ago

    hiii ...sorry to bother u again but do u this this instructable should be able to make it wireless just have a look and tell me
    this one according to this person is just a little of physical changes(powering bluetooth) then adding a serial.flush wait till tx is done and change port to output port of bluetooth that u communicate via output port of bluetooth i tried this but it is not working for mr could u please look and see what all chnages are required


    Reply 1 year ago

    The circuit to which you refer has a number of errors.

    The RXDATA voltage divider resistors are missing from the circuit. The author draws your attention to this fact but expects you to look them up. Suitable resistor values are shown in the circuit diagram for this instructable

    Connecting the the HC-05 bluetooth module to the 3.3volt supply will NOT protect the RXDATA line. The Arduino is connected to a 5 volt supply which means the TX data pin will rise to 5 volts. A voltage divider is required.

    I suspect that the reason your project is not working is one of communication speed.

    The default speed for an HC-05 is 9600 bauds whereas the required communication speed for my Acoustic Radar Receiver is 115200 bauds.

    My Acoustic Radar Receiver is unlikely to work if you reduce the communication speed. To convert this project to bluetooth requires that you increase the HC-05 communication speed to 115200 bauds.

    Instructions for doing this may be found by entering "AT bluetooth" (without the quotes) into the Instructables "Lets Make ..." search bar. This search brings up a number of instructables.

    The following example appears to have the AT commands that you need


    Question 1 year ago

    hi can u tell me the connection of microswitch as where does c ,nc and no ...should go please help me as it is not clear as if where to connect the microswitch


    Answer 1 year ago

    The microswitch is connected between GND (ground) and Arduino pin 4 (this pin is also known as pin D4). The green lines on the wiring diagram are correct.

    The microswitch connections are also defined in code lines 45,46
    // ----- micro-switch
    #define Micro_switch 4

    The letters c, nc, no on your micro-switch mean:
    c = common
    nc = normally closed
    no = normally open

    Connect the green wires on the wiring diagram between c and no.


    Question 2 years ago

    can i remove the micro switch by directly connecting the pin 4 to 5v vcc in the arduino itself
    or that micro switch is necessary as it is a part of program i wanted to know how to remove it


    Answer 2 years ago

    Remove the switch and change code line 47 to read:
    bool Switch_present = false;


    Reply 2 years ago

    i removed the switch and all wires with it ...and changed this line bool Switch_present = true; to false ..i am not using that raw echo pin ..but the setup is not working ,,....the motor dosen't rotate and if i keep it "true" motor rotates but nothing happens in processing 3