Connecting to a Meshtastic node using Bluetooth from Linux

Quick post describing the steps necessary to connect to a Meshtastic node from a Linux system, such as a Raspberry Pi, using Bluetooth. Connecting to a Meshtastic device using Bluetooth is something I struggled with initially and I am writing this both for my own reference but also in the hopes it proves helpful for someone else.

This post is from the point of view that you are using a Raspberry Pi. On my Pi, I am running Ubuntu 24.04 (64 bit). To get this working I have created a Python virtual environment (python3 -m venv meshastic && . ./mestastic/bin/activate) as well as the package bluez. Next, follow the steps below:

  • enter the Bluetooth CLI with bluetoothctl.
  • Issue
    • agent on
    • discoverable on
    • scan on
  • Allow the scan to run long enough for your node to appear by name
  • Issue scan off to stop scanning. The device should now show up if you issue devices
  • Copy the hardware or MAC address of the device you want to connect to. In this example, the MAC address I am connecting to is D0:9D:0C:3A:3D:E4.
  • Issue pair D0:9D:0C:3A:3D:E4 to pair with the device. You will be prompted for the passkey for the device. Enter either what is on the screen, pre-configured or what you already set it to if you have already performed initial setup using another app. If bluetoothctl says the device is not available, run the scan again and attempt to pair again. If you wait too long the device will be removed. Once paired, it will stay.
  • Issue trust D0:9D:0C:3A:3D:E4 to trust the device.
  • Issue disconnect D0:9D:0C:3A:3D:E4 to disconnect so that other apps can connect instead.
  • You are done using bluetoothctl and you can type exit or press ctrl+d to exit it.
  • reboot your device. I had issues with bluetoothctl staying connected to the node when it shouldn’t have.

You will now be able to use the Meshtastic CLI tool to interact with the node. To do so, ensure you have activated your virtual environment with . ./meshtastic/bin/activate and have installed the Meshtastic cli tool using pip install meshtastic. If you have issues with the CLI tool connecting, make sure any other client applications have disconnected from the device AND you have closed the app. Nodes will only allow a single connection at a time.

At this point you will be free to run client applications such as the Meshtastic CLI tool or contact, a text UI based tool.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.