Skip to content
Melbourne University RacingMelbourne University RacingMUR Autonomous WikiAutonomous Wiki

Telemetry Pi

On this page

What runs on the car's Raspberry Pi, how to set it up, how to start and stop a run, and how to get the logs.

A Raspberry Pi on the car reads both CAN buses and the BMS. Four services run on it:

ServiceWhat it does
telemRecords all CAN and BMS data to the SD card at /mnt/logs, and sends the radio selection over the XBee.
bms-telemetryReads the BMS (an Allion AL1220-BT) over Bluetooth and passes its values to the other services.
mur-cellularSends the live selection over cellular to the backend, which serves it to mur-voir.
mur-mf4-uploaderUploads each finished MF4 file to the backend, which archives it in Azure.

The services run separately. If the cellular link or the backend goes down, telem keeps recording.

The car has two CAN buses:

BusPi interfaceBitrate
Control (tractive)can1500 kbit/s
Telemetrycan01 Mbit/s

Check that everything is running:

Terminal window
systemctl status telem bms-telemetry mur-cellular mur-mf4-uploader

Watch the logger and the BMS as the car runs:

Terminal window
journalctl -u telem -u bms-telemetry -f

telem prints a status line every 10 seconds. received should climb, log_dropped and invalid_bms should stay at 0, and log_queue should stay small.

Each time telem starts, it begins a new run. To end a run and start the next one:

Terminal window
sudo systemctl stop telem # finishes writing the last file
sudo systemctl start telem # starts a new run

To stop sending data over cellular without stopping the recording, stop the two network services. Restart them to resume:

Terminal window
sudo systemctl stop mur-cellular mur-mf4-uploader
sudo systemctl restart mur-cellular mur-mf4-uploader

A power cut loses at most the file being written, which is the last minute of data. The finished files are safe.

To join a new Wi-Fi network or a phone hotspot at the track, run the Wi-Fi tool from the checkout. It scans for networks and connects:

Terminal window
cd ~/Wireless-telem
sudo python3 scripts/add_wifi.py

Each run gets its own folder in /mnt/logs, holding:

  • part0001.mf4, part0002.mf4 and so on, one per 60 seconds of running.
  • A copy of every DBC file used, named bus<id>_<file>.dbc.
  • The configuration the run used.
  • manifest.json, with the run’s details, whether it finished, and how many samples were received and dropped.

Check that a run finished cleanly. status should be complete, and received should equal logged:

Terminal window
R=/mnt/logs/$(ls -t /mnt/logs | head -1) # the latest run
jq '{status, counters}' "$R/manifest.json"

If the power was cut, the manifest still says recording. You can delete any leftover tmp* and *.partial.mf4 files.

The Pi also uploads each finished file to the team’s Azure archive. It keeps its own copy either way. Copy runs off the SD card to work on them, then open them in mur-voir.

Two scripts in Wireless-telem help with a run folder. Run them on a laptop, not the car.

Terminal window
# CAN message rates, intervals and gaps for each bus
uv run python scripts/can_rates.py logs/RUN/
# Merge the one-minute files into 15-minute files in logs/RUN/merged/
uv run python scripts/merge_parts.py logs/RUN/ --parts-per-file 15

The MF4 files hold raw CAN frames. To decode them in Python, pass every bus<id>_*.dbc file from the run folder to asammdf’s extract_bus_logging, one (file, bus id) entry each.

You need:

  • Raspberry Pi OS, with a user called mur, the CAN controllers set up as can0 and can1, Bluetooth working, and the log SD card mounted at /mnt/logs.
  • A fine-grained GitHub token with read-only Contents access to Wireless-telem, mur-msgs and bms_telemetry. Make it in GitHub under Settings → Developer settings → Fine-grained tokens, with Melbourne-University-Motorsports as the owner and an expiry date. An org admin has to approve it.
  • The serial path of the car’s XBee radio and the 16-digit address of the base station’s radio. See Radio link.

The Pi bring-up checklist has the same steps with a check after each one.

  1. Clone the repo and install it. Paste the token when git asks for a password. The credential store keeps it, so later git pull and uv sync runs work too.

    Terminal window
    git config --global credential.helper store
    git clone --recurse-submodules https://github.com/Melbourne-University-Motorsports/Wireless-telem
    cd Wireless-telem
    uv python install 3.12 3.13
    uv sync
    uv venv --python 3.13 .venv-bms
    uv pip install --python .venv-bms/bin/python -r services/bms/bms_telemetry/requirements.txt
  2. Bring the CAN buses up at the right bitrates on every boot:

    Terminal window
    sudo tee /etc/systemd/network/80-can0.network >/dev/null <<'EOF'
    [Match]
    Name=can0
    [CAN]
    BitRate=1M
    EOF
    sudo tee /etc/systemd/network/80-can1.network >/dev/null <<'EOF'
    [Match]
    Name=can1
    [CAN]
    BitRate=500K
    EOF
    sudo systemctl enable --now systemd-networkd
  3. Let mur write logs and use the radio:

    Terminal window
    findmnt /mnt/logs # check the SD card is mounted
    sudo chown mur:mur /mnt/logs
    sudo usermod -aG dialout mur
  4. Install the services and fill in the radio settings:

    Terminal window
    sudo install -m 644 deploy/telem.service deploy/bms-telemetry.service /etc/systemd/system/
    sudo install -m 600 deploy/telem.env.example /etc/telem.env
    sudoedit /etc/telem.env

    Set XBEE_PORT to the car radio’s path, which ls /dev/serial/by-id/ lists. Set XBEE_DESTINATION to the base station radio’s address, not the car’s own.

  5. Check the clock is synchronised, because the logs use absolute timestamps. timedatectl should say System clock synchronized: yes.

  6. Start both services, BMS first, and have them start on boot:

    Terminal window
    sudo systemctl daemon-reload
    sudo systemctl enable bms-telemetry telem
    sudo systemctl start bms-telemetry
    sudo systemctl start telem

mur-cellular and mur-mf4-uploader install separately from the logger, as versioned releases under ~/.local/share/mur-cellular/. The Pi also has to be on the MUR tailnet, and needs the backend’s upload token. A maintainer sets this up by following the deployment section of the Pi-to-dashboard runbook.

Updating the cellular services never touches the logger’s checkout. To roll back, stop the two services, point ~/.local/share/mur-cellular/current at the previous release, and start them again.

Everything is always recorded at full rate. The live selection only decides what goes over the radio and cellular links.

Both links take their selection from the [[live]] entries in config/telem.toml. Each entry names a bus, a CAN ID and a rate:

[[live]] # 0x0A5 INV_MotorPosition: motor rpm
bus = 0
id = 165
hz = 3.0

The cellular service also sends every message that carries a state signal or fault bits, at 1 Hz. Cellular rates have to be above 0 and at most 10 Hz. Each cellular release carries its own copy of the configuration, so a change needs a new release. For the radio limits, see Radio link.

Signal definitions come from mur-msgs, pinned to one commit in services/telem/pyproject.toml. When you move the pin, update the lockfile and the copy of the API in vendor/mur-msgs at the same time. Then run uv sync on both the Pi and the base station.

ProblemLikely causeCheck
git clone or uv sync keeps asking for a password, or can’t find mur-msgsThe token is missing a repo or isn’t approvedThe token needs all three repos and an org admin’s approval.
telem exits straight awayA bad /etc/telem.env, or /mnt/logs isn’t mountedsystemctl status telem, findmnt /mnt/logs
No Radio connected lineThe wrong port, or mur isn’t in dialoutls /dev/serial/by-id/ and id mur. Log out and back in after usermod.
received doesn’t climbA bus is down or at the wrong bitrateip -details -statistics link show can0, then can1
The inverter or SBG signals don’t decodeAn old checkout, or uv sync wasn’t run after a pullgit pull && uv sync
invalid_bms climbs, or no BMS valuesThe BMS isn’t connectedjournalctl -u bms-telemetry, and check AL1220BT shows in bluetoothctl scan on
mur-voir says No car dataThe cellular services are down, or the Pi has no connectionsystemctl status mur-cellular, journalctl -u mur-cellular -f

Known gaps:

  • A BMS error other than a bad value ends the whole run, CAN logging included. systemd restarts it as a new run.
  • CAN ID 0x170 on the Telemetry bus isn’t in any DBC, so it’s recorded but never decoded.