Measuring the distance between two points wirelessly can be useful in proximity detection, object monitoring, and embedded automation projects. While ultrasonic sensors and infrared sensors are common choices for short-range distance measurement, Ultra-Wideband (UWB) technology offers another approach for applications that require wireless ranging.
In this project, I built a UWB-based distance monitoring and alert system using an Arduino UNO and two REYAX RYUW122_Lite UWB modules. The system measures the distance between an Anchor and a Tag, displays the reading on a 16×2 I2C LCD, and activates a buzzer when the distance exceeds a predefined threshold.
Overview
The project consists of two UWB modules, an Arduino UNO, an LCD, and a buzzer.
One RYUW122_Lite module operates as the Anchor and connects to the Arduino through UART communication. The second module operates as the Tag. The Anchor requests a distance measurement and receives the ranging result from the Tag.
The Arduino processes the returned distance, displays it in centimeters, and checks whether it exceeds the configured threshold of 200 cm. If the distance crosses that limit, the buzzer activates.
Components Required
- Arduino UNO
- 2 × REYAX RYUW122_Lite UWB modules
- 16×2 I2C LCD
- Active-low buzzer module
- Logic-level shifter for UART communication
- Regulated 3.3 V power supply for the UWB modules
- Jumper wires and breadboard
Understanding REYAX RYUW122_Lite UWB Module
The REYAX RYUW122_Lite is a UWB antenna transceiver module. The module can be configured using UART AT commands, making it suitable for microcontroller-based projects. It supports distance measurement between an Anchor and a Tag and can achieve approximately 10 cm accuracy under suitable conditions. Actual performance depends on the environment, antenna placement, and obstacles.
Hardware Connections
Connecting the Anchor to Arduino UNO
The Anchor communicates with the Arduino using UART. Since the RYUW122_Lite operates at 3.3 V and the Arduino UNO uses 5 V logic, a suitable logic-level shifter should be used for the UART signal connections.
Connect the Anchor's TXD pin through the level shifter to Arduino D9, configured as the software serial RX pin. Connect Arduino D10, configured as the software serial TX pin, through the level shifter to the Anchor's RXD pin.
Power the Anchor using a regulated 3.3 V supply and connect its ground to Arduino GND.
Connecting the LCD
The 16×2 I2C LCD uses four connections. Connect VCC to 5 V, GND to GND, SDA to Arduino A4, and SCL to Arduino A5. If the LCD's A0, A1, and A2 address jumpers are open, its I2C address is 0x27.
Connecting the Buzzer
For the active-low buzzer module used in this setup, connect its positive terminal to the 5 V supply and its control/negative terminal to Arduino D2. The buzzer activates when D2 is driven LOW. Use a suitable transistor driver if the buzzer's current requirements exceed what an Arduino pin can safely handle.
Connecting the Tag
The second UWB module is configured as the Tag and powered from a regulated 3.3 V supply. Connect its GND to ground. The Tag does not require a direct UART connection to the Arduino in this configuration.
Never apply 5 V or 12 V directly to the module's 3.3 V power input.
Configuring the UWB Modules
Before running the Arduino sketch, configure the modules using a UART terminal that supports AT commands.
Set the Anchor to Anchor mode using:
AT+MODE=1
Set the Tag to Tag mode using:
AT+MODE=0
Configure both modules with the same network ID. For example:
AT+NETWORKID=1
If the Arduino sketch uses a software serial baud rate of 9600, configure the Anchor's UART baud rate accordingly:
AT+IPR=9600
Make sure the module addresses, network configuration, baud rate, and ranging command match the actual firmware and Arduino sketch.
Arduino Software
The Arduino sketch handles UART communication with the Anchor, receives the ranging response, extracts the distance, updates the LCD, and controls the buzzer.
The project uses the SoftwareSerial library and the LiquidCrystal_I2C library by Frank de Brabander. The sketch should send a valid ranging request to the Anchor and parse the response returned by the module.
For example, a ranging command may look like this:
AT+ANCHOR_SEND=TAG,2,Hi
A response can look like this:
+ANCHOR_RCV=TAG,2,Hi,50 cm
The exact command and response format must match the module configuration and firmware. The Arduino code should also handle missing or invalid responses instead of interpreting them as valid distance measurements.
Once the distance has been extracted, the program compares it with the 200 cm threshold. If the distance exceeds the limit, it activates the buzzer; otherwise, the alert remains inactive.
Testing the Project
After completing the wiring and configuring both modules, upload the Arduino sketch and power on the system. The LCD should display the measured distance between the Anchor and Tag.
Move the modules closer together and farther apart to check whether the displayed readings change accordingly. When the distance exceeds 200 cm, the buzzer should activate.
Repeat the test in different positions and environments. Walls, obstacles, antenna orientation, and the surrounding environment can affect ranging performance, so it is worth observing how the readings behave under different conditions.
What Could Be Improved?
This project is a useful starting point, but there are several ways to extend it.
Push buttons could be added to adjust the alert threshold without modifying the code. LEDs could indicate safe, warning, and alert states. Measurement filtering and separate trigger/reset thresholds could reduce repeated buzzer switching when readings fluctuate near the limit.
Another extension would be to connect an ESP32 to a monitoring dashboard and record distance measurements over time. For a more advanced project, multiple Anchors could be explored for indoor positioning, provided the hardware configuration and ranging protocol support the intended positioning method.
Final Thoughts
Building this project provided a practical way to explore UWB ranging, UART communication, and Arduino-based alert systems. It demonstrates how two wireless modules can be used to measure distance and trigger an action when a predefined limit is crossed.
For the complete project tutorial, including the hardware setup and implementation details, see Distance Monitoring and Alert System Using RYUW122_Lite UWB Modules and Arduino.
Have you worked with UWB modules in an Arduino or ESP32 project? What applications or improvements would you explore next?


Top comments (0)