Ultrasonic Range Finder EZ1 Retail

Congratulations on your purchase of a Maxbotix LV-EZ1 ultrasonic rangefinder. This unique sensor uses sound pulses to detect the range of nearby objects, opening all kinds of possibilities for your project.

How does it work?

Like a bat, the EZ1 sends out pulses of ultrasonic sound (at a frequency of 41KHz, higher than humans can hear), and listens for the reflection of the sound off nearby objects. By recording the time between the initial pulse and when the reflection is heard, the distance to the object can be determined. Sound travels at about 1126 feet per second (or 343 meters per second), so for an object 10 feet away from the sensor, the round-trip time would be 20 feet / 1126 feet per second = 0.0178 seconds or 17.8ms. The EZ1 does some clever signal processing to filter out false data to give the best possible range estimate.

What are the limitations?

Because the EZ1 uses sound to sense nearby objects, it is subject to real-world acoustics and may not work well in every situation, such as extremely noisy environments. It works best for detecting large, solid objects such as walls that provide a strong reflection. Small objects may not reflect enough sound for the sensor to pick up, and soft objects may absorb the sound rather than reflecting it back to the sensor. Oblique surfaces may cause glancing bounces to objects further away, giving erroneous readings. The Maxbotix FAQ has information on obtaining the best readings from the device.

The EZ1 has a range of 6" to 254" (6.45 meters) with 1" resolution.  Objects closer than 6" will be reported as 6" away (but beware of glancing bounces to further objects). If no object is detected within the sensor's range, the output will stay at the maximum range.

Be aware that the sound pulse spreads out as it leaves the sensor, so it's more like a flashlight than a laser beam. See the documentation for diagrams on beamwidth and the sizes of objects that can be sensed reliably. Other ultrasonic sensors in the same area may interfere with each other; see the Maxbotix website for ideas on how to coordinate multiple sensors.

How do I use it?

The EZ1 requires a power supply from 2.5V to 5.5V. The current requirement is only 3mA., which is easily supplied by an Arduino or other microcontroller with a built-in voltage regulator. Although the sensor will work at 3.3V, a 5V supply will provide the best output power for long-range operation.

The EZ1 has a header area with seven holes. You can solder a header to this area, or solder wires directly to the device. The signals are labeled in the copper on the back side of the board. A full description of the signals is available in the datasheet.

The EZ1 can provide range data in a number of different ways, which makes it easy to interface to almost any project. The available outputs are serial (see the datasheet for format), analog, and pulse-width modulation (PWM). The simplest interface is the analog output, which generates a voltage that is proportional to the distance to the object. The voltage output will be half of the positive supply voltage (VCC) at maximum EZ1 range (254 inches). If you're using an Arduino, an ADC value of 512 will equal full range (254 inches) on the sensor.

To connect the EZ1 to a microcontroller, you only need three connections: +5V, GND, and AN (analog out). If you're using an Arduino, connect the +5V and GND to the respective pins on the Arduino, and connect AN to an analog input (0, for example). The following sketch will read the sensor and print the range in inches. Note that the output may show inaccuracies based on the above limitations (object size, shape and material, ambient noise, etc.).

    // Maxbotix EZ1 test program
// Mike Grusin, SFE, 2011
// This program is free, use it however you wish!

// Make the following connections between the EZ1 and the Arduino
// +5V - +5V
// GND - GND
// AN - Analog In 0

// Upload this sketch to your Arduino, then activate the Serial Monitor
// (set the Serial Monitor to 9600 baud)

void setup()
  // initialize serial communications

void loop()
  int sensor, inches, x;
  // read the analog output of the EZ1 from analog input 0
  sensor = analogRead(0);
  // convert the sensor reading to inches
  inches = sensor / 2;
  // print out the decimal result
  // print out a graphic representation of the result
  Serial.print(" ");
  for (x=0;x<(inches/5);x++)

  // pause before taking the next reading

Tips and tricks

  • There are many ways to interface to and control the EZ1.  For example, you can use one of the pins as an input to control exactly when the EZ1 will take a range reading, which is useful for saving power or synchronizing multiple sensors. See the documentation for more information.
  • The Maxbotix website has lots of information on getting the best results out of the sensor.

Have fun!

We hope this sensor is a valuable addition to your projects. If you have any questions or problems (or want to show us your project!) you can always contact us at techsupport@sparkfun.com.

Comments 1 comment

  • -------------------- Tech Support Tips/Troubleshooting/Common Issues --------------------

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

    Resources and Going Further