Small Logo ×

Using Multiple MaxSonar® Ultrasonic Sensors

Running Multiple MaxSonar Sensors SimultaneouslyWhen 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.

This guide covers:
‑Free Run Operation
‑Simultaneous Operation
‑Commanded Sequential Reading
‑Constant Looping Operation

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 more than one sensor 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 because 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 unsyncronized the range readings become more and more unstable.
Single Sensor Operation Figure 1
Figure 1. Single Sensor operation

Single Sensor Operation Figure 2
Figure 2

Single Sensor Operation Figure 3
Figure 3

Control the MaxSonar Sensors to Range Simultaneously

(works for most instances)

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 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®

(Always Works)

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 Reading
Figure 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 Reading
Figure 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 Chain
Figure 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 Chain
Figure 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 sequencially. After the micro controller brings pin 4 high, the micro controller 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.