Small Logo

How to Use Multiple Ultrasonic Sensors

Using Multiple Ultrasonic SensorsThis guide covers:

      – Free Run Operation

      – Simultaneous Operation

      – Commanded Sequential Reading

      – Constant Looping Operation

 

When using a single ultrasonic sensor, typically it is possible to just let it range continuously in free run mode. This method is easy and works well.

Please consult your sensor datasheet or Finding Distance Using Analog Voltage for calculation formulas for analog voltage to distance.

 

Free run all Sensors

(Not recommended)

Continuous free run operation will generally not work when using multiple ultrasonic sensors in the same system. If you leave Pin 4 (the RX pin) unconnected so that the sensors range continuously, at start-up the sensors will range at exactly the same time. Since the sensors are not synchronized, the sensors will range with slightly different intervals. Slowly the sensors will stop ranging at the same time. These frequency drifts will likely cause interference between sensors for most applications. If looking at the analog voltage output from the MaxSonar, this will appear as voltage noise that occurs at some regularly occurring rates. Additionally, the digital outputs will have phantom readings at some regularly occurring rates.

This is because the sensor “noise” is actually interference from other sensors, not actual noise. The sensors are just behaving the way they were designed to behave. This describes the general results that you would be getting (as verified by a voltmeter). This issue becomes more apparent at longer distances, to the point that the sensor readings are very rarely reliable.

The reason the action is happening is that the sensors are not operating synchronously with each other or at the same speed. One sensor may be operating slightly faster than the other. For example, sensor 1 is operating at 49.0mS while sensor 2 operates at 49.2mS. When the sensors are not synchronized, one sensor may be in transmitting mode while the other sensor is in receiving mode. Because this action is happening, the sensor is receiving the pulses from the sender and not its own pulse bounce back. The closer the sensors are in synchronization, the longer the stable period is. The farther out of synchronization the sensors are, eventually they may not even appear to function properly. This happens because the stable period is extremely short or there is no period of stability.

Figure 1 below shows a single sensor operating, detecting an object at 96 inches with now other sensors present. Figures 2 and 3 show the operating of a sensor if other sensors are operating in the area in free-run operation. As the sensors become more unsynchronized the range readings become more and more unstable.

 

Single Sensor Operation Figure 1

Figure 1. Single Sensor operation

Single Sensor Operation Figure 2Figure 2 

Single Sensor Operation Figure 3Figure 3

 

Control the MaxSonar Sensors to Range Simultaneously

(Application dependent)

Connect all the MaxSonar® RX lines together, and connect to your control circuit such as a pin on a microcontroller (or even a 555 timer set up to strobe high for at least 20uS with a period between strobes great or equal to a timing that has been stated in the sensor datasheet).

To view a wiring diagram of what this set up should look like view figure 4.

 

MaxSonar Simultaneous Operation
Figure 4

 

For the MaxSonar sensors, you can start all the sensors at the same time by pulling the RX pins high for the 20uS. For the LV-MaxSonar sensors, this can be done as often as every 50ms. For the XL-MaxSonar sensors, this can be done as often as every 100mS or more. This will sync the MaxSonar® sensors to take readings at the same time.

The MaxSonar® sensors, because of continuously variable gain, will typically ignore adjacent sensors when running simultaneously. This method is especially convenient when using the analog voltage (AN output), as the analog voltage can be read at any time.

This method works for all sensors lines. We used an LV-MaxSonar-EZ line to show the diagram. As long as Pin 4 (RX) is connected to the same trigger device all the sensors will range simultaneously.

 

Sequentially Read Each MaxSonar®

(Most reliable)

To sequentially read each sensor, connect your triggering device to pin 4 (RX) of the first sensor, then connect pin 5 (TX) output of the first sensor to the RX pin of the next sensor that is to be ranged in sequence. Do this with however many sensors are to be used in the chain. To view a diagram of how each chaining diagram is wired view figures 5 through 8 below.

 

LV-MaxSonar-EZ Sequential Reading, XL-MaxSonar-EZ Sequential Reading, XL-MaxSonar-AE Sequential Reading

Figure 5. LV-MaxSonar-EZ and XL-MaxSonar-EZ/AE Diagram

HRLV-MaxSonar-EZ Sequential ReadingFigure 6. HRLV-MaxSonar-EZ diagram

 

 

MaxSonar-WR Sequential Reading, MaxSonar-WRC Sequential Reading

Figure 7. MaxSonar-WR and MaxSonar-WRC diagram

HRXL-MaxSonar-WR Sequential Reading, HRXL-MaxSonar-WRC Sequential ReadingFigure 8. HRXL-MaxSonar-WR and HRXL-MaxSonar-WRC diagram

 

To start the commanded sequential reading for the MaxSonar sensors, trigger the first sensor to range. This allows each device to range only after the previous has finished (every 50mS for the LV-MaxSonar sensors or every 100mS for the XL-MaxSonar sensors). This method will always work. There will not be any interference between sensors, but ranging frequency drops by the factor of the number of sensors used.

 

Continuous Looping

To have the circuit continuously loop so the chain is always giving an analog voltage output, connect pin 5 of the last sensor in the sequence to pin 4 of the first sensor in sequence with a 1K resistor in sequence between the pin 5 output and pin 4 input. For a diagram of how the wiring should look for the MaxSonar sensors operating in a Continous Loop please see figures 9 through 12 below.

 

LV-MaxSonar-EZ Constant Looping Chain, XL-MaxSonar-EZ Constant Looping Chain, XL-MaxSonar-AE Constant Looping Chaing

Figure 9. LV-MaxSonar-EZ and XL-MaxSonar-EZ/AE Constant Chaining Loop Diagram

HRLV-MaxSonar-EZ Constant Looping ChainFigure 10. HRLV-MaxSonar-EZ Constant Chaining Loop Diagram

 

 

XL-MaxSonar-WR Constant Looping Chain, XL-MaxSonar-WRC Constant Looping Chain

Figure 11. XL-MaxSonar-WR and XL-MaxSonar-WRC Constant Chaining Loop Diagram

HRXL-MaxSonar-WR Constant Looping Chain, HRXL-MaxSonar-WRC Constant Looping ChainFigure 12. HRXL-MaxSonar-WR and HRXL-MaxSonar-WRC Constant Chaining Loop Diagram

 

With these sensor chaining methods, once pin 4 is pulled high for 20uS on the first sensor, all sensors will chain sequentially. After the microcontroller brings pin 4 high, the microcontroller will have to return it’s pin to a high impedance state so that after the sequence is complete the TX signal output from the last sensor will trigger the RX of the first sensor.

 

Crosstalk Q & A

A major issue with using multiple ultrasonic sensors in an application or environment is a type of interference referred to as crosstalk. Crosstalk occurs when two (or more) nearby ultrasonic sensors receive the signal of another sensor.  When they are out of sync, it causes bad readings.

Here are specific cases and suggestions we’ve covered in technical support inquiries:

 

If you had multiple machines with a forward facing sensor, will one machine’s sensors ever interfere with another machine’s sensor as they navigate around a warehouse?

This would depend on the distance and the angle the sensors were pointed at each other. If the sensors are pointed directly at each other, and within the detection zones of either sensor, there is a good chance of crosstalk happening. Also if the environment is very tight or a closed in space, more sound could be reflected in the environment. If the environment is a large open warehouse, the likelihood of this happening would be minimal, but not impossible. Do note that the likelihood will also be lower if you use a part with internal filtering such as any of our HR parts.

 

LV vs HRLV line, Which is the best type of sensors to use for the front of your robot?

Operating two LV-MaxSonar-EZ sensors within the front footprint of a robot can lead to crosstalk. You would likely get a number of spurious readings due to the operation of two sensors from the LV-MaxSonar-EZ line in the proximity. As such, we’d recommend considering the HRLV line over the standard LV line, but you are free to test whichever you prefer. That is unless you use a chained multiple sensor operation methods as outlined in our datasheets.  With the HRLV line, the operation of multiple ultrasonic sensors can be done simultaneously in free-run mode with minimal impacts from crosstalk.  However, multiple sensor operation can be used to further ensure your chances of rejecting all potential crosstalk.

 

Can you tell me the minimum distance between Ultrasonic that will not interference each other? (using RS232 to read the detected range)

This is not something we have tested as there would be too many variables to test for due to the number of user applications our sensors are used in. Using multiple ultrasonic sensors in an environment can cause crosstalk between the sensors. Generally, you want to make sure the sensors are as far away from each other as possible when mounting them in the final environment. Also, make sure the sensors are not pointed at each other and are as perpendicular to the intended target as possible. It will take trial and error on your part to find the best mounting configuration in your application.

 

Products Related to the Article


MB1024 LV-ProxSonar-EZ2

MB1024 LV-ProxSonar-EZ2

These ultrasonic proximity sensors detect objects in a calibrated detection zone. The LV‑ProxSonar‑EZ…

Buy Now

MB1004 LV-ProxSonar-EZ0

MB1004 LV-ProxSonar-EZ0

These ultrasonic proximity sensors detect objects in a calibrated detection zone. The LV‑ProxSonar‑EZ …

Buy Now

MB1014 LV-ProxSonar-EZ1

MB1014 LV-ProxSonar-EZ1

These ultrasonic proximity sensors detect objects in a calibrated detection zone. The LV‑ProxSonar‑EZ…

Buy Now