17.07.2026

Distance sensor types explained: Ultrasonic, ToF, LiDAR and more

Distance sensor types explained: Ultrasonic, ToF, LiDAR and more

Table of contents

What is a distance sensor?
Table of contents
What is a distance sensor?

From simple obstacle-avoidance robots to industrial automation systems, distance sensors play an important role in helping devices understand the world around them.

The challenge is that there isn't a single type of distance sensor. Some use sound waves, others rely on infrared light, laser pulses, or advanced computer vision techniques. While all of them are designed to measure distance, each technology comes with different strengths, limitations, ranges, and accuracy levels.

Choosing the right sensor can make a significant difference to the success of your project. A sensor that works perfectly for a parking system may not be suitable for a drone, while a solution designed for industrial automation could be unnecessarily expensive for a simple hobby project.

In this guide, we'll cover the most common distance sensor types, including ultrasonic, infrared, time-of-flight (ToF), LiDAR, and vision-based sensors.

You'll learn how each technology works, where it performs best, and how to choose the right option for your next robotics, IoT, or embedded systems project.

What is a distance sensor?

A distance sensor is an electronic device that measures how far an object is from the sensor. It does this by emitting a signal, such as sound, infrared light, or a laser pulse, and calculating how long it takes for that signal to return after hitting an object.

The measured distance is then converted into an electrical signal that a microcontroller, computer, or automation system can process and use for decision-making.

Distance sensors are widely used in robotics, industrial automation, smart home devices, drones, parking assistance systems, and IoT projects. Whether it's a robot avoiding obstacles, a smart bin detecting when it's full, or a drone maintaining altitude, distance sensors help devices understand their surroundings and respond accordingly.

How do distance sensors work?

Although distance sensors use different technologies, they all follow the same basic principle: a signal is emitted toward an object, reflected back to the sensor, and then analyzed to determine how far away the object is.

The main difference between distance sensor types is the kind of signal they use. Some rely on sound waves, others use light, while more advanced systems use cameras and computer vision to estimate depth.

Sound-based sensing

Ultrasonic sensors measure distance using high-frequency sound waves. The sensor emits a sound pulse and calculates how long it takes for the echo to return after bouncing off an object. Because the speed of sound is known, the sensor can accurately determine the distance.

Light-based sensing

Many modern distance sensors use light instead of sound.

  • Infrared (IR) sensors measure reflected infrared light and are commonly used for short-range object detection.

  • Time-of-flight (ToF) sensors emit light pulses and calculate distance by measuring the time it takes for the light to return to the sensor.

  • LiDAR sensors use laser pulses to create highly accurate distance measurements and detailed maps of the surrounding environment.

Vision-based sensing

Vision-based systems use one or more cameras to estimate depth. By analyzing images from different angles or using specialized depth-sensing cameras, these systems can determine the distance to objects while also providing information about their shape and position.

Comparison of common distance sensor technologies

Sensor Type

Technology

Typical Range

Ultrasonic

Sound waves

Short to medium

Infrared

Reflected IR light

Short

ToF

Time-of-flight light pulses

Short to medium

LiDAR

Laser pulses

Medium to long

Stereo Camera

Computer vision

Variable

Best development boards for distance sensor projects

Once you've selected a distance sensor, you'll need a development board capable of processing the data and connecting it to the rest of your system. The right choice depends largely on the type of project you're building and whether you need wireless connectivity, real-time processing, or additional computing power.

For connected IoT and smart home projects

Many distance-sensing applications don't stop at measuring distance. They also need to send data to dashboards, automation platforms, or cloud services. This is particularly common in smart home systems, occupancy monitoring, environmental monitoring, and MQTT-based IoT projects where sensors continuously communicate with other devices on the network.

For these types of projects, an ESP32-based board is often the preferred choice because it combines sensor connectivity with built-in wireless communication.

NULA Mini ESP32-C6

NULA Mini ESP32-C6

€14,95
€14,95

For rapid prototyping and education

Educational projects often involve experimenting with different sensor technologies before deciding which one is best suited to the final design. A flexible development board makes it easier to test ultrasonic, infrared, and ToF sensors while learning the fundamentals of embedded development and sensor integration.

A board built around the RP2350 platform offers an excellent balance of performance, simplicity, and flexibility for prototyping and classroom projects.

NULA Max RP2350

NULA Max RP2350

€24,95
€24,95

Which distance sensor should you choose?

The best distance sensor depends on your project's requirements. Factors such as range, accuracy, environmental conditions, processing power, and budget all influence which technology is the right fit.

Choose an ultrasonic sensor if...

Ultrasonic sensors are an excellent choice for beginners and cost-sensitive projects. They work well for obstacle avoidance, parking assistance, water level monitoring, and general-purpose distance measurement where millimeter-level precision isn't required.

Consider an infrared sensor if...

Infrared sensors are ideal for short-range object detection and proximity sensing. They're commonly found in line-following robots, touchless switches, and simple automation projects where detecting the presence of an object is more important than measuring an exact distance.

Think about the ToF sensor if...

Time-of-flight sensors offer a strong balance between accuracy, speed, and ease of integration. They're well suited for robotics, gesture recognition, indoor navigation, and smart devices that require more precise measurements than ultrasonic sensors can typically provide.

Pick a LiDAR sensor if...

LiDAR is often the preferred choice for advanced robotics, mapping, autonomous navigation, and industrial applications. While typically more expensive, it provides exceptional accuracy and longer measurement ranges.

Why Soldered is a great platform for distance sensor projects

Choosing the right distance sensor is only part of building a successful project. Equally important is selecting the hardware that allows you to process, visualize, and act on the data those sensors generate.

Whether you're building a robot that avoids obstacles, a smart parking assistant, an occupancy monitoring system, or an industrial automation prototype, Soldered offers a range of development boards and maker-friendly hardware designed to help you move from idea to working prototype faster.

Distance sensors become even more useful when their measurements can be displayed in a clear and meaningful way. For example, sensor readings can be visualized on low-power e-paper displays, making them ideal for monitoring systems, room occupancy indicators, environmental dashboards, and other always-on applications where information needs to remain visible throughout the day.

One option that works particularly well for these types of projects is the:

Inkplate 6FLICK

Inkplate 6FLICK

€179,95
€179,95 - €209,95

Combined with Soldered's documentation, technical support, and ecosystem of development boards and displays, it's easy to build projects that not only measure distance accurately but also turn that data into something useful and actionable.

Distance sensor types: FAQs

What are the different types of distance sensors?

The most common distance sensor types are ultrasonic, infrared (IR), time-of-flight (ToF), LiDAR, and vision-based sensors. Each uses a different technology to measure the distance between a sensor and an object.

Which distance sensor is the most accurate?

LiDAR sensors are generally considered the most accurate for long-range measurements. For shorter-range applications, ToF sensors often provide excellent accuracy while remaining more affordable and easier to integrate.

What is the difference between an ultrasonic sensor and a ToF sensor?

An ultrasonic sensor measures distance using sound waves, while a ToF sensor uses light pulses. ToF sensors typically offer higher precision and faster response times, whereas ultrasonic sensors are often more affordable and beginner-friendly.

What is a LiDAR sensor used for?

LiDAR sensors are commonly used in robotics, autonomous navigation, drones, industrial automation, mapping, and obstacle detection applications where accurate distance measurements are required.

Are infrared sensors good for distance measurement?

Infrared sensors can be effective for short-range distance measurement and object detection. They are commonly used in line-following robots, proximity sensing systems, and simple automation projects.

Which distance sensor is best for robotics?

The best distance sensor for robotics depends on the application. Ultrasonic sensors are popular for basic obstacle avoidance, ToF sensors offer improved accuracy, and LiDAR sensors are often used in advanced navigation and mapping systems.

Can ESP32 boards be used with distance sensors?

Yes. ESP32 boards can interface with ultrasonic, infrared, ToF, and LiDAR sensors through GPIO, I2C, UART, and SPI connections, making them a popular choice for robotics and IoT projects.

What is the typical range of an ultrasonic sensor?

Most ultrasonic sensors can measure distances from a few centimeters up to several meters. The exact range depends on the sensor model and the characteristics of the target object.

What is a ToF sensor?

A time-of-flight (ToF) sensor measures distance by calculating how long it takes for a light pulse to travel to an object and back. This technology provides accurate distance measurements in a compact form factor.

Related Articles