Electronic Tape Measure Project Using UWB Modules

I used two RYUW122 UWB modules to create an electronic "tape" measure that measures distances of up to 100 meters.
Jun 10, 2024 — 4 mins read — Projects

Electronic Tape Measure Project Using UWB Modules

I recently played with measuring distance using an ultrasonic sensor as well as using a laser-based time of Flight sensor and they both worked great for pellet level monitoring. The ultrasonic sensor works with distances of up to 2 meters, while the laser one works to about 1.2 meters, so if you want to measure larger distances, they are out of the selection.

What you can use instead, is a UWB (Ultra WideBand) sensor like the Reyax RYUW122. This is a super tiny sensor that works on 6.5 GHz and 8 GHz and can be interacted with through UART.

To demonstrate the concept, I created a "tape" measure device that can measure distances of up to 100 meters using radio waves.

Principle of Operation

The devices work on the so-called Time Of Flight principle where one of the devices sends a message to the other and then listens for the reply. Depending on the time it took for that reply to come back, the device can then calculate how much distance there is in between, given that radio waves travel at the speed of light. Pretty cool, right?

Tools and Materials

RYUW122_Lite website link: https://reyax.com/products/RYUW122_Lite

RYUW122 Amazon link: https://www.amazon.com/dp/B0C68NX1S8?ref=myi_title_dp

RYUW122_Lite Digi-key link: https://www.digikey.com/en/products/detail/reyax/RYUW122-Lite/22206993

Tools and materials used in the video:

Tag Device

The tag device consists of a RYUW122 UWB module and a NodeMCU to control it. The communication is done through UART using the software serial library on the NodeMCU, on pins D5 and D6.

Here, during the setup function, the module is put into tag mode so it listens for messages from the anchor device. Below is the full code for it.

Anchor Device

The anchor device is the same as the tag with the addition of an OLED screen to display the distance. The OLED is communicated through I2C on pins D1 and D2.

Testing in Open Field

While developing, I tested the devices to a maximum of around 12 meters indoors through several walls and they worked without any issues. To test their full range, I went to a soccer field nearby that had a diagonal distance of 120 meters.

With me, I took a real tape measure of 30 meters so that I could compare the results.

At the 12 meter mark, the distance shown by the device was 11.7~11.8 meters so it was off slightly higher than the claimed 10-cm precision. This accuracy improved the further I went and on 20 and 30 meters it was really spot on. I guess at closer distances, any slight movements and interference from objects and people around the devices can throw it off a bit.

The devices do have a command that can be used to calibrate the output but I did not use it now since I wanted to compare the original settings.

Going further in distance, I wasn't able to compare the distance with the tape measure, but I used visual markers on the field so that I could later compare the distance via Google Maps.

The device worked fine till 99.9 meters, and it then cut of as if it was limited in software. I did not have my laptop with me to know the exact output on the serial console but I might redo the test to better see what is going on after 100 meters.

In any case, the device fulfilled the claimed 100 meters with ease.

Conclusion and next steps

Although the devices do not have a millimeter precision, they are quite handy in knowing the general distance between two points. Should we have more than one anchor device, we can use that information to calculate the exact position of the tag on the field, and with 3 or more anchors, we can also determine the general position of the tag in 3D space.

This can be handy for asset tracking in closed spaces such as buildings where we can know in which room a certain tag is.

If you have any ideas for future projects with the devices, be sure to let me know in the comments below, and make sure to subscribe to my YouTube channel for more projects.

prototype UWB oled nodemcu
You might also enojy this

Making a DIY Optocoupler

When I worked on my garage door opener, I wanted to use a 12V relay with a NodeMCU development board because that was what I had on hand but...