Receive UWB Position Data with Raspberry Pi (Python Example)
A hands-on example that connects a GrowSpace UWB developer tag to a Raspberry Pi 4, receives real-time position data with the lec and lep commands, and parses it with Python.

About this article
This article shows how to connect a GrowSpace UWB developer tag to a Raspberry Pi 4 Model B, and receive and parse real-time position data with the lec and lep commands. It centers on a hands-on example that implements serial communication in Python and analyzes the position data directly.
What you need
- Raspberry Pi 4 Model B

- USB-C power adapter (5V 3A or higher)
- GrowSpace UWB developer tag
- Jumper cables (TX, RX, GND, 3.3V)
- Python 3.9.2 or later (OS: Debian GNU/Linux 11)
- pyserial package installed
Set up the Raspberry Pi serial port
- Enter the following command in the terminal:
sudo raspi-config
- Go to the menu:
\* Interface Options → Serial Port
\* Login shell via serial: No
\* Enable serial port hardware: Yes - When the setup is done, reboot with the
sudo rebootcommand
Serial pin wiring (UART)
Using the 3.3V connector (left side) of the GrowSpace developer tag, connect as follows:
| Developer tag pin | Raspberry Pi pin number | GPIO number |
|---|---|---|
| TX | Pin 10 (RXD) | GPIO15 |
| RX | Pin 8 (TXD) | GPIO14 |
| 3.3V | Pin 1 | – |
| GND | Pin 6 | – |
⚠️ Make sure TX ↔ RX is cross-connected: tag TX → Pi RX, tag RX → Pi TX
Reference: Raspberry Pi GPIO pin layout
Below is the full pin map of the Raspberry Pi 40-pin header. Connect exactly by the following pin numbers:
- TX0: GPIO14 (Pin 8)
- RX0: GPIO15 (Pin 10)
- 3.3V: Pin 1
- GND: Pin 6
This diagram helps you understand the serial connection to the developer tag more clearly.
For the full GPIO layout and circuit information, see the official documentation: Raspberry Pi official pinout and drawings

Caution: serial port types on the GrowSpace tag
The GrowSpace developer tag has serial ports with different voltage levels on the left and right sides. This is not just a difference in pin position. The levels are electrically completely different, so you must tell them apart.
- Port 1 (left connector)
- Pins: TX, RX, 3.3V, GND
- Operating voltage: 3.3V level
- Use: connecting to 3.3V devices such as Raspberry Pi and ESP32
- Port 2 (right connector)
- Pins: TX, RX, 5V, GND
- Operating voltage: 5V level
- Use: connecting to 5V devices such as Arduino UNO
Check this before you connect
- The GPIO of the Raspberry Pi accepts 3.3V levels and nothing higher.
- If you connect the 5V port (right connector) by mistake, the UART circuit of the Raspberry Pi can be damaged.
- In this manual, you must use the left connector (3.3V port).
Python serial communication code
import serial
import threading
uwb = serial.Serial('/dev/serial0', baudrate=115200, timeout=0.5)
def read_from_uwb():
while True:
if uwb.in_waiting:
data = uwb.readline().decode(errors='ignore').strip()
if data:
print(f"[UWB response] {data}")
def write_to_uwb():
while True:
try:
cmd = input(">>> ")
if cmd.strip():
uwb.write((cmd + '\r').encode())
except KeyboardInterrupt:
print("\nExiting.")
break
if __name__ == "__main__":
print("UWB serial relay started (/dev/serial0)")
threading.Thread(target=read_from_uwb, daemon=True).start()
write_to_uwb()
read_from_uwb()prints the data received in real timewrite_to_uwb()takes a command from the input and sends it (including\r)
Example: when you enter the si command and the device information is printed, communication works.
Position data parsing example (lep and lec commands)
LEP (position data)
def parse_lep(line):
print("\n[LEP position result]")
parts = line.strip().split(',')
if len(parts) >= 5:
print(f"X: {parts[1]}")
print(f"Y: {parts[2]}")
print(f"Z: {parts[3]}")
print(f"Quality (QF): {parts[4]}")
else:
print("→ Invalid LEP format.")
LEC (distance and position information)
def parse_lec(line):
print("\n[LEC distance + position result]")
try:
pos_idx = line.index("POS,")
dist_part = line[:pos_idx].strip()
pos_part = line[pos_idx:].strip()
anchors = []
tokens = dist_part.split(',')
i = 2
while i < len(tokens):
if tokens[i].startswith("AN"):
anchor_id = tokens[i+1]
x = float(tokens[i+2])
y = float(tokens[i+3])
z = float(tokens[i+4])
d = float(tokens[i+5])
anchors.append((anchor_id, x, y, z, d))
i += 6
else:
i += 1
for idx, (aid, x, y, z, d) in enumerate(anchors):
print(f"AN{idx} (ID {aid}): x={x}, y={y}, z={z}, distance={d}m")
parse_lep(pos_part)
except Exception as e:
print(f"lec parsing failed: {e}")
Full receive loop (automatic parsing)
input_buffer = ""
def read_from_uwb():
global input_buffer
while True:
if uwb.in_waiting:
data = uwb.read().decode(errors='ignore')
if data == '\n':
line = input_buffer.strip()
if line.startswith("POS,"):
parse_lep(line)
elif line.startswith("DIST,"):
parse_lec(line)
else:
print(f"[Other response] {line}")
input_buffer = ""
else:
input_buffer += data
- A line that starts with
POS,is parsed as LEP - A line that starts with
DIST,is parsed as LEC - All other responses are printed too
Summary
This manual introduced how to set up serial communication with a GrowSpace developer tag on a Raspberry Pi, and how to receive and parse position data in real time with Python, based on the lep and lec commands.
With this procedure:
- You set up stable communication through the
/dev/serial0port of the Raspberry Pi - You can check real-time position information with Python parsing logic
- You can extend it into a test bed for RTLS experiments and prototyping
If a problem occurs during the exercise, be sure to check again whether TX/RX is cross-connected and whether the port is enabled.