Ultrasonic Range Finder - HRLV-MaxSonar-EZ4

These easy-to-use ultrasonic rangefinders from Maxbotix work the same way as the EZ line that you know and love, but this new high-resolution series features 1 millimeter resolution! As with the rest of the Maxbotix range finders, these sensors feature Analog Voltage, RS232 Serial, and Pulse Width outputs making them easy to interface with any microcontroller. These sensors have a maximum range of 5000 mm (195 inches) with virtually no dead zone (although objects closer than 30 cm will typically range as 30 cm).

We’re offering the EZ0, EZ1, and EZ4 with progressively narrower beam angles allowing the sensor to match the application. Please see beam width explanation below.

Control up to 10 sensors with only two pins! Checkout the Maxbotix FAQ listed below.

  • 42kHz Ultrasonic sensor
  • Operates from 2.5-5.5V
  • Low 3.1mA average current requirement
  • 10Hz reading rate
  • Analog Voltage, RS232 or TTL Serial, and Pulse Width
  • Small, light weight module

Ultrasonic Range Finder - HRLV-MaxSonar-EZ4 Product Help and Resources


"RS232" Output or Inverted TTL

If the ultrasonic range finder indicates that it has an “RS232 Serial Output” and is outputting an inverting signal with the voltage level based on Vcc, you could just use an inverting circuit using a transistor to invert the signal. This is not a standard RS232 that uses +/-12V. There are a few methods of flipping this signal through hardware or software. The resources and going further will provide specific examples.

Inverting Signal w/ Hardware

Doing a quick test using a retired NPN transistor from our storefront, I was able to get it working based on the circuit using a RedBoard Programmed with Arduino. I was using an Arduino so Vcc in my circuit was 5V. Since it’s basically two diodes within the transistor, you will want to use resistors to limit the current. I just used two 330Ohm resistors just like I was turning on an LED. You probably do not need to do this but the values might need to be adjusted when using it at higher speeds or if the transistor is not fully turning ON/OFF. Testing with a multimeter, it worked as expected. An input of 5V would result in 0V (logic LOW) on the output since the transistor was turning on. With an input of 0V, the transistor would not be conducting so the output would be held HIGH at 5V. Using an Arduino serial passthrough for further testing, I was able to view the ultrasonic sensor’s output data without any problems.

“RS232” Output and Inverting w/ Software

Otherwise, you could be clever in writing your code to store the value and possibly apply some sort of logical NOT operation. In Arduino, there is a special feature using software serial that inverts the signal by setting a parameter to true [ “Software Serial Constructor” – https://www.arduino.cc/en/Reference/SoftwareSerialConstructor ]. There was someone in the Arduino forums that provided example code to invert the output, parse the data, and output it through the serial monitor here => [ User “Goldthing” - http://forum.arduino.cc/index.php?topic=114808.msg864009#msg864009 ].

Connecting Ultrasonic Sensor to Raspberry Pi

There is a tutorial from MaxBotix that shows you how to connect ultrasonic sensors to Raspberry Pis => [ http://www.maxbotix.com/Raspberry-Pi-with-Ultrasonic-Sensors-144/ ]. Certain ultrasonic sensors listed in the article require an inverter. If the ultrasonic range finder’s output serial output is “ RS232 ” like the sensors listed under “Ultrasonic Sensors that Require an Inverter” , this indicates that the signal is basically an inverted output with the voltage level based on Vcc.

Therefore, you would need to follow the tutorial and use a serial inverter in order to use it with the Raspberry Pi. If you are using a Raspberry Pi a transistor, Vcc should be 3.3V since the Pi uses a 3.3V system.


Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

1 Soldering

Skill Level: Noob - Some basic soldering is required, but it is limited to a just a few pins, basic through-hole soldering, and couple (if any) polarized components. A basic soldering iron is all you should need.
See all skill levels


Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

2 Programming

Skill Level: Rookie - You will need a better fundamental understand of what code is, and how it works. You will be using beginner-level software and development tools like Arduino. You will be dealing directly with code, but numerous examples and libraries are available. Sensors or shields will communicate with serial or TTL.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

3 Electrical Prototyping

Skill Level: Competent - You will be required to reference a datasheet or schematic to know how to use a component. Your knowledge of a datasheet will only require basic features like power requirements, pinouts, or communications type. Also, you may need a power supply that?s greater than 12V or more than 1A worth of current.
See all skill levels


Customer Comments

  • Jim, I enjoyed the Ultrasonic Sensors video and the seeing the sample project.
    You mentioned that you sell the ultrasonic transducers by themselves but I can’t find them on the spark fun site. Should I search for something other than “ultrasonic”? Thanks

  • I have a project where I need to measure the foam level in a tube ~ 6 cm wide. 1. Would this sensor be able to detect the foam surface, or would it only sense the liquid surface? What if i float a pingpong ball on top of the foam? 2. Would the sides of the tube interfere? I’d be working pretty much in the minimum range i think. Any other product that woud be better for this application? Thanks, Svend.

  • I’ve been wanting to put one of these in a 3.75" tube to measure the level of a cistern… but I get readings from the side of the tube (it’s about 2 yards long before you get to the actual tank). Even though the beam looks like it can handle that but I’m not sure if I’m missing anything….?

    Also, I’m going to try this if no one has experience, but would putting the sensor in water kill it? (just the black round sensor part… not the breadboard part). It wouldn’t be completely underwater, more just splashed while they’re filling the cistern.

  • Member #101637

    Hello, this is Scott from MaxBotix Inc. I’m glad to support you. All MaxBotix Inc., employees are legally required to clarify their name and affiliation with MaxBotix Inc., in forum posts.

    To answer the post…

    From the datasheet: Filtered Operation - Free-Run The HRLV-MaxSonar-EZ uses an internal 2Hz bandwidth filter to process range data; which reports the latest range every 100mS or 10Hz. This improves the sensor’s performance for accuracy, noise rejection, and reading to reading stability. The filtering in the free-run operation also permits additional acoustic and electrical noise tolerance

    You should use triggered operation (Pin 4) to receive the fastest update rate. This will remove some of the advanced filtering so the 1mm resolution may not be as accurate or stable.

    Best regards,

    Scott Wielenberg Technical Support & Sales of MaxBotix Inc. Phone: (218) 454-0766 Fax: (218) 454-0768 Email: scott@maxbotix.com Web: www.maxbotix.com Follow us on Facebook at: http://www.facebook.com/pages/MaxBotix-Inc/125159384204938

    Technical support and sales are subject to the terms and conditions listed on our website at http://www.maxbotix.com/ MaxBotix, MaxSonar,EZ0, EZ1, EZ2, EZ3, EZ4, AE0, AE1, AE2, AE3, AE4, WR1, WRA1, and WRLA1 are trademarks of MaxBotix Inc.

  • Do these things have a substantial lag in response time? I just purchase one of these and I jave a delay of between 0.5 and 1 second! I used the older Maxbotix sonars in the past with almost no lag time. Did I get a lemon?

    • Hi,There should not be a significant lag time. I was going to suggest that you contact us at TechSupport@sparkfun.com however, it appears that we already have a message from you. We will be happy to help you determine if this is a problem product, or if possibly something can be corrected in your setup that may correct this issue. Thanks, Tim

  • Well somehow I blew mine up, soooo…….

  • While the range measurement feature will not work for less than ~30cm as stated, the sensor will still detect down to ~1mm, as explained in the datasheet. If you just need to know if something is right in front of you, you can get down to 1mm, but you won’t know exactly how far it is (just less than 30cm).

  • with virtually no dead zone (although objects closer than 30 cm will typically range as 30 cm).

    That is the definition of a dead zone.

    • Hmm, somewhat subjective… It’s definitely an innacurate reading, but the object is still detected by the sensor. However, to me a “dead zone” would mean a region where the sensor doesn’t detect an object at all (much like a cellular dead zone is a place a phone can’t get a reliable signal).

      • I am thinking of it as a “KEEP OUT” zone. Try to design your system to either physically or logically not consider data from within that zone.

Customer Reviews

5 out of 5

Based on 3 ratings:

Currently viewing all customer reviews.

Great product.

Son used this range finder to build his Sr. project for high school. Very interesting project to help new trombone players learn slide positions. It was accurate and did the job very well.

Works Fine!

pulse width is 10us/cm

Excellent addtion to my PX4FLOW camera

PX4FLOW camera’s for optical flow sensors can have this ultrasonic sensor attached to them for close in accurate detection of distance to objects (used in drones for flight sensor). However if you buy a PX4FLOW camera with this ultrasonic range finder integrated into it the cost jumps from around $60 to over $100.

I only saved a bit over $10 but learned a lot about these pixhawk compatible sensors and gained accuracy for auto-landing.