Controlling A MaxSonar Sensor

ultrasonic sensor

Triggering and Free Running

All the MaxSonar sensors, by default, will operate in a free run mode. What this means is the sensor will continue to range until power is removed from the sensor. This is generally the easiest way to operate in a single sensor setup. If you are operating multiple sensors, please visit our MaxSonar Chaining Guides at this link.

With that being said, all of the MaxSonar sensors have the capability to operate with a trigger. What this means is the sensor can be connected to a microcontroller, a computer, or anything else that you want that is capable of telling the sensor to start a ranging cycle.

To do this, you will want to connect the device triggering the sensor to pin 4 of the sensor.  When Pin 4 is left open the sensor will range at the refresh rate of the sensor mentioned in the sensor’s datasheet.

To trigger the sensor to range when programmed or needed, connect Pin 4 to a logic low. As stated above this can be done with a microcontroller, a 555 timer, a computer, or anything else capable of pulling Pin 4 to a logic low (ground). When you want the sensor to range, pull Pin 4 high. This will allow the sensor to complete a ranging cycle.

The device that is programmed to trigger the sensor needs to be programmed to pull Pin 4 to logic high for a minimum of 20uS. If the trigger does not pull pin 4 high for that amount of time, the sensor may not range when commanded to. For the LV‑MaxSonar‑EZ series of sensors the sensor can be triggered as frequently as 50mS (20 Hz rate), and for the XL-MaxSonar or HRLV-MaxSonar sensors, the sensor can be triggered as often as every 100mS (10 Hz rate).

Triggering a single sensor setup can be useful in many situations. For people that are using the sensor in a battery operated environment, the sensor can be triggered only when instructed to. This means the sensors highest current draw is controlled. All sensors have the highest current draw when the sensor sends out the ultrasonic pulse for each reading.  For the current draw of your sensor, please consult your datasheet.

Triggered operation prevents cross-talk between sensors. When using multiple sensors it is recommended to use chaining method. To read about Multiple Sensor Operation click here.


Products Related to the Article

MB1040 LV-MaxSonar-EZ4

MB1040 LV-MaxSonar-EZ4

The HRLV‑MaxSonar‑EZ1 is a great choice for use where sensitivity is needed along with side object rejection….

Buy Now

MB7060 XL-MaxSonar-WR1

MB7060 XL-MaxSonar-WR1

The XL-MaxSonar-WR is our most popular weather resistant sensor designed for outdoor detection and ranging….

Buy Now

MB7380 HRXL-MaxSonar-WRT

MB7360 HRXL-MaxSonar-WR

The weather resistant HRXL-MaxSonar-WRT is a rugged, ultrasonic sensor component module…

Buy Now


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