Distance and proximity sensing allow you to easily detect the whereabouts of objects without physical contact.
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 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.
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 is a distance, from minimum to maximum, that a sensor is capable of returning accurate readings.
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.
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!
Inexpensive, small footprint, decent update rate, multiple interface options
Current consumption a bit high, maximum range fairly low
Excellent max range, very fast update rate
High current draw, expensive, large footprint
Very low current draw, multiple interface options
Low resolution, slow refresh rate
Super small minimum range, wide input voltage range, very fine resolution, inexpensive
Very low maximum range, I2C interface only
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.
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!
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.
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!