When it comes to distance sensors, there are many different types; ultrasonic, IR proximity, laser distance, etc. and selecting the right one for your next Arduino or Raspberry Pi project could be a tough task to handle. Hence, today we’ll be looking at the plethora of distance sensors, its types, and helping you get a better idea of which one is best suited for you!
I’ll be covering the following:
- What are distance sensors and how do distance sensor work?
- Types of distance sensors
- Distance sensor compared: How to choose a distance sensor?
What are Distance Sensors?
As their name suggests, distance sensors are used for determining the distance of an object from another object or obstacle without any physical contact involved (unlike a measuring tape, for example).
How do Distance Sensors Work?
Commonly associated with ultrasonic sensors, it functions by outputting a signal (depending on technology; ultrasonic waves, IR, LED, etc.) and measuring a change when the signal returns.
The change measured can be in the form of either:
- time it takes for a signal to return,
- intensity of a returned signal,
- or phase change of the returned signal.
Distance Sensors vs Proximity Sensors
As distance sensors can be commonly associated with proximity sensors due to seemingly similar functions, the operation of either sensor type can be easily misunderstood. To clear this up, here’s a quick comparison between them to help you understand their differences.
- Proximity sensors sense if an object is within the sensing area where the sensor is designed to operate. Hence, it does not necessarily indicate the distance between the sensor and object of interest. Find out more about proximity sensors here!
- Distance sensors sense distance from the object and the measuring device through an output current. These currents are generated as a result of several waveforms, such as ultrasonic waves, laser, IR, etc.
Types of Distance Sensors
Now that we have an understanding of what distance sensors are, we’ll dive into the various distance measurement sensors on the market, each with its own sensing technologies. Here’s the rundown of the different distance sensor types!
What is an Ultrasonic Distance Sensor?
The Ultrasonic Sensor is arguably the most common distance measuring sensor, also known as the Sonar sensor. It detects the distance to objects by emitting high-frequency sound waves.
Ultrasonic Sensor: Working Principle
- The ultrasonic sensor emits high-frequency sound waves towards the target object, and a timer is started
- Target object reflects the sound waves back towards the sensor
- The receiver picks up the reflected wave and stops the timer
- The time taken for the wave’s return is calculated against the speed of sound to determine the distance travelled
Ultrasonic Sensor: Key Applications
Now that we’ve understood how it works, we’ll take a look at some of the common ultrasonic distance sensor applications:
- Distance Measurement
- Robotic Sensors
- Smart cars – Yes, Tesla uses ultrasonic sensors as part of its Autopilot program!
- Unmanned Aerial Vehicles (UAV) / Drones
Advantages of Ultrasonic Sensors
- Not affected by object colour and transparency as it detects distance through sound waves
- Works well in places that are dim
- Tend to consume lower current/power
- Multiple interface options for pairing with a microcontroller, etc.
Disadvantages of Ultrasonic Sensors
- Limited detection range
- Low resolution and slow refresh rate, making it not suitable for detection of fast-moving targets
- Unable to measure the distance of objects that have extreme textures/surfaces
Recommended Ultrasonic Sensor
Grove – Ultrasonic Sensor: Improved version of the HC-SR04
For an ultrasonic sensor to be parable with an Arduino, you’ll need an ultrasonic sensor module. The Grove – Ultrasonic Sensor is my recommended pick that’s built with significant benefits over the popular HC-SR04!
Wonder why it’s a better option than the HC-SR04? Here’s a comparative table!
|Sensor||Grove – Ultrasonic Distance Sensor||HC-SR04|
|Working Voltage||3.3V / 5V compatible
Wide voltage level: 3.2V – 5.2V
|Measurement Range||3cm – 350cm||2cm – 400cm|
|I/O Pins needed||3||4|
|Dimensions||50mm x 25mm x 16mm||45mm x 20mm x 15mm|
|Ease of pairing with Raspberry Pi||Easy, direct connection||Voltage Conversion Circuit Required|
From the table, we can observe that the Grove – Ultrasonic sensor is a more versatile option:
- Supports a wider voltage level
- Lesser I/O pins needed
- Easier pairing with your Raspberry Pi
Interested to find out more? You can check out the following resources:
Infrared Distance Sensors
Second on this list is IR distance sensors, short for infrared. Most commonly associated with the Sharp GP2Y0A21YK0F, it does distance or proximity sensing through emitting IR wave and calculating the angle of reflection.
IR sensors come with two lenses:
- An IR LED emitter lens that emits a light beam
- A position-sensible photodetector (PSD) where the reflected beam will fall onto
IR Distance Sensors: Working Principle
IR distance sensors work through the principle of triangulation; measuring distance based on the angle of the reflected beam.
Here’s an illustration of how IR distance sensors work through triangulation:
- Infrared light is emitted from the IR LED emitter
- The beam of light hits the object (P1) and is reflected off a certain angle
- The reflected light will reach the PSD (U1)
- The sensor in the PSD will then determine the position/distance of the reflective object
Key Applications for IR Sensors
- TVs, computers, laptops
- Distance measurement
- Security systems such as surveillance, burglar alarms, etc.
- Monitoring and control applications
Advantages of IR Sensors
- Small form factor; Common IR sensors like the ones from Sharp tend to be smaller in size
- Applicable for daytime and nighttime usages
- Secured communication through a line of sight
- Able to measure the distance of objects that have complex surfaces unlike ultrasonic sensors
Disadvantages of IR sensors
- Limited measurement range
- Affected by environmental conditions and hard objects
Recommended IR Sensors
Based on the SHARP GP2Y0A21YK0F, this IR proximity sensor is a popular recommendation for easy Arduino distance sensing. Packed in a small form factor with low power consumption, it allows for continuous distance reading with a range of 10cm to 80cm!
Interested in finding out more? You can check out the following resources:
IR vs Ultrasonic
Now that we’ve understood both IR and Ultrasonic sensors, you may be wondering what’s the difference between them. Here’s a quick comparative table that showcases the differences:
|Type||IR Sensor||Ultrasonic Sensor|
|What It Does||Measure distance through reflected light waves||Measure distance through reflected sound waves|
|How It Measures||Triangulation: Angle of a reflected IR beam is measured||Time taken between transmitting and receiving sound waves are recorded|
|Human Interactions||Invisible to the naked eye||Unhearable|
|Object Requirements||Suitable to be used to measure complex objects||Not suitable to measure objects with complex surfaces|
Laser Distance Sensors: LIDAR
LiDAR, in short for Light Detection and Ranging, can be considered as a laser distance sensor. It measures the range of targets through light waves from a laser instead of radio or sound waves.
LIDAR: Working Principle
There are various ways that you could explain how LIDAR works (E.g. Triangulation, pulse base, etc.) but the following way is the simplest:
- The transmitter on the LiDAR device emits laser light at the target object
- The pulse of the laser is reflected by the target object
- Distance is then calculated by using the relationship between constant speed of light in air and the time between sending/receiving of the signal
Key Applications of LiDAR
- Environmental Monitoring; forestry, land mapping, etc.
- Distance Measurement
- Machine Control and Safety
- Robotics Imaging & Environmental Detection
Advantages of LiDAR
- High measurement range and accuracy
- Ability to measure 3D structures
- Fast update rate; suitable for fast-moving objects
- Small wavelengths as compared to sonar and radar; good at detecting small objects
- Applicable for usage in the day and night
Disadvantages of LiDAR
- Higher cost as compared to ultrasonic and IR
- Harmful to the naked eye; higher-end LiDAR devices may utilize stronger LiDAR pulses which may affect the human eye
Recommended LiDAR Sensors
LIDAR Sensors tend to be expensive, but fear not! Here at Seeed we offer a mini LiDAR proximity sensor that’s very much affordable and easily parable with your Arduino!
Interested to find out more about it? You can head to our product page!
LED Time-Of-Flight Distance Sensors
Lastly, we’ll take a look at the LED time-of-flight sensors. Most commonly associated with the VL53L0X, it’s part of the broader spectrum of LIDAR, that uses time-of-flight technology in measuring distances.
Time-of-Flight Sensors: Working Principle
Time-of-Flight sensors measure the elapsed time from the emission of a wave pulse from the sensor to the moment it returns to the sensor after reflecting off an object. It’s capable of producing a 3D X, Y, Z image with a single snapshot by measuring the time it takes for light to travel from emitter to the receiver.
With time-of-flight technology, it provides significant benefits over the other distance sensing methods that we’ve covered:
- Wider range
- Faster readings
- Greater accuracy
Time-of-flight sensors work similarly to LiDAR sensors, where:
- The transmitter on the time-of-flight device emits IR waves towards the target object
- The wave is reflected back upon reaching the target object
- Distance is then calculated by using the speed of light in air and the time between sending/receiving of the signal
Key Applications of Time-of-Flight Sensors
- Industrial applications
- Machine vision
- People counting
Advantages of Time-of-Flight Sensors
- Such technology offers high measurement range with accuracy
- 3D imaging capable
- Used in a wide variety of applications due to its ability to identify large objects
Disadvantages of Time-of-Flight Sensors
- Higher costs in general
- Z-depth resolution is still poor with general systems offering a 1cm Z-resolution
Recommended Time-of-Flight Sensor
Living up to its popularity, the VL53L0X integrates a leading-edge SPAD array and embeds ST’s second generation FlightSense patented technology. This allows for up to 2m when measuring absolute distances!
The above recommendation is part of our Grove system as well, making easy pairing with your Arduino!
Interested to know more about it? You can check out the following resources:
Comparing the Distance Sensors
In order to help you select a suitable distance sensor, I’ve listed a summarised table below with what you should take note of when making your selection. However, since they each have their pros and cons, you’ll have to first identify your intended purpose/application!
|Suitablility for Long Range Sensing||No||No||Yes||Yes|
|High reading frequency||No||No||Yes||Yes|
|Suitability to use for complex objects||No||Yes||Yes||Yes|
|Sensitive to external conditions||Yes||No||No||No|
|3D imaging compatible||No||No||Yes||Yes|
From the table, we can conclude that both ultrasonic and IR distance sensors are more suited for Arduino projects that require shorter range sensing. While LiDAR and Time-of-flight sensors would be recommended for those that are looking for higher sensing capabilities and 3D imaging!
That’s all for today’s distance sensor guide. I hope it has helped you further understand and make a better purchase decision! For Arduino compatibility, you can consider each of the recommended Seeed products to save time with hardware and prototyping!
- Ultrasonic sensor recommendation: Grove – Ultrasonic Sensor
- IR sensor recommendation: Grove – 80cm Infrared Proximity Sensor
- Laser distance sensor recommendation: Grove – TF Mini LiDAR
- Time-of-flight sensor recommendation: Grove – Time of Flight Distance Sensor (VL53L0X)
For more on proximity sensors, you can check out my previous article here!