This is provided to serve as an easy to use set-up guide for the HRLV‑MaxSonar‑EZ family of ultrasonic sensors, awarded one of the Top 10 Sensor Products of 2012 from Sensors & Transducers Magazine. This sensor uses sound to measure the distance to nearby objects and reports the information through one of the three sensor outputs. This quick start guide for the HRLV-MaxSonar-EZ line will help you easily test and use your ultrasonic sensor.
This guide is designed to assist you in using your MaxSonar sensor for the first time! Don’t forget to read about MaxBotix being a proud golden sponsor for the FIRST Robotics Competition, where we supply HRLV-MaxSonar-EZ ultrasonic sensors every year to the annual international robotics competition.
List of Commonly Used Equipment:
Determine the Power and Ground Inputs & Outputs
Usually Found On…
HRLV-MaxSonar-EZ
Power Source / Multimeter
Wires
GND
“-” symbol
Black Wires (typically)
Power
+5
“+” symbol
Red Wires (typically)
Supply Power to the Ultrasonic Sensor
The HRLV‑MaxSonar‑EZ input power should be +5V DC. This system can operate from +2.5V to +5.5V. The current input should read ~3.1mA for +5V DC and ~2mA for +3.3V DC.
Connect to the AN Output
Connect the AN pin (Analog Voltage) to a multimeter by doing the following:
1. Switch the multimeter to read DC voltage. Connect the ground lead of the multimeter to the ground on your power supply.*
The Setup
Read the AN Output Using a Multimeter
A Brief Description of the AN pin
The analog voltage pin outputs a voltage which corresponds to the distance. The further away an object is from the sensor the higher the output voltage becomes which in turn will be measured by the multimeter. The sensor is designed to report the range to the closest detectable object.
Calculating the Voltage Scaling
Because the HRLV-MaxSonar-EZ output is scaled to the input power that is provided to the sensor, it is important to know the voltage scaling before calculating the range.
The formula for the voltage scaling on an HRLV‑MaxSonar‑EZ is:
[(Vcc/1024) = Vi]
Vcc = Supplied Voltage
Vi = Volts per 5 mm (Scaling)
Example 1: Say you have an input voltage of +5.0V the formula would read:
[(5.0V/1024) = 0.004883V per 5 mm = 4.883mV per 5 mm]
Calculating the Range
Once you know the voltage scaling it is easy to properly calculate the range.
The range formula is:
[5*(Vm/Vi) = Ri]
Vm = Measured Voltage
Vi = Volts per 5 mm (Scaling)
Ri = Range in mm
Example 2: To get comfortable with this equation use a known distance by using a ruler. Say the multimeter shows 292.98mV then you use the calculations as follows:
[5 * (292.98mV/4.883mV) = 300 mm]
Example 3: To work backward and verify your calculation is correct use the inverse formula:
[(Ri x Vi)/5 = Vm]
[(300 x 4.883)/5 = 292.98mV]
For more information regarding calculating range and distance measurement, you may check out the following articles:
- Distance Measurement via Using of Ultrasonic Sensor
- Using Ultrasonic and Infrared Sensors for Distance Measurement.
Monitoring Oil Tank Level with HRLV-MaxSonar®-EZ™ Ultrasonic Sensor
Additional Considerations
Please note that if you are using a sensor from another sensor line the voltage scaling may not match that of the HRLV‑MaxSonar sensors. To find the voltage scaling of your sensor reference the
product datasheet.
Analog Voltage scaling for our product lines can be seen in our
Using Analog Voltage (Pin 3) tutorial. This tutorial also includes examples for using the Analog Voltage output, as well as integrating with a 10‑bit Analog Digital Converter.
Please note the sensor resolution, while the HRLV-MaxSonar-EZ line offers a one-millimeter resolution on its digital outputs, the analog voltage resolution is five millimeters.
The HRLV-MaxSonar-EZ will, in general, range objects from 0 to 300 millimeters as 300 millimeters. Which corresponds to 292.98mV when powered at +5V DC.
The HRLV-MaxSonar-EZ provides the range for objects up to 5 meters away. The sensor will report the closest detectable reflection from an object as defined by the sensor beam pattern. You may view the beam pattern for the HRLV-MaxSonar-EZ
here.
HRLV-MaxSonar®-EZ™ Ultrasonic Sensor Line Recommendations
High Performance Ultrasonic Rangefinder – MB1003 HRLV-MaxSonar®-EZ0™. The HRLV‑MaxSonar‑EZ0 has the widest and most sensitive beam pattern of any unit from HRLV‑MaxSonar‑EZ sensor line. This makes the HRLV‑MaxSonar‑EZ0 an excellent choice for use where high sensitivity, wide beam, or people detection is desired. The HRLV‑MaxSonar‑EZ0 has the widest and most sensitive beam pattern in the HRLV‑MaxSonar‑EZ sensor line. An excellent low-cost choice for use where high sensitivity, wide beam, or people detection is desired. Price: $37.95
High Performance Ultrasonic Rangefinder – MB1013 HRLV-MaxSonar®-EZ1™. The HRLV‑MaxSonar‑EZ1 is a great choice for use where sensitivity is needed along with side object rejection. The HRLV‑MaxSonar‑EZ1 is a good, low-cost starting place for a customer not sure of which HRLV‑MaxSonar‑EZ sensor to use. The HRLV‑MaxSonar‑EZ1 is our an indoor ultrasonic high-resolution sensor. The HRLV‑MaxSonar‑EZ1 is a great choice for use where sensitivity is needed along with side object rejection. Price: $34.95
High Performance Ultrasonic Rangefinder – MB1023 HRLV-MaxSonar®-EZ2™. The HRLV-MaxSonar-EZ2 is a good compromise between sensitivity and side object rejection. The HRLV-MaxSonar-EZ2 is an excellent choice for applications that require slightly less side object detection and sensitivity than the MB1013 HRLV-MaxSonar-EZ1. Price: $34.95
Connect the HRLV-MaxSonar-EZ to a Microcontroller
1. It is recommended that you first connect the HRLV-MaxSonar-EZ to either an oscilloscope or a multimeter before you connect the HRLV-MaxSonar-EZ to a microcontroller for the first time.
2. Connect the microcontroller input pin to the desired HRLV-MaxSonar-EZ sensor output pin.
3. For the AN pin, the following code example is provided for reference: BasicX Code Example
Read the AN pin (Analog Voltage) with a Microcontroller
1. Ensure proper microcontroller voltage scaling.
2. Ensure proper voltage scaling of the HRLV-MaxSonar-EZ.
3. Use the proper formula for calculating the distance from the voltage that is read. Reference the ultrasonic sensor datasheet.
Please note: If you are using a microcontroller to read the AN output, there is a strong possibility that the microcontroller has internal voltage scaling.