Arduino Ultrasonic Sensor Options
Finding the right Arduino ultrasonic sensor for your application
Looking for an Arduino ultrasonic sensor for your latest project? I was looking for one myself, so I took the time to write down some specs and prices. I thought I’d share and save you the legwork.
If you’re wondering what an Arduino ultrasonic sensor would do for you, the answer is that it allows you to detect objects, determine the distance to that object, and then avoid or follow or move to that object – depending on your application. As the name implies, the sensors use sound waves above frequencies we can hear. The modules typically have two sensors on the board, one sends out a sound wave, and the other looks for the echo. Since the distance between the two sensors is known, it can use triangulation to determine the distance of the object an echo bounced off of. It’s the same technique used by dolphins, bats, and old Polaroid camera auto-focus mechanisms.
Arduino Ultrasonic Sensor Interfaces
There are a couple of different ways to interface to an Arduino ultrasonic sensor.
2-Pin Mode
The most common is the 2-pin mode. In this connection mode the Arduino (or other controller) sends a pulse to the module on one pin to trigger a new measurement. The module will then respond to the Arduino on another pin by sending a pulse back on another pin. The width (really the duration) of the response pulse indicates the distance. The wider the pulse is, the farther away the object is. The Arduino can time the width of the pulse and through simple division determine the distance of the object. The specific numbers vary from module to module, but are given in the product datasheets so you program accordingly.
1-Pin Mode
Another interface method is the 1-pin mode. In this configuration, the module trigger and response use the same pin. This saves a pin on your controller, which is handy if you’re using a low pin-count model. The Arduino sends the trigger, then waits a specified amount of time, then reads the same pin as an input to get the ultrasonic sensor’s response. The programming can be a little trickier, but if you’re short on open pins, this is helpful.
Your Choice of Modes
The Maxbotix LV-EZ[n] Ultrasonic sensors actually provide 3 outputs. They cost more, but have a lot of implementation options. There is an analog voltage output, so you can use an ADC input to read that. There is an RS-232 output, so you can use a serial port to connect to that. And of course they have the pulse width output, so if you’re trying to re-use code or just prefer that method, that’s a possibility.
By far the most prevalent Arduino ultrasonic sensors are the HC-SR04’s (pictured above). They are made by a number of manufacturers, so look at user ratings & reviews when you select one. Quality manufacturing makes can make a big difference. You’ll probably find the most examples of hardware and firmware out there for the HC-SR04’s, but using 2-pin mode on another sensor should work just the same for you.
Arduino Ultrasonic Sensor Comparison
Here is a summary of what I ended up with after searching around and sorting out the sketchy options. I hope this list saves you some time digging around. By the way, this table doesn’t scale well to mobile phones, so I created a PDF of just the table, which you can view here.
Mfg | Model | See on Amazon (new tab) | Appx. Price (USD) | Voltage (VDC) | Range Min (cm) | Range Max (m) | Interface Mode | Measuring Angle (Deg.) | Accuracy |
---|---|---|---|---|---|---|---|---|---|
Various | US-100 | link | $7.00 | 2.4 to 5.5 | 2 | 4.5 | 2-pin mode | < 15º | 0.3cm + 1% |
Various | SRF05 | link | $10 for a 5-pack, or $6/ea | 5 | 1 | 4 | 2-pin mode | 55 (models ranging from 15 to 72) | 3-4cm |
Maxbotix | LV-EZ1 | link | $25.00 | 2.5 to 5.5 | 0 | 6.45 | 3 outputs: Analog voltage, RS-232 data, and Pulse Width | Various available (LV-EZ0 through LV-EZ4 models) | 1in (2.54cm) |
Parallax | 28015 | link | $30.00 | 5 | 2 | 3 | 1-pin mode | 20 | |
Progressive Automations | LC-217 | link | $6.00 | 5 | 2 | 4 | | 15 | |
Various | HC-SR04 | link | $10 for a 5-pack | 5 | 2 | 4.5 | 2-pin mode | 15 | 0.3cm |
Happy range-finding!
Featured Image Credit: SCRU-FE: Simple C++ Robot with Ultra-sonic Sensor for Education: Arduino UNO Obstacle Avoidance Maze Programming by rtheiss, published on April 19, 2015 www.thingiverse.com/thing:780050