Multiplexed Echo Locator

3.6K2611

Intro: Multiplexed Echo Locator

a.articles { font-size: 110.0%; font-weight: bold; font-style: italic; text-decoration: none; background-color: red; } a.articles:hover { background-color: black; }

This instructable describes how to make a “scanning” echo locator using an Arduino and four multiplexed ultrasonic sensors. There are no moving parts.

Construction is simple ... all you require is a sharp knife, two drills, a soldering iron, and a hacksaw.

In theory the location of up to four objects can be pin-pointed. In practice the best I have managed is three.

The circuit and code are purely experimental and are published in the hope that someone will find them useful.

Images

  • Photo 1 shows the assembled echo locator.
  • The video shows the echo locator pin-pointing the location two objects

STEP 1: Wiring Diagram

Photo 1 shows the wiring diagram for the “quad sensor echo locator”.

Sensor B1 and B2 are rendered “passive” by placing several layers of masking tape over the transmit (T) transducers.

This tape blocks the ultrasonic sound that would otherwise be emitted.

STEP 2: Parts List

Photo 1 shows the parts for my dual sensor echo locator. The quad sensor echo locator described in this article requires a further two ultrasonic sensors.

The following parts were obtained from https://www.aliexpress.com/ :

  • 1 only Arduino Uno R3 complete with USB cable
  • 4 only HY-SRF05, or HC-SR04, ultrasonic transducers

The following parts were obtained locally:

  • 1 only male arduino header strip
  • 4 only female arduino header strips
  • 2 only pieces of scrap aluminium
  • 2 only small pieces of wood
  • 2 only small screws
  • 6 only cable ties
  • 12 only lengths of plastic coated wire (assorted colors) [1]

Notes

[1]

The total length of the wires should equal the desired distance between the sensors plus a small amount for soldering. The wires are then twisted together to form a cable.

STEP 3: Theory

The circuit builds upon my “Dual Sensor Echo Locator”. [1]

Dual sensor echo locator

Photo 1 shows the “detection area” for the above echo locator.

The equations for this sensor are shown in photo 2.

This “dual-sensor” echo locator works well but requires both sensors to be mounted below the baseline (i.e. an offset is required) to avoid large "dead spots" that arise from using narrow-beam transducers..

But what if such an offset is not possible?

Quad sensor echo locator

It occurred to me that these “dead spots”, and the “offset”, could be eliminated if we quadruple the number of detection areas by doubling the number of sensors as shown in photo 3.

Switching rapidly (multiplexing) between the four possible sensor combinations effectively creates a rotating beam (photo 3). The entire area is covered and the “offset” has been eliminated.

Even better ... the same equations (photo 2) can be used!

In theory this “quad-sensor” echo locator :

  • can detect up to four objects. [2]
  • has no “dead spots”
  • requires no offset

Results

The concept works, as multiple objects can be detected, but small “dead spots” still remain as the narrow beam-widths do not completely illuminate the target area when the offset is zero. [3]

Notes

[1]

See https://www.instructables.com/id/Dual-Sensor-Echo... for a complete explanation and formulas.

[2]

Four objects assumes:

  • a beam-width of 45 degrees.
  • no “shadowing” of one object by another

[3]

Six sensors mounted at 30 degree intervals should completely eliminate the “dead spots”

STEP 4: Construction

Images:

  • photo 1: mounting brackets
  • photo 2: front view
  • photo 3: rear view
  • photo 4: top view

Mounting brackets

Two mounting brackets were made from 18 gauge aluminium sheet using the method described in my instructable https://www.instructables.com/id/How-to-Cut-Fold-...

Use a hacksaw, or tin snips, to make a 30mm cut from one edge to the 45 degree fold line. Now “score” both sides of the center-line from the saw-cut to the base then “wiggle” the unwanted section until it breaks free.

The dimensions for my brackets are shown in photo 1.

Sensor sockets

The sensor sockets have been fashioned from standard Arduino header sockets.

All unwanted pins have been pulled out and a 3mm hole drilled through the plastic.

When soldering the connections take care not to short the wires to the aluminium bracket.

Strain reliefs

A small piece of heat-shrink tubing at each end of the cable prevents the wires from unravelling.

Cable ties have been used to prevent unwanted cable movement.

STEP 5: Software Installation

Install the following code in this order:

Arduino IDE

Download and install the Arduino IDE (integrated development environement) from https://www.arduino.cc/en/main/software if not already installed.

Processing 3

Download and install Processing 3 from https://processing.org/download/

Quad Sensor Echo Locator

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

Close the Ardino IDE but leave the USB cable connected.

Quad Sensor Display

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

Now click the top-left “Run” button ... a graphics screen should appear on your screen.

Trouble-shooting

Processing will complain if the [number] associated with your COM port needs changing, but before doing so it will display a list of available “COM” ports each with a [number] in square brackets.

Simply replace the [0] in the following code line with one of these numbers:

  • myPort = new Serial(this, Serial.list()[0], Baud_rate);

Try each in turn ... one of them will work.

STEP 6: Testing

Connect the Arduino USB cable to your PC and run “dual_sensor_echo_locator.pde” by clicking the “top-left” run button on your Processing 3 IDE (integrated development environment).

Numbers, separated by a comma should start streaming down your screen as shown in photo1.

The last number is the zone ... the other two numbers are the sensor A1/A2 and sensor B1/B2 distances.

A red (flashing) dot will appear on the display whenever an object is detected inside the target area. Additional data will also appear once the sensors have located an object (photo 2).

Error message at startup

You may get an error message at startup.

If so change the [0] in line 85 of photo 1 to match the number associated with your “COM” port.

Several “COM” ports may be listed depending on your system. One of the numbers will work.

In photo 1 the number [0] is associated with my “COM4”.

Positioning your sensors

Space your sensors 100cm apart with the target 80cm..100cm in front.

Rotate both sensors slowly towards the diagonally opposite corner of an imaginary 1 meter square.

As you rotate the sensors you will find a position where a flashing red dot(s) appears on the graphics display.

The following information will appear once an object is detected:

  • zone
  • distance1
  • distance2
  • baseline
  • semi-perimeter
  • area
  • X coordinate
  • Ycoordinate

Images

Photo 1: No objects ... all distances fall outside in the detection area.

Photo 2: An object has been found in "Zone 3"

  Click here   to view my other instructables.

8 Comments

Just out of curiosity, why should the total length of each wire equal the desired distance between the sensors? Is it a signal over wire length issue? Is it a loss of voltage issue? It might be a silly question.

If I am a 100cm distance between the sensors, then the total wire should equal 100m (50cm to Arduino if its in the center), plus a little extra? If I am doing a 300cm distance between the sensors, then the total wire should equal 300m?
Thank you for your interest in my project :)

What you are saying is correct ... but it is also what I have written.

You appear to have read "The total length of THE WIRES (plural) should equal the desired distance between the sensors plus a small amount for soldering." as "The total length of EACH WIRE (singular) equals ... ".

My apologies for the confusion.

The wires can be any length you like providing they reach the sensors but there is no point in making them too long.

They should also not be cut to the exact sensor spacing as you need to allow for soldering.
This is one of the few projects I found that makes a good use out of the HC-SR04 .
What changes would one make to make it detect in bigger area ex. 4x4 meters ?
Thank you for your interest in my project :)
The detection area is determined by the "Baseline" and "Height" variables defined in the *.pde header.

You will also need to change the X-axis and Y-axis labels in the following *.pde code.
// ----- label the X-axis
fill(255); //white text
textAlign(LEFT, TOP);
text("0", -20, height+10); //0cm
text("50", width*0.5-20, height+10); //50cm
text("100cm", width-20, height+10); //100cm

// ----- label the y-axis
textAlign(RIGHT, BOTTOM);
text("100cm", 10, -10); //100cm
textAlign(RIGHT, CENTER);
text("50", -10, height/2); //100cm

Keep in mind that the sensors have a maximum detection distance of 4m.
Try increasing the Baseline and Height to 2m, to get a feel for the code and what happens, before progressing to a larger area.
It detects more then two points or more then two objects....?
Correct. The video shows two objects being pin-pointed.

In this instructable, as shown in step 3, four sensors create four detection areas which means that four separate objects may be detected providing that (1) each object is in a separate detection area and that (2) there is no "shadowing".

In https://www.instructables.com/id/Dual-Sensor-Echo-Locator/ two sensors create a single detection area. To illuminate a given area the two sensors need to be offset below the baseline.

Note that the sensors in this instructable are resting on the baseline whereas the two sensor version requires the sensors to be positioned below the baseline in order to completely illuminate the target area.

This is one of the hidden gems an actual radar that works.

Thank you for your comment. Glad you like the idea :)