Distance Sensing Overview


Distance and proximity sensing allow you to easily detect the whereabouts of objects without physical contact.

How do distance sensors work?

Distance sensors (or proximity sensors) generally work by outputting a signal of some kind, (eg laser, IR LED, ultrasonic waves) and then reading how it has changed on its return. That change may be in the intensity of the returned signal or the time it takes the signal to return. Some common terminology when talking about distance sensing include the following:

Resolution:

Resolution refers to the smallest change in distance that a sensor is able to detect. For example, an IR LED may have a resolution of about 5mm, while a VCSEL unit may have a resolution of about 1mm.

Update rate:

Usually measured in Hz, update rate comes into play with moving objects. the faster the refresh rate, the more reading per second the sensor will receive, important information if your sensor is traveling towards a fixed object at a high rate of speed.

Range:

Range is a distance, from minimum to maximum, that a sensor is capable of returning accurate readings.

How do interface options play a role?

Many things factor into deciding what interface option is best for a distance sensor project. The first is usually what type of sensor does your project require. Can you use an Ultrasonic Range Finder, or will you need to measure distances of over 20 meters? This may make the interface decision for you. However, if you do find yourself with multiple options, one of the main things to consider will be how many sensors you need vs. how many available pins you have. I2C will use two pins on your board, even if you're using multiple sensors (with different addresses), whereas SPI sensors will each need their own pin. Other considerations will include things like power consumption, speed, length of wire from board to sensor, and whether or not received data verification is necessary.

Distance Sensing Technologies

There are many unique options to choose from when you want to incorporate a distance/proximity sensor into your project. We focus primarily on four varieties of distance sensors: affordable and easy LEDs; crowd-favorite LIDAR; multi-use, multi-purpose ultrasonic; and the compact yet high-resolution VCSEL. Each option has its pros and cons, and we have guides, projects and tools to make sure you know which is right for you!

LED

Benefits

Inexpensive, small footprint, decent update rate, multiple interface options

Drawbacks

Current consumption a bit high, maximum range fairly low

LIDAR

Benefits

Excellent max range, very fast update rate

Drawbacks

High current draw, expensive, large footprint

Ultrasonic

Benefits

Very low current draw, multiple interface options

Drawbacks

Low resolution, slow refresh rate

VCSEL

Benefits

Super small minimum range, wide input voltage range, very fine resolution, inexpensive

Drawbacks

Very low maximum range, I2C interface only

Getting Started


If you need to find distance or proximity for a project, experiment or device, but don’t know where to start, we have two helpful resources: a visual example of how LED, LIDAR, ultrasonic and VCSEL sensors work, and an in-depth comparison guide so you can choose the best one for your needs!

Our Creative Technologist Rob takes us through the different types of distance sensors.

See our Distance Sensor Comparison Guide


Distance Sensing Resources


Once you’ve mastered the basics, you may find you need additional help with one method, decide you want a board or module with a higher skill level, or need to tackle some advanced concepts. Here’s where you can find out more!


Products


From short range ultrasonic to long range LIDAR, SparkFun carries over 35 different distance sensors to suite any projects you might have in mind. Below is a list of just a few of our favorites.

SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X (Qwiic)

SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X (Qwiic)

SEN-14722
$23.50
10
LIDAR-Lite v3

LIDAR-Lite v3

SEN-14032
$129.99
28
SparkFun Qwiic ToF Imager - VL53L5CX

SparkFun Qwiic ToF Imager - VL53L5CX

SEN-18642
$24.95
2
SparkFun Proximity Sensor Breakout - 20cm, VCNL4040 (Qwiic)

SparkFun Proximity Sensor Breakout - 20cm, VCNL4040 (Qwiic)

SEN-15177
$7.50
1
SparkFun ToF Range Finder Sensor - VL6180

SparkFun ToF Range Finder Sensor - VL6180

SEN-12785
$29.50
11

SparkFun Qwiic Ultrasonic Distance Sensor - HC-SR04

SEN-17777
1 Retired
SparkFun RGB and Gesture Sensor - APDS-9960

SparkFun RGB and Gesture Sensor - APDS-9960

SEN-12787
$16.50 $3.99
9
ZX Distance and Gesture Sensor

ZX Distance and Gesture Sensor

SEN-13162
$28.50
3

See all Distance Sensors


Projects


Over the years we’ve built plenty of fun projects using distance and proximity sensors with various sizes, capabilities and purposes. Use this catalog of ideas to build your own version or inspire an original idea!

Tutorials

Hackers in Residence - The ElectricBone

June 25, 2014

Drum machines and keyboards have been the standard for making digital music, but how do you make electronic music if you're trained to play the trombone? One of our Hackers in Residence, Carlos Mello, took it upon himself to find a solution to that very question.

GPS Differential Vector Pointer

May 31, 2016

Use GPS to have two objects, a base and a target, point towards one another. This can be used to aim a directional antenna (or in the case of this project, a laser) from one object to the other object at a distance that is only limited by your ability to provide the base station with the target's GPS location.

Building an Autonomous Vehicle: The Batmobile

December 6, 2016

Documenting a six-month project to race autonomous Power Wheels at the SparkFun Autonomous Vehicle Competition (AVC) in 2016.

Blog Posts