Small Logo ×

Legacy FAQ Index

Legacy FAQ Index for the LV-MaxSonar Products

  • What motivated MaxBotix Inc., to design, build, and market the original MaxSonar-EZ1™? Link
  • How can I quickly verify the operation of the MaxSonar? Link
  • Why do unstable readings occur in my particular setup, and what can I do about them? Link
  • How can I get the best possible accuracy from the analog output? Link
  • Tell me how serial, pulse width, and analog voltage outputs compare. Link
  • What is the beam width of the MaxSonar in degrees? Link
  • How can I use more than one MaxSonar in the same system? Link
  • Tell me more about the repeatability and accuracy of the MaxSonar. Link
  • How can I use the LV-MaxSonar-EZ and XL-MaxSonar-EZ sensors outside? Link
  • What are the exposed materials of the MaxSonar-WR™ and MaxSonar®-WRC™ and what use is it rated for? Link
  • What can the weather resistant MaxSonar-WR™ and MaxSonar-WRC™ (IP67) outdoor sensors be used for?  Link
  • Can I copy and use the MaxSonar circuit on the data sheet? Link
  • Are any of MaxBotix Inc., products rated for use in human safety applications?  Link
  • Code example for BasicX, BX24p. Link
  • Code example for the Basic Micro, Atom. Link
  • Code example using Wright Hobbies, DevBoard-M32 (AVR using Bascom). Link
  • Code example using Parallax, Basic Stamp BS2. Link

Legacy FAQ for the LV-MaxSonar Products

What motivated Maxbotix Inc., to design, build, and market the Original MaxSonar?

Have you ever said, “Wouldn’t it be nice to have a sensor that provided data I could trust”?

The primary goal during the building of the MaxSonar®-EZ1™ was to make a high performance ultrasonic range finder that provided readings, so stable, that unless the object moved, the readings didn’t vary. Objects between 6” and 254” are ranged, and objects closer than 6” report 6”. This article is an actual plot to a swinging ball showing the stability of readings provided by the MaxSonar®-EZ1™.

Back to top of page

How can I quickly verify the operation of the MaxSonar®?

For detailed information please refer to our LV-MaxSonar-EZ Quick Start Guide

First, you will need to supply 5V to the sensor. Then verify at least one of the outputs. When using a microcontroller, it takes only one pin to monitor any of the outputs, and if using only one sensor this is all that is needed.

For example, Figure 1.1 is a simple schematic of the connections required to use one sensor with an analog to digital converter.

schematic for analog to digital converter
Full Image Here
Figure 1.1.
(If using more than one sensor, please read the answer to “How can I use more than one MaxSonar® in the same system?”

a) AN Output

This output is very easy to use. If you have a voltmeter, just measure between the AN output and GND.
For the LV-MaxSonar sensor family, you will measure approximately 10mV per inch when the sensor is powered at +5VDC.
To get the exact voltage take VCC/512=V/inch (mV/Inch). VCC will be your power input.

To get the formula for your sensor please consult your Datasheet. The formula will be on Page 2 under Pin 3.

b) TX Output

Use the TX output, if you have a PC and would like to verify the TX output. If your serial connection is a DB9, TX on the MaxSonar® is connected to the DB9-Pin 2, and GND on the MaxSonar® is connected to the DB9-Pin 5 as shown in figure 1.2. You can then use Hyperterminal on most Windows PCs.

DB9 Pin image
Figure 1.2.

Alternatively, you can download and use Sonar Acoustic Ranger shown in figure 1.3 program (4MB):

Sonar Acoustic Ranger
Figure 1.3.

Richard Grier, author of “Visual Basic Programmer’s Guide to Serial Communications” wrote this easy to use demonstration program for the MaxSonar®-EZ1™. Just download, install, and run the program. The Port defaults to COM 1, so if you are not using COM 1, select Port and set to your com port. Then select run, and then click on running. The graph above shows my hand moving in front of the MaxSonar®-EZ1™, followed by the height to the ceiling.

(You can see Richard’s writeup at Just follow the links, PC Data Acquisition, and then, Sonar.)

c) PW output

The pulse width output is not as easy to use as the AN or the TX, but can be viewed with an oscilloscope, or can be timed with a microcontroller. The pulse width output is included for software compatibility with low-end sensors where the user’s microcontroller must time the sensor output.
For Pulse Width time of flight calculation directions please consult your product data sheet. Products

Back to top of page

Why do unstable readings occur in my particular setup, and what can I do about them?

First, you must begin with a sensor that does not have unstable readings to begin with. If your sensor has unstable random readings, then sorting out the cause of additional outside effects, can be daunting.

Electrical Noise

When electrical noise is introduced on the line, it can cause the MaxSonar sensors to output unstable readings. Known items that cause excessive power supply noise are Sharp infrared range sensors, XBee radios, some wireless control systems, some switching power supplies, some servos, etc. There is a simple solution that eliminates the effects of a dirty power supply to the sensor. Please click this link to view the solution.

Multiple Sensors

The first and most obvious cause of unstable readings is interference when running multiple sensors. This can in general be easily determined and corrected. When running more than one sensor they should be pointed in different directions or they should be ran at different times.

To read more about operating multiple sensors read “How can I use more than one MaxSonar® in the same system?”

Physical Wave Effects

The sensors cannot overcome the effects of physics. Lets take two examples.

Single Sensor Multi-Return Paths

Lets say you have one sensor mounted 12 inches off the floor. You move the robot back away from the wall until no return is detected. This “maximum range” occurred at 3 meters and not at the 6 meters you expected. But if you pull the robot back another 0.5 meters to 3.5 meters the signal reappears and the sensor detects the wall past 6 meters. What happened is that there were two signal return paths back to the sensor. The direct path (expected) and the indirect path (the unexpected one that included the floor refection). At this distance and with this setup, phase cancellation can occur at the sensor. So the sensor does not have a signal to detect, not because the sensor is defective, but because of multi path signal cancellation from phase effects. The effects are well defined in wave theory, but can be very subtle in real world examples.

Multi-Sensor Interference

For example your setup is firing two sensors at the same time, and both sensors are pointed in the same direction. Let’s say that the sensors are spaced 4 inches apart. For this example, it is possible to get a return that is a much larger signal return, when the echoes come back in phase than would normally be expected. It would also be possible to get a much smaller signal return, when the echoes come back out of phase, effectively canceling each other and not allowing the object to be detected.

Back to top of page

How can I get the best possible accuracy from the analog voltage output?

We have heard that the analog voltage output agrees with the other outputs. This is true for most users because the MaxSonar® sets this voltage to within 5 mV, twice the accuracy required.

But if in your application the MaxSonar® analog voltage output has noise, there is an easy way to remove the noise on the analog voltage output. Place a capacitor near/at your analog to digital pin directly to your ground. Next place a resistor in series with the analog voltage output from the MaxSonar® to the capacitor.
See figure 2.1 for using a filter with the LV-MaxSonar-EZ.
See figure 2.2 for using a filter with the XL-MaxSonar-EZ/AE.
See figure 2.3 for using a filter with the XL-MaxSonar-WR and WRC.

using a filter with the LV-MaxSonar-EZ
Full Image Here

Figure 2.1

using a filter with the XL-MaxSonar-EZ/AE
Full Image Here

Figure 2.2

using a filter with the XL-MaxSonar-WR and WRC
Full Image Here

Figure 2.3

Back to top of page

Comparing the serial, pulse width, and analog voltage outputs.

The serial digital output and the pulse width outputs are taken directly from the time of flight measurement. They will have no additional noise present on them and will be the most accurate. Concerning the analog output, most users have reported that the analog output agrees exactly with the other two outputs, and have not had problems with noise on the analog output.

It is possible for the analog output to have additional noise coupled onto the output, especially for long signal runs. Let’s describe how the analog output section of the circuit works. The analog voltage is set by the microcontroller on the MaxSonar® as measured by the analog to digital converter integrated in the microcontroller. The voltage is held in a capacitor and very little drift occurs between measurements. (In addition, if the range measurements are stopped, the microcontroller maintains the last analog voltage at the correct level.) Next, the voltage is buffered by an opamp. The opamp is a very low cost amplifier and does have some inherent offset and non-linearity. This offset and non-linearity is repeatable, but it will introduce some error in the readings, but will not cause the non-repeatability mentioned above. So the analog voltage is ready to be read by an outside circuit. Figure 3.1 below is a plot of the analog voltage for a few range measurements captured on a digital oscilloscope. The voltage on the output was multiplied by 100 (i.e. divided by 0.01 volts per inch) to yield inches. This data was taken with an LV-MaxSonar-EZ1. Please refer to your data sheet for the Analog Voltage conversion formula.

Analog Voltage Chart
Figure 3.1

If the outside circuit is a handheld multimeter, the voltage will typically appear very stable because most meters of this type integrate the voltage for 0.1 seconds and virtually all noise will be eliminated. So a multimeter will function very well to display the analog voltage and the corresponding range, except for rapidly changing ranges.

Back to top of page

How to read the beam angle and beam patterns

All of our sensors have firmware gain changes through the length of the beam. this feature distinguishes our ultrasonic sensors from most other low cost sensors. The beam pattern in the data sheet matches the actual calibrated detection pattern within a few inches on either side (for a similar sized object). The beam width (angle) is not defined because the actual beam width dynamically changes over the course of the range. We provide beam pattern plots as approximations to certain size targets. The beam angle at a given distance for a specific target can be calculated by measuring the beam angle from the beam patterns plots. If you look at the beam plots in our data sheets, the beam angle is wide for close objects but then decreases for objects at longer distances, this is done to give our sensors a consistent and narrow detection field. All our sensors are all factory calibrated so additional units of the same part number will have similar beam plots.

Each beam pattern is a 2D representation of the detection area of the sensor. The beam pattern is actually shaped like a 3D cone (having the same detection pattern both vertically and horizontally). Read our beam plots by looking at the target size and distance of detection (most are plotted with three or four targets, sizes ranging from the smallest target on the left to the largest target on the right side of the plot). There are typically two voltages plotted which shows the change in the detection pattern at different voltages (3.3V and 5V are typically used voltages). The beam pattern is not selectable based on A,B, or C. The beam pattern achieved is determined by the target size. The beam plots are provide to help identify an estimated beam pattern for an application based on the size of a target vs the plotted beam patterns.

You can view an example of the beam pattern below on Figure 4.1

Figure 4.1

Voltage change and the effect on the beam pattern

Typically, the higher the voltage, the larger the beam pattern. As you reduce the voltage, the size of the beam pattern decreases. There are typically two voltages plotted which shows the change in the detection pattern at different voltages. 5V is the black line and 3.3v is the red dots. You can see how the beam patterns change with voltage changes.

What are the dowels?

The dowels are essentially vertically hanging targets (pipes). The dowels provide consistence target detection characteristics for a given size target which allows easy comparison of one MaxSonar sensor to another MaxSonar sensor. The smaller the dowel, the smaller the detection (beam) pattern.

Back to top of page

How can I use more than one MaxSonar® in the same system?

When using just one sensor you can just let it range continuously in free run mode. This is very easy and works very well.
Please consult your sensor datasheet for calculation formulas for voltage to distance.
For XL-MaxSonar-EZ/AE and XL-MaxSonar-WR sensors please consult your data sheet for BW pin logic.

a) Free run all Sensors (not recommended)

Continuous free run operation will generally not work when using more than one sensor in the same system. Let’s discuss what happens. If you leave the RX pins unconnected on both devices so that they range continuously, at start-up they will range at exactly the same time, however they aren’t synchronized and will range with slightly different intervals. Slowly but surely the devices 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), “the signal voltage will hold constant for a given distance and proceed to drop some and slowly walk back up to the stable voltage or vice versa (Figures 5.1 & 5.2). This issue becomes more apparent at longer distances, to the point that the sensor readings are very rarely reliable.” Figure 5.3 shows a single sensor free running and detecting an object at 96 inches. Note the stable readings when no other sensor is free running in the same area as the sensor.

Decreasing Range
Figure 5.1. Slowly decreasing in range.

Increasing Range
Figure 5.2. Slowly increasing in range

Graph of detecting object at 96 inches
Figure 5.3 Single sensor free running detecting an object at 96 inches.

The reason the action is happening is because the sensors are not operating in sync with each other or at the same speed. i.e. one sensor is operating slightly faster than the other. Sensor 1 operates at 49.0mS and sensor 2 is operating at 49.2mS. When the sensors become out of sync, one sensor is 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 sync, the longer the stable period. The farther out of sync, the sensors may not even appear to function properly because the stable period is extremely short or there is none.

b) Control the MaxSonar® Sensors to Range at the Same time (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 of 50mS or more). Then start all the MaxSonar® sensors at the same time by pulling the RX lines high for 20uS (or more but less than 47 mS). You can repeat this every 50mS or more. This will sync the MaxSonar® sensors to take readings at the same time. The MaxSonar®, because of continuous variable gain, will ignore (in most instances) adjacent sensors. This method is especially convenient when using the analog voltage (AN output), as the analog voltage can be read at any time (i.e. the user does not have to wait for the output).
To view a wiring diagram of what this set up should look like click here

c) Sequentially Read each MaxSonar® (always works)

Only start one device every 50mS. This allows each device to range only after the previous has finished. 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”.
To view a wiring diagram of what this set up should look like click here
This method will work for all sensors in the MaxBotix® line of sensors.
To view the wiring diagram of Chaining with Constant Looping for the LV-MaxSonar-EZ sensors click here
To view the wiring diagram of Chaining with Constant Looping for the XL-MaxSonar-EZ, AE, WR, WRC sensors click here

5d) A User has designed a circuit that Controls/Reads up to 12 MaxSonar®-EZ1™ sensors.

This user wanted to run many sensors off the same serial port with added features. (Works well!)
The link below shows how this was done, and includes full details.

Back to top of page

Tell me more about the repeatability and accuracy of the MaxSonar®.

As an object is moved away or towards the sensor, typically the MaxSonar® will only switch between two values. This switch occurs as the MaxSonar® is going though the transition from one inch (for the LV-MaxSonar sensors) or one cm (for the XL-Maxsonar sensors) to the next.

Making a sensor as small as the MaxSonar®-EZ1™ involves some compromises. Instead of a crystal oscillator, the PIC microcontroller internal RC oscillator is used. Although the PIC clock is accurate, we have found that it is better to calibrate the microcontroller clock at the MaxBotix® factory to within 1%. Even after calibration, the internal RC clock may drift from this calibration value by another 1%. Other factors affect accuracy; like temperature, the size of the object detected, and the texture of the object detected.

How can I use the LV-MaxSonar®-EZ™ and XL-MaxSonar®-EZ™ sensor outside?

Although the LV-MaxSonar®-EZ™ and XL-MaxSonar®-EZ™ sensors were designed for “protected indoor enviroments” the MaxSonar®-EZ™ sensors have been used outdoors in very rugged enviroments.  The link below sports a very good discussion on the LV-MaxSonar®-EZ™.

It also shows an easy to build housing that keeps the sensor “protected” while in operation, where a plastic PVC housing and some very thin foam is used on the sensor face. Here the sensor is used (in air above the water line) to measure the draft of a ship. This link below shows how the sensor was used to measure salt in a water softener.

This link below shows the High-Lighter where a LV-MaxSonar®-EZ1™ reads a trampoline in operation. The higher the jump the larger the flame burning in the display.

Back to top of page

What can the weather resistant MaxSonar®-WR™ and MaxSonar®-WRC™ (IP67) outdoor sensor be used for?

The MaxSonar®-WR™ and MaxSonar®-WRC™ sensors can be used in a wide variety of applications. These applications include non-contact fluid, liquid level sensors, tank level measurement sensors, proximity sensors, people detection sensors, applications requiring a standard IP67 rating, and any ranging or sensing application for outdoor use.

In addition, the very low cost of the MaxSonar®-WR™ and MaxSonar®-WRC™, and low power & voltage requirements, together with rugged construction, makes it an ideal sensor for indoor applications. This is also useful where a very narrow beam width (pencil beam) and very long range is required

Back to top of page

What are the exposed materials of the MaxSonar®-WR™ and the MaxSonar®-WRC™ and what use is it rated for? (Updated 4/12/2010)

The outdoor sensor line is IP67 rated for water and dust intrusion. This material list allows customers to determine if the part will meet their specific requirements.

The MaxSonar®-WR™ and the MaxSonar®-WRC™ and related IP67 products have exposed materials. The list of these materials is Aluminum (covering the transducer), PVC (the housing material), and Silicone Rubber (Fluorosilicone optional for sealing the electronics). Our standard products use Silicon O-Rings for general purpose sealing. The Fluorosilicone O-Rings are for even more robust sealing in many environments. (Users desiring the Fluorosilicone O-Rings must request this.) AL, PVC, Silicone Rubber, and Fluorosilicone have a long history of use in various environments, allowing our customers to make their own assessment.

Many customers have requested a sensor for use with various chemicals. These chemicals include gas, diesel fuel, fuel oil, oil, and solvents. MaxBotix® Inc., has not verified the long-term performance, and will not warranty sensors used in chemical environments (other than standard outdoor use). Our end users are encouraged to test our sensors for use in their environment and make there own determination.

Back to top of page

Can I copy and use the MaxSonar® circuit on the data sheet?

MaxBotix® Inc., holds full patent status on the MaxSonar® line of ultrasonic rangefinders (patent 7,679,996).  At this time, we do not issue licenses for use of our MaxSonar® product line circuits or software.

MaxBotix® Inc., provides circuit information on our MaxSonar® line in our data sheets so our customers can understand the basic circuitry operation of our sensors. From this, advanced users can understand how the sensor operates, and for some this makes the sensor easier to use. For example, some students have placed this circuit into PSpice, an electrical circuit simulator, and have analyzed our circuit operation. Even so, the circuitry is only part of the MaxBotix® Inc., ultrasonic sensor solution, as the sensor also relies upon internal firmware, and factory calibration.

Back to top of page

Are any of MaxBotix® Inc., products rated for use in human safety applications?

MaxBotix® Inc., products are not authorized for use as critical components in life support devices or systems. As used herein: 1) Life support devices or systems are devices or systems which, (a) are intended for surgical implant into the body, or (b) support or sustain life, and whose failure to perform when properly used in accordance with instructions for use provided in the labeling, can be reasonably expected to result in a significant injury to the user. 2) A critical component is any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its safety or effectiveness.