FIRST Robotics 2025

MaxBotix has been a proud sponsor of FIRST teams since 2012 and once again we are supporting your work in the field of robotics by giving each team a voucher for a free MB1043 MaxSonar Sensor from our HRLV-MaxSonar-EZ line. This small and lightweight sensor is designed for easy integration into your project and is a great option for autonomous robot navigation.
This page should contain everything you need to get your sensor up and running with your robot. Should you have any questions, you can email us at techsupport@maxbotix.com or call us at 218.454.7363
Take a look at our data sheet for more information on your sensor's specs!

Datasheet
How Ultrasonic Sensors Work

All of our ultrasonic rangefinders will measure distance by tracking the time-of-flight of a sound wave. The diagram below shows how the sensor sends and receives the sound waves. Once the sensor emits a sound wave, it tracks how long it takes for the sound to reflect off of a surface and travel back to the sensor. The sensor then uses the known speed-of-sound to turn the time-of-flight into a range reading.


Using Your Ultrasonic Sensor with your NI roboRIO

Using the MaxBotix sensor is a simple process.
1. Decide if you are going to use one sensor or more than one sensor.
2. Connect the sensor(s) to the NI roboRIO using the wiring instructions provided.
3. Program the roboRIO with the code to read the sensor.
4. Now use range values from your sensor in the guidance of your robot.

Sensor Wiring

Our sensors can easily be connected and powered by the analog inputs on your NI roboRIO. If you use multiple sensors, you will have to connect the trigger pin of the sensor to a digital output on the NI roboRIO. It is recommended to do multitasking such as creating a new thread to trigger the sensor while your main robot code is still running.
In our examples, the Analog Output (Pin 3) is the pin where you read the range value reported from the sensor.
The sensor pinout is shown below. The square pad with a hole is Pin 1. If you are using more than one sensor, you will also connect Pin 4 of the sensor to DIO.


Connect these pins to an Analog Input port on your RoboRIO. Our example uses Analog Port 0. That's all we need to do to connect our Sensor to the RoboRIO.

> Sensor Pin 3 connected to S
> Sensor Pin 6 connected to 5V
> Sensor Pin 7 connected to ⏚

Single or Multiple Sensor Analog Voltage Example
Programming for use with a single sensor

Our sensors communicate with your RoboRIO using one of three methods:

  • Analog Voltage Output (Pin 3) (example shown above)
  • Pulse Width Output (Pin 2)
  • 5 Volt RS-232 Serial Output (Pin 5)

In this example, we will use the Analog Voltage output for simplicity.
When power is applied to Pins 6 and 7 of our sensor, the voltage on pin 3 will change according to the distance between the sensor and the object in front of it. The sensor will report a voltage on pin 3 which represents the distance.
Use the RoboRIO to measure the voltage on Pin 3. This can be done using the WPILib Analog Input Library. First, let's import the library:

Next, let's create an instance of the Analog Input class and specify that it should use Analog Pin 0: