Ultrasonic Sensor Quick Start Guide – HRLV‑MaxSonar‑EZ

LV-MaxSonar-EZ Ultrasonic Sensor QuickStart GuideThis 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:

1. Power Supply
Power Supply Ultrasonic Sensors

2. Multimeter
Ultrasonic Sensor Multimeter

3. Connector Wires
Ultrasonic Sensor Connector Wires

4. HRLV‑MaxSonar‑EZ Ultrasonic Sensor
Ultrasonic Sensor Hrlv

5. Large flat target – such as a box
Box for Hrlv Ultrasonic Sensor Quick Guide


Determine the Power and Ground Inputs & Outputs


Usually Found On…
Power Source / Multimeter

“-” symbol
Black Wires (typically)

“+” symbol
Red Wires (typically)


Supply Power to the Ultrasonic Sensor

1. Disconnect the power supply from any equipment.
Power Supply Ultrasonic Sensors

2. Turn ON the power supply; set the voltage to 5.0V DC (Volts Direct Current).
Power Supply Ultrasonic Sensors

3. Turn the power supply OFF and connect ground and V+ cables to the power supply. (Volts Direct Current).
Power Supply Ultrasonic Sensors

4. Connect the ground from your power supply to the GND pin on the HRLV‑MaxSonar‑EZ.
Connect Power Supply to Ultrasonic Sensors

5. Connect your power supply to +5 pin on the HRLV‑MaxSonar‑EZ. (Volts Direct Current).
Connect Power Supply to Ultrasonic Sensors

6. Turn ON the power supply; verify that the voltage is between +2.5V and +5.5V. (Volts Direct Current).
Power Supply Ultrasonic Sensors

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.*


Multimeter Power Supply Ultrasonic Sensor


* You can also connect the ground lead of the multimeter to the GND pin of the HRLV ultrasonic sensor.
3. Connect the power lead of the multimeter to the pin labeled AN on the HRLV‑MaxSonar‑EZ. (To do this we used the orange clips to run from the AN pin to the multimeter probe).
Connect multi-meter to ultrasonic sensor

4. The display should read the voltage output of the HRLV‑MaxSonar‑EZ.



The Setup


Full Setup Ultrasonic Sensor 

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:


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


HRLV-MaxSonar®-EZ™ Ultrasonic Sensor Line Recommendations


Ultrasonic Sensor HRLV‑MaxSonar‑EZ0High 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

More on this sensor

Ultrasonic Sensor HRLV‑MaxSonar‑EZ1High 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

More on this sensor


Ultrasonic Sensor HRLV‑MaxSonar‑EZ2High 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

More on this sensor


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.


MaxBotix Inc.

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

These cookies are necessary for the website to function and cannot be switched off in our systems.

In order to use this website we use the following technically required cookies
  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec

For perfomance reasons we use Cloudflare as a CDN network. This saves a cookie "__cfduid" to apply security settings on a per-client basis. This cookie is strictly necessary for Cloudflare's security features and cannot be turned off.
  • __cfduid

Decline all Services
Accept all Services