Arduino sketch to read CAN through a MCP2515 and Open3D python app to view the objects
  • Python 71.6%
  • C++ 28.4%
Find a file
2026-05-22 10:35:58 +02:00
GPSTest.ino Initial commit 2026-05-22 10:35:58 +02:00
mr76_visualizer.py Initial commit 2026-05-22 10:35:58 +02:00
README.md Initial commit 2026-05-22 10:35:58 +02:00

MR76 Radar Visualizer

A real-time 3D visualization system for the MR76 77GHz automotive radar using:

  • an ESP32
  • an MCP2515 CAN controller
  • Python + Open3D visualization

The ESP32 receives CAN frames from the radar, decodes tracked objects, and streams simplified target data over USB serial to a Python application that displays detections in a live 3D scene


Features

Arduino / ESP32 side

  • Reads CAN frames from the MR76 radar

  • Decodes object tracking messages (0x60B)

  • Extracts:

    • target ID
    • forward distance
    • lateral distance
    • relative velocity
    • dynamic property
    • radar cross section (RCS)
  • Streams compact CSV packets over serial

  • Runs in CAN listen-only mode

Python visualizer

  • Real-time 3D visualization using Open3D

  • Displays:

    • radar targets
    • target labels
    • target velocity
    • target distance
    • coordinates
  • Color-coded targets based on speed

  • Ground grid

  • Automatic target timeout cleanup

  • Live frame counter


Hardware Required

Component Notes
ESP32 Any standard ESP32 dev board
MCP2515 CAN module 8MHz version recommended
MR76 radar 77GHz radar

Wiring

ESP32 ↔ MCP2515

MCP2515 Pin ESP32 Pin
VCC 5V
GND GND
CS GPIO 5
SO GPIO 19
SI GPIO 23
SCK GPIO 18
INT GPIO 4

Arduino Firmware

Required Libraries

Install in Arduino IDE:

  • mcp_can

Library:


Arduino Sketch

The ESP32 listens for CAN frames and decodes radar target packets.

Expected radar CAN IDs:

CAN ID Purpose
0x60A Radar scene status
0x60B Object tracking data
0x201 Radar status
0x700 Diagnostics

Currently the sketch mainly uses:

0x60B

which contains tracked object data.


Serial Output Format

The ESP32 sends CSV packets:

TARGET,id,x,y,vx,vy,dynamic,rcs

Meaning:

Field Description
id Target ID
x Forward distance (m)
y Lateral distance (m)
vx Relative forward velocity
vy Relative lateral velocity
dynamic Dynamic property
rcs Radar cross section

Python Visualizer

The Python application:

  • reads serial data
  • parses targets
  • renders them in 3D using Open3D

Installing Python Dependencies

Debian / Ubuntu

Install system dependencies:

sudo apt install python3 python3-pip python3-venv \
mesa-utils libgl1-mesa-dev

Create virtual environment:

python3 -m venv venv
source venv/bin/activate

Install Python packages:

pip install open3d pyserial numpy

Alternative Installation Using pyenv

Some Linux distributions do not provide recent enough Python versions for Open3D through the package manager.

If you encounter issues such as:

No matching distribution found for open3d

or Open3D failing to install on Python 3.13, use pyenv to install Python 3.11 or 3.12.


Debian / Ubuntu

sudo apt update

sudo apt install -y \
build-essential \
curl \
git \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
wget \
llvm \
libncursesw5-dev \
xz-utils \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
libffi-dev \
liblzma-dev

Install pyenv

curl https://pyenv.run | bash

Add this to your shell config:

export PATH="$HOME/.pyenv/bin:$PATH"

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Reload shell:

source ~/.bashrc

Install Python 3.11

pyenv install 3.11.9

Set local version:

pyenv local 3.11.9

Create Virtual Environment

pyenv virtualenv 3.11.9 radarenv

Activate:

pyenv activate radarenv

Install Python Packages

pip install --upgrade pip
pip install open3d pyserial numpy

Verify Open3D

python -c "import open3d as o3d; print(o3d.__version__)"

If successful, Open3D is correctly installed.


Running the Visualizer

Find serial port

Example:

ls /dev/ttyUSB*

or:

ls /dev/ttyACM*

Edit the Python script

Set:

SERIAL_PORT = "/dev/ttyUSB0"

to your ESP32 serial device.


Run

python mr76_visualizer.py

Viewer Controls

Action Control
Rotate camera Left mouse
Pan Middle mouse
Zoom Mouse wheel

Visualization

Targets are displayed as:

  • colored 3D points
  • floating labels

Labels show:

  • target ID
  • distance
  • velocity
  • coordinates

Color meaning:

Color Meaning
Green Slow/static
Yellow Moderate speed
Red Fast

Coordinate System

The radar is assumed perfectly level with the horizon.

Axes:

Axis Meaning
X Left/right
Y Forward
Z Up

Current implementation assumes:

Z = 0

because the MR76 tracked-object CAN frames do not contain elevation information.


Known Limitations

  • No true elevation data
  • No raw point cloud
  • Only tracked-object mode decoded
  • Labels are screen-space approximations

Safety Notice

This project is experimental and intended for:

  • research
  • robotics
  • visualization

Do not use it for:

  • autonomous driving
  • collision avoidance
  • safety-critical systems

without extensive validation.

Troubleshooting

If you encounter:

FEngine resolved backend: OpenGL
Segmentation fault

Then export those variables in your terminal:

export QT_QPA_PLATFORM=xcb
export XDG_SESSION_TYPE=x11