Follow MaxBotix:
|     Written By: Tom Bonar     |     DatePosted: 07-10-2012     |
Sensor Noise Analysis Diagram

How to Calculate Distance from the Pin 3

The Analog Voltage pin on the MaxSonar family of sensors has been the most popular output for our users. All of the MaxSonar sensors have this output included. This guide will give a look into how to use it for obtaining the distance to the target being detected. The Analog Voltage output is scaled on all sensors to the power input of the sensor. The Analog Voltage output will output a linear voltage that gets larger as a target increases in distance from the sensor. This scaling will be outlined with each sensor family. For all examples the power input is +5VDC.

Our standard LV-MaxSonar and XL-MaxSonar sensors assume the temperature is 22.5 degrees celsius. These sensors do not apply temperature compensation as the air temperature changes. Our HR-MaxSonar sensors do apply automatic temperature compensation as the air temperature changes. To apply temperature compensation to your part please see the Temperature Compensation PDF here

LV-MaxSonar Sensors

This is for the LV-MaxSonar-EZ, LV-MaxSonar-WR, and LV-MaxSonar-WRC. All of our LV-MaxSonar sensors range to targets in inches. The formula for the voltage scaling on an LV-MaxSonar sensor family is:

[(Vcc/512) = Vi]
Vcc = Supplied Voltage
Vi = Volts per inch (Scaling)

Example 1
[(5.0V/512) = 0.009766V per inch = 9.766mV per inch]

Calculating the Range

Once you know the voltage scaling it is easy to properly calculate the range.
The range formula is:

[(Vm/Vi) = Ri]
Vm = Measured Voltage
Vi = Volts per Inch (Scaling)
Ri = Range in inches

Example 2:
If your multimeter shows a measurement 292.98mV then you use the calculations as follows:
[(292.98mV/9.766mV) = 30 inches]

Example 3:
To work backward and verify your calculation is correct use the inverse formula:

[(Ri x Vi) = Vm]
[(30 x 9.766) = 292.98]

Using an LV-MaxSonar with an ADC (Analog Digital Converter)

When using an LV-MaxSonar with an ADC, verify that the sensor and micro-controller are referencing the same power supply and ground. This also assumes that the ADC being used is perfectly accurate.

When reading the sensor's output with the scaling in inches with a 10-bit ADC, divide the ADC output by 2 for the range in inches.
If the ADC output reads 508 (maximum output) the range in inches is 254 inches. If the ADC output reads 250 the range in inches is 125 inches.

Standard XL-MaxSonar Sensors

This is for the XL MaxSonar EZ, XL-MaxSonar-AE, XL MaxSonar WR, and XL MaxSonar WRC. This formula does not include scaling for our 10 meter sensors: XL-MaxSonar-WRL1/WRLA1, XL-MaxSonar-EZL0/AEL0, and XL-MaxSonar-EZL1/AEL1.

The voltage scaling formula for the standard XL MaxSonar sensor family is:

[(Vcc/1024) = Vcm]
Vcc = Supplied Voltage
Vcm = Volts per cm (Scaling)

Example 1:
The formula should read:
[(5.0V/1024) = 0.004883V per cm = 4.883mV per cm]

Calculating the Range

Once you know the voltage scaling you can properly calculate the range.

The range formula is:

[(Vm/Vcm) = Rcm]
Vm = Measured Voltage
Vcm = Volts per cm (Scaling)
Rcm = Range in cm

Example 2:
If the multimeter shows a reading of 439.47mV, then you use the calculation as follows:
[(439.47mV/4.883mV) = cm] in this case the range is 90cm

Example 3:
To work backward and verify your calculation is correct use the inverse formula:

[(Rcm x Vcm) = Vm]
[(90 x 4.883mV) = 439.47mV]

Using a Standard Range XL-MaxSonar with an ADC (Analog Digital Converter)

When using a standard XL-MaxSonar with an ADC, verify that the sensor and micro-controller are referencing the same power supply and ground. This also assumes that the ADC being used is perfectly accurate.

When reading the sensor's output with the scaling in centimeters with a 10-bit ADC, the range can be read directly off the ADC.
If the ADC output reads 700 the range in centimeters is 700 centimeters. If the ADC output reads 200 the range in centimeters is 200 centimeters.

XL-MaxSonar Long Range Sensors

For the 10meter long range sensors the calculation formula is

[(Vcc/1024) = V2cm]
Vcc = Supplied Voltage
V2cm = V per every 2 cm

Due to a limitation of hardware the Analog Voltage output steps in 2cm increments.

The formula to find the final distance is
[(Vm/V2cm)=U] x 2= cm

Vm = Volts measured
V2cm = V per every 2 cm
U = half measurement

Example 1:
Your multimeter has a reading of 439.47mV.
[(439.47/4.883)=90] x 2 = 180cm

Example 2:
To work backwards and verify correct calculation us the following formula

[(cm/2) x V2cm]=Vm

If you input the calculated range from Example 1 of 180cm into the formula, your reverse formula should read
[(180/2)x4.883]=439.47mv

Using a Long Range XL-MaxSonar with an ADC (Analog Digital Converter)

When using a standard XL-MaxSonar with an ADC, verify that the sensor and micro-controller are referencing the same power supply and ground. This also assumes that the ADC being used is perfectly accurate.

When reading the sensor's output with the scaling in centimeters with a 10-bit ADC, the range output has a 2cm resolution.
If the ADC output reads 500 the range in centimeters is 1000 centimeters. If the ADC output reads 200 the range in centimeters is 400 centimeters.

5-Meter HR-MaxSonar sensors

This is our newest line of sensors. To calculate the distance using voltage please use the following formula

(Vcc/5120)=Vmm
Vcc = supplied voltage
Vmm = Volts per mm

Due to a limitation within the hardware of the sensor the Analog Voltage steps in 5‑mm increments. The formula to do this is

Vmm x 5=V5mm or [(Vcc/5120)=Vmm]x5=V5mm
Vmm = Volts per mm
V5mm = Volts per 5‑mm

Example 1
[(5/5120)=Vmm]x5=0.004885 in this case Vmm will be 0.0009765 or 0.977mV per mm and V5mm is 0.004885V or 4.885mV per 5 mm

After the voltage scaling has been found, range calculation is now able to be done.

To calculate range use the formula:
(Vm/V5mm)x5=Rmm

Vm = Volts Measured
V5mm = Volts per 5 mm
Rmm = Range in mm

Example 2
The multimeter being used shows a voltage of 2.427V (2427.5mV). To find the distance the formula would look like
(2427.5/4.885)x5=Rmm
For this example the Range in millimeteres is 2500 millimeters

Example 3
To verify this is correct use the following formula:
(Rmm/5) X V5mm)=Vm

So the reverse calculation would look like:
(2500/5)X 4.885=Vm
After calculation the Vm should read 2427.5mV or 2.427V

Using a 5-Meter HR-MaxSonar with an ADC (Analog Digital Converter)

When using a 5-meter HR-MaxSonar with an ADC, verify that the sensor and micro-controller are referencing the same power supply and ground. This also assumes that the ADC being used is perfectly accurate.

Using a 10bit analog to digital convertor, one can read the analog voltage bits (i.e. 0 to 1024) directly and just multiply the number of bits in the value by 5 to yield the range in mm. For example, 60 bits corresponds to 300-mm (where 60 * 5 = 300), and 1000 bits corresponds to 5000-mm (where 1000 * 5 = 5000-mm).

10-Meter HR-MaxSonar sensors

This is our newest line of sensors. To calculate the distance using voltage please use the following formula

(Vcc/10240)=Vmm
Vcc = supplied voltage
Vmm = Volts per mm

Due to a limitation within the hardware of the sensor the Analog Voltage steps in 10‑mm increments. The formula to do this is

Vmm x 10=V10mm or [(Vcc/10240)=Vmm]x10=V10mm
Vmm = Volts per mm
V5mm = Volts per 10‑mm

Example 1
[(5/10240)=Vmm]x10=0.004883 in this case Vmm will be 0.0004883 or 0.488mV per mm and V10mm is 0.004883V or 4.883mV per 10‑mm

After the voltage scaling has been found, range calculation is now able to be done.

To calculate range use the formula:
(Vm/V10mm)x10=Rmm

Vm = Volts Measured
V5mm = Volts per 10 mm
Rmm = Range in mm

Example 2
The multimeter being used shows a voltage of 1.2207V (1220.7mV). To find the distance the formula would look like
(1220.7/4.883)x10=Rmm
For this example the Range in millimeters is 2500 millimeters

Example 3
To verify this is correct use the following formula:
(Rmm/10) X V10mm)=Vm

So the reverse calculation would look like:
(2500/10)X 4.883=Vm
After calculation the Vm should read 1220.7mV or 1.2207V

Using a 10-Meter HR-MaxSonar with an ADC (Analog Digital Converter)

When using a 10-meter HR-MaxSonar with an ADC, verify that the sensor and micro-controller are referencing the same power supply and ground. This also assumes that the ADC being used is perfectly accurate.

Using a 10bit analog to digital convertor, one can read the analog voltage bits (i.e. 0 to 1024) directly and just multiply the number of bits in the value by 10 to yield the range in mm. For example, 30 bits corresponds to 300-mm (where 30 * 10 = 300), and 1000 bits corresponds to 10,000-mm (where 1000 * 1 = 10,000-mm).

 
Author: TB & KO  Date: 03/26/2014
UCXL-MaxSonar-WR
The condensation issue in tanks and other moisture-prone environments is solved!
The SCXL‑MaxSonar sensor series, based on our popular HRXL-MaxSonar-WR product line, features a self-cleaning protocol gently heats the face of the transducer, atomizing any condensation to prevent moisture buildup.
Author: Tony Szczodroski  Date: 02/22/2014
HRUSB-MaxSonar-EZ 3d CAD pictures, MaxSonar CAD Files
Good news Designers – we now have downloadable 3D CAD models (in multiple formats) of our ultrasonic sensors! Designers and
Engineers can utilize these models for System integration design or free designing, and will save you time, money, and resources.
Author: Kurt Olsen  Date: 02/13/2014
UCXL-MaxSonar-WR
Our most popular sensor is now available in a new design which is physically shorter than any of our current outdoor sensors.
Our new UCXL‑MaxSonar‑WR series sensors are flexible, customizable products.
Author: Tom Bonar  Date: 12/04/2013
FIRST Robotics 2014, MaxBotix, MaxSonar
MaxBotix Inc., would like to welcome back all returning students to this years' F.I.R.S.T® competition. Last year we had an enjoyable
time watching teams creating robots during Ultimate Ascent competitions. We are excited to see what this years competition holds and the creativity that will be shown by all the students.
 
 
 
Author: Tom Bonar     Date:06/18/2012
Signup for notification of our exciting new products and periodic new letters. We are excited to provide the latest information from MaxBotix Inc.