Effective Ways To Measure Distance In Maker Projects

Updated 04 November 2025

In this guide, we’re going to explore some of the most effective ways to measure distance in maker projects. Whether you’re working on a robotics project, an automatic door, or just trying to figure out how far away the fridge is, there’s an option out there that’ll do the job. The trick is picking the right one - every method has its strengths, weaknesses, and quirks.

We’ll be looking at the range of distance‑measuring methods available at the maker level, focusing on what each does well, where they can fall short, and how to decide which one fits your project best. By the end, you should have a solid understanding of the trade‑offs between different options and be able to make an informed choice for your next build.

Let’s jump in!


Ultrasonic Sensors

Let’s start with the classic: the ultrasonic distance sensor. These modules have been a staple of maker projects for years, and you’ve almost definitely come across one in starter kits or robot tutorials. They work by emitting a very high‑frequency burst of sound (ultrasonic, meaning it’s above the range of human hearing), which travels through the air, hits a surface, and bounces back to the sensor. By timing how long that round trip takes, the sensor can calculate the distance to the object based on the speed of sound. They are just a fantastic, cheap, and straightforward way to measure distance.

However, they’re not without their quirks. The sound that’s emitted doesn’t travel in a straight line like a laser beam, but instead spreads out in a cone — roughly 30 degrees in most models. A good way to visualise this detection cone is that it's like shining a flashlight around of ultrasonic sound.  That means you’re always measuring the first thing that sound bounces off within that cone, which can lead to false readings if the environment is cluttered. They also rely on the surface being relatively flat and angled toward the sensor; curved or tilted surfaces can deflect the sound wave away completely. To top it off, atmospheric conditions like air temperature, humidity, or wind can slightly affect the speed of sound, leading to minor errors in distance readings. Sound travels at different speeds depending on air temperature, and if a good gust of wind can throw your readings off by a few centimetres as the sound is travelling through the wind itself.

Still, for the price and ease of use, ultrasonic sensors are often a good method of measuring distance - there is a reason they are so popular.

Pros

  • Very low cost and widely available. One of the sensors you are most likely to have spares of in your workshop.
  • Simple to wire up and easy to use with nearly any microcontroller or dev board. They typically only need a digital input to create the sound wave and a digital input to read the return signal.
  • Reasonably accurate for short‑range measurements (within about 1 cm).

Cons

  • Limited range (typically 2–4 m for common HC‑SR04‑style modules). You can find more expensive modules with an increased range.
  • Curved or angled surfaces can deflect away sound waves, leading to less reliable readings.
  • Sound emits in a cone and can pick up unwanted objects, leading to false readings.
  • Differences in air temperature and wind can affect reading accuracy.

Getting Started


Laser Distance Sensors

If you’ve ever needed more precision than an ultrasonic sensor can offer, laser distance sensors are the next logical step up. Instead of using sound waves, these sensors measure distance using light — typically invisible infrared lasers that bounce off a surface and return to the sensor. By timing how long that light takes to come back (known as the time‑of‑flight method), the device can calculate distance with incredible accuracy — often down to just a few millimetres. This becomes even more impressive when you consider that the round-trip time of a laser measuring an object 1 metre away is about 7 nanoseconds. That is a 20-millionth of the average human blink!

One of the most popular options for makers is the VL53L1X, a compact time‑of‑flight sensor developed by STMicroelectronics. It’s easy to use, communicates over I²C, and can read distances up to around 4 meters depending on lighting conditions and the surface you’re measuring. What makes it particularly cool is that it’s eye‑safe all the tricky timing and laser power control happens on the chip itself. A neat bonus of these lasers using light is that they can work through most glass and transparent objects.

That said, light can be just as fussy as sound. Dark, matte, or highly absorbent surfaces (like black fabric or felt) can reflect very little infrared light, reducing effective range and accuracy. If you painted an object in Vantablack, it would be almost impossible to measure its distance, as it wouldn't reflect any light back. Although the likelihood of needing to measure the distance of a Vantablack object in your project is pretty low. Additionally, although they use lasers, the light still spreads out in a cone shape. This is often a bit less than an ultrasonic sensor though, and is often a cone between 15 and 27 degrees.

Pros

  • Excellent accuracy. If you dial it in and calibrate out any offset errors, you can measure distances within a bout a millimetre of accuracy.
  • I²C interface works with most microcontrollers and single‑board computers. With an adequate library it is often plug-and-play.
  • Can “see” through transparent objects in many cases (may be good or bad). Means you are able to build a transparent enclosure around the sensor.

Cons

  • Slightly higher cost than ultrasonic sensors.
  • Limited effective range (~4 m for most modules). More expensive modules can measure longer ranges, like this crazy DFRobot one, which has an 80 metre range!
  • Dark or matte surfaces can slightly reduce detection range.
  • Still has a detection cone and measures the closest reflective object within its viewing cone

Getting Started


Multi-zone Laser Distance Sensors

If a standard laser distance sensor gives you one precise measurement, a multi‑zone laser distance sensor gives you dozens at once. These sensors are built around the same time‑of‑flight principle as the VL53L1X, but instead of a single laser spot, they use an array that projects multiple zones, essentially forming a small grid of distance readings.

A common example is the VL53L5CX, which produces an 8 × 8 grid of independent distance measurements. That’s 64 individual points of data, with an update rate of 15 Hz! With that, you can start doing some really interesting things that go beyond simple distance sensing - like detecting shapes, motion patterns, or generating low‑resolution depth maps of a scene. For example, you could point one at a wall with a door, and tell not only how far away the wall is, but also if you are parallel to the wall, or if the door is open or closed! A sensor like this gives you enough distance readings to start being able to primatively 3D map your environments.

The trade‑off, of course, is complexity. Instead of one clean distance value, you’re now receiving a stream of 64 (or more) readings that you need to process and interpret. If you’re using a microcontroller, this can start to push memory and timing limits, especially if you’re polling rapidly. A sensor like the VL53L5CX is fine for most microcontrollers, but older and lower-end 8-bit ones might not have enough resources to run this sensor. 

Pros

  • 2D “depth map” output with up to 64 separate distance readings at once.
  • Retains the precision and reliability of laser time‑of‑flight technology.
  • Enables spatial mapping, or you can just use a few of the distance measurements.
  • All the other pros of laser distance sensors.

Cons

  • More expensive than single‑zone laser sensors.
  • Data‑heavy. Requires a bit of planning and math to effectively use in a project.
  • Still limited to short ranges (around 4 m).
  • All the other negatives of laser distance sensors.

If you wish to go one more - one more step further with laser distance sensors, you might wanna check out something like this Arducam TOF camera. It uses the same idea as the 8x8 distance sensor, but instead comes in a camera form with 240x180 laser distance measurements. Forewarning though, there might be quite a learning curve to using this camera; it is going to need a fully-fledged computer like a Raspberry Pi 5, and effectively using all these data points in your project may prove to be difficult. This is also moving away from the territory of measuring distance and getting more into the realm of 3D scanning and LiDAR, which could have a whole overview guide of its own.

Getting Started

  • If you are looking to get started with the VL53L5CX in MicroPython, Pimoroni have a great guide.
  • If you are instead looking to use C++, check out SparkFun's library for that.
  • And if you are looking to check out the Arducam TOF camera, they have some great documentation to get you started.

Ultra Wideband

All of the distance sensors we’ve looked at so far share one thing in common — they send out a signal, wait for it to bounce off something, and measure how long it takes to come back. Ultra‑Wideband, or UWB, flips that whole concept on its head. Instead of bouncing a signal off an object, UWB measures the distance between two devices that are actively communicating with each other.

Here’s how it works: one board sends out a short radio pulse, another board receives it and sends back a reply, and the first board measures how long the round trip took to figure out the distance between them. Because those signals are travelling at the speed of light, it all happens in billionths of a second — meaning the timing circuits onboard have to be incredibly precise. The result is a direct measurement of the distance between the two modules, regardless of orientation or surface material.

This is a huge advantage over reflective systems. Ultrasonic and laser modules only measure the distance of the thing you are pointing them at. UWB doesn’t care which way the boards are facing — it simply gives you a straight‑line distance between them. That makes it perfect for tracking moving objects, ranging between devices, or even building local‑positioning systems where multiple base stations calculate an object’s exact location in 3D space. Additionally, UWB tends to work through minor obstacles. You can have people, furniture or maybe even a paper-thin wall in the way and still get the distance 

That’s not to say it’s flawless. UWB modules tend to be more expensive than sensors like the VL53L1X, and their accuracy, while good, isn’t pixel‑perfect — typically within ~10 cm. For short‑range or precision work, that might be too inaccurate. But for larger‑scale applications, it is a rock-solid choice. 

Pros

  • Doesn’t rely on reflection as it measures the distance between two devices directly.
  • Capable of working through mild obstacles like furniture or people.
  • Supports multi‑node setups for full 3D spatial tracking.
  • Very stable once configured.
  • Generous range. Dependant on selection of board and operating environment, but a maximum range of 20-40 meters is expected. More often around 25-30.

Cons

  • More expensive than ultrasonic or laser distance sensors.
  • Accuracy is typically limited to around 10 cm, but can be improved with some filtering.
  • Requires at least two UWB boards for a basic setup.
  • Setup and configuration are more involved.
  • Real‑time data management can be complex for larger networks.

Getting Started


GPS

Let's start thinking a little outside the box here. When you think of measuring distance, GPS probably isn’t the first thing that comes to mind - but it’s one of the most widely used systems on the planet. Each GPS module communicates with satellites orbiting Earth, trilaterating its position based on how long it takes those satellite signals to arrive. From that, it can calculate a precise location anywhere on the globe, usually returning latitude, longitude, and altitude in real time. With this, you can use an inexpensive module to track an object and figure out how far away it is from a point on the Earth. Or you could have two or more modules communicating their coordinates to each other to measure the distance between them.

That said, GPS isn’t built for short‑range precision. Accuracy is typically within one or two metres, and that’s under clear skies. Poor weather, tall buildings, or indoor use can easily degrade that to three, maybe ten meters or more of inaccuracy. While that might rule it out for projects that need to measure centimetres or millimetres, it’s more than enough when your goal is to measure larger movements — like how far a rover has travelled, or the distance between separate GPS nodes.

Another often‑overlooked advantage is height measurement. Since most GPS modules also provide altitude readings, you can measure elevation changes, track flight heights, or even approximate the terrain beneath a vehicle — all in one compact package.

Pros

  •  Practically an infinite range. Can measure any two points on the surface of the earth.
  • Only one module per device needed — satellites do the rest.
  • Provides 3D positioning (latitude, longitude, altitude) for measuring distance.
  • Affordable and widely supported across maker ecosystems.
  • Works perfectly for outdoor projects or long‑distance tracking. 

Cons

  • Accuracy is generally limited to 1–2 m under good conditions.
  • Reduced accuracy indoors or near tall structures (signal blockage)
  • Not suitable for short-range distance measurement

Getting Started

  •  We have guides on how to use some cheap GPS modules for MicroPython and C++.

Barometer and Altitude

If your project only needs to measure changes in height - for example, how far something has moved up or down - a barometric pressure sensor can be one of the simplest and most elegant solutions. These tiny sensors measure air pressure, which naturally decreases as you go higher in altitude. By comparing that change in pressure over time or between two points, you can estimate vertical distance fairly accurately.

The way it works is simple physics: as altitude increases, the air becomes thinner, and atmospheric pressure drops at a predictable rate. Inside the sensor is a precise pressure transducer that detects these tiny differences, which are then translated into approximate altitude shifts (with a bit of code and math). Even small changes — like moving a few tens of centimetres — are enough for most quality sensors to notice. This makes them great for any project that only needs to measure distance in the form of height.

There are a lot of common modules that you can find at the maker level, like the MS5637 and BME280 (the BME280 can also measure temperature and humidity as well as pressure). They’re small, inexpensive, and communicate over I²C, making them an easy drop‑in for any microcontroller.

Accuracy‑wise, you can expect around 10–20 cm precision if you calibrate properly — more than enough for most maker projects. The main limitation is environmental drift: barometric pressure changes naturally throughout the day as weather conditions shift. That means you’ll need to take occasional reference readings or apply software corrections if you need consistent results over long periods, or even fetch your local atmospheric pressure readings via the internet!

Pros

  • Inexpensive and widely available as they are commonly used in weather station projects.
  • Works indoors, outdoors, as long as you aren't in a pressurised container.
  • Few moving parts — simple setup and low power draw.
  • Many sensors also report temperature and humidity.

Cons

  • Measures only vertical distance, not horizontal range.
  • Ambient air pressure changes can affect readings over time.
  • Requires calibration or a reference point for accurate comparisons.
  • Not suited for high‑speed or motion tracking.

Getting Started


RSSI

Here’s a fun one that often goes unnoticed - you might already have a kind of distance sensor built right into your wireless hardware. RSSI, or Received Signal Strength Indicator, is a value reported by most wireless transceivers that represents how strong a signal is from another device. The basic idea is simple: signals get weaker the farther they travel, so a strong signal usually means the transmitter is nearby, and a weak signal means it’s farther away.

This turns out to be a quick and very low‑cost way to approximate distance, since it doesn’t require any dedicated sensor hardware. Most Wi‑Fi, Bluetooth, LoRa, and Zigbee chips - including the one inside the ESP32, or Pico W, or really any microcontroller with wireless capabilities - can report RSSI out of the box. In code, all you’re doing is reading a number from the wireless interface: something like -20 dBm might mean “right next to you,” while -70 dBm might mean the signal is in the next room over.

Now, the keyword here is approximate. RSSI is influenced by everything from other signals in the area, to walls, to antenna orientation, to humidity - so it’s not a reliable way to get exact distances. Still, if all you need is a rough sense of proximity (“the device is very close” vs. “the device is in another room”), RSSI can fit the bill perfectly. Your hardware also likely already has the ability to use RSSI to guess distance so you might as well give it a go!

For example, you could have an ESP32 log the RSSI of your router to estimate how far away it is, detect when a wearable moves out of range, or trigger a light when your phone walks into the same room. It’s basic — but it’s also everywhere.

Pros

  • Often no extra hardware.
  • Works with Wi‑Fi, Bluetooth, Zigbee, LoRa, and more.
  • Ideal for simple proximity detection.
  • Easy to code and apply in a project.
  • Makes good use of existing signal sources in your home.

Cons

  • Extremely inaccurate, no hope of getting a solid number measurement - only whether its close, sorta close, or far away.
  • Readings fluctuate heavily over time
  • Can’t reliably distinguish between two devices at similar distances

Getting Started

  • If you are looking to use C++, you can find a great guide by Deep Blue Embedded.
  • LLM's like ChatGPT, Claude and Gemini are all very well versed in this and can also help you write code for this.

mmWave

If your project involves detecting people, movement, or larger objects, millimetre-wave radar is a really interesting option that bridges the gap between motion sensing and distance measurement. These small modules work a lot like traditional radar — they transmit radio waves (these modules usually operate in the 24 GHz or 60 GHz frequency range), wait for those signals to reflect off nearby objects, and measure how long the reflection takes to return. What makes them special is how precisely they can do this. The higher frequency of mmWave radar means the wavelength is incredibly short (only a few millimetres long), which allows for fine‑grained detection of both distance and motion.

Many maker‑level mmWave modules are designed specifically for human detection. Humans have a certain level of reflectivity to these radio waves, and the micro-movements we are constantly making (like breathing) create unique patterns that this sensor is programmed to identify. This means that you can have a human sitting in a room full of furniture, and it will measure the distance to that human. Not only that, radar sensors like the Rd-03d come with a dual antenna array that also lets you measure the angle to the human!

There are not many downsides to these besides the fact that they can only detect humans. The only big one to consider is that they cannot be moved during operation. When you power one on, it undergoes a room calibration, and if it is moved, it will give false readings. So while this can't be used on a mobile robot, it is great for something like a home security system.

Pros

  • Detects angle, speed, and distance - all in one device.
  • Works in darkness, fog, and even through thin materials like plastic or wood.
  • Only detects humans (maybe a large dog?).
  • Quite accurate. Can measure distance to within a couple of millimetres of accuracy.
  • Reasonably cheap.

Cons

  • Limited range, usually around 5–8 m. Some modules can be more though!
  • Cannot be moved - has to remain still.

Getting Started


Ranging with Cameras

When you think about it, your own eyes already solve the problem of measuring distance every day by comparing the images from both eyes and letting your brain do the math. In other words, you can look at a wall and roughly know how far away it is. With the right setup, a camera can do exactly the same thing. Using one or more cameras, you can estimate how far away objects are from the lens by analysing the differences between frames or viewpoints. It’s a more advanced technique than the other sensors we’ve covered, but it opens the door to an entirely new range of applications.

The most common approach is stereo vision, where two cameras are placed a fixed distance apart — much like human eyes. Each camera captures the same scene from a slightly different angle, and by comparing how far certain features “shift” between the two images (a process called disparity mapping), you can calculate how far away those features are. This setup is sometimes called a dual‑camera depth system and can deliver surprisingly accurate results, often within a few centimetres over distances of several meters.

For maker projects, there are two paths you can take here. You can either build your own dual‑camera rig using standard Raspberry Pi camera modules and open‑source libraries like OpenCV (warning: can be very involved and complicated!), or you can pick up an integrated solution like the OAK‑D camera. The OAK‑D is an all‑in‑one stereo vision system that handles the heavy processing right on the device, outputting real‑time depth data directly to your Raspberry Pi or PC. It even supports neural inference for object detection and tracking, making it a fantastic tool for robotics or computer vision projects.

There’s also a mono‑camera approach, which uses just a single camera. This works by analysing the size or apparent motion of known objects in the frame, or by referencing visual cues like perspective lines and shadows. It’s much less accurate than stereo vision, but it can be effective if you only need a rough idea of distance or relative movement, and the environment doesn’t change too much. Think of it more as “distance estimation” than true measurement.

The trade‑off with camera‑based systems is data complexity. You’re not just dealing with a single number anymore; it’s an entire image’s worth of information, and turning that into usable distance data takes processing power. For that reason, most camera‑based setups will need a single‑board computer like a Raspberry Pi 5, or even a laptop‑class system if you want to analyse depth maps in real time.

So if this system is complicated and requires a Pi to operate, why would I use it? Well, I would investigate this as an option if you are already using a project with cameras on a Pi. 

Pros

  • Provides full image and depth information — not just a single distance.
  • Can detect multiple objects at once and track movement.
  • Stereo vision gives accurate, camera‑independent 3D data.

Cons

  • Requires high processing power and more advanced software.
  • Sensitive to lighting conditions and scene texture.
  • Calibration can be tricky - cameras must be aligned perfectly.
  • Mono‑camera methods give only rough distance estimates.

Getting Started

  • We have a guide on using the OAK-D with some stereo-ranging.

Measuring Distance Through Motion

Not every project needs to “look” at a target to measure distance - sometimes it’s easier to calculate how far something (or the project itself) has moved. If you know how fast an object is travelling and for how long, you can estimate the distance it’s gone. This is the same principle behind an odometer, and there are a few straightforward ways to do it with maker‑level hardware.

A rotary encoder or wheel sensor is the most common method. As the wheel turns, the sensor outputs pulses that can be counted; multiply those by the wheel’s circumference and you’ve got total distance. If your project has wheels, this is a fantastic method, but for anything else, you might want to instead employ something like an IMU, which can be used to measure acceleration and estimate movement. 

Another great option is an optical flow sensor, which is likely going to be a far more reliable and accurate method of measuring distance. These small sensors use a tiny downward‑facing camera to watch how the ground moves beneath your project, calculating speed and distance based on that motion. Imagine looking at the ground below you from a plane and using some math to figure out how fast you are travelling.

One big drawback with all of these sensors is that because we are estimating distance from speed, if there are any errors in our speed measurement, the distance will be wrong as well. In the real world, measurement errors are everywhere so you can expect the distance measurements to drift over time. A way to "home" your object and set a known position again is always helpful.

Pros

  • Doesn’t need a target or reflective surface.
  • Works great for continuous tracking on moving projects.
  • Optical flow sensors are accurate and fast‑responding.
  • Often simple to integrate with microcontrollers.

Cons

  • Not suitable for stationary distance measurements.
  • Drift is inevitable.

Getting Started

Wrapping Up

We’ve now covered a whole range of ways to measure distance using maker‑level hardware - from classic ultrasonic sensors and precise laser rangefinders, to advanced options like UWB and camera‑based systems. What’s important to remember is that there’s no single “best” solution; each method comes with its own trade‑offs in cost, complexity, and accuracy.

Whether you’re measuring a few centimetres or mapping an entire room, there’s a method that fits your project; it’s just about matching the tool to the job. If one approach doesn’t quite cut it, try combining two or more sensors to balance out their strengths and weaknesses (to do so you might want to look for something called sensor fusion).

If you’ve come up with a unique way to measure distance in your own projects, we’d love to hear about it — share it with us in the community forum below.

Until next time, happy making!

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.