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!
Use the following graphic to quickly compare how different distance sensing technologies measure up.
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.
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.
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
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.
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.
Documenting a six-month project to race autonomous Power Wheels at the SparkFun Autonomous Vehicle Competition (AVC) in 2016.