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!

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

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

void setup()
{
  // initialize serial communications
  Serial.begin(9600); 
}

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
  Serial.print(inches,DEC);
  
  // print out a graphic representation of the result
  Serial.print(" ");
  for (x=0;x<(inches/5);x++)
  {
    Serial.print(".");
  }
  Serial.println("|");

  // pause before taking the next reading
  delay(100);                     
}

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 0 comments