meshtastic-bitchat-bridge
A bridge that connects Meshtastic devices with Bitchat and vice versa for public message exchange.
File Browser:
- 📄 mesh-bit.py
- 📄 README.md
- 📄 requirements.txt
README
Meshtastic-Bitchat Bridge
https://github.com/user-attachments/assets/3ebd0c6f-3552-441d-bd7e-a3e5f88676d4
A bidirectional bridge connecting Bitchat and Meshtastic. This tool allows local Bluetooth chat clients to communicate over long distances via LoRa radios, effectively extending the range of Bitchat using the Meshtastic network.
How It Works
The script runs on a Linux device (like a Raspberry Pi or laptop) that has both Bluetooth and a USB connection to a Meshtastic device.
- Bitchat to Meshtastic: The bridge scans for nearby Bitchat devices over Bluetooth. When it receives a message from a phone, it relays that message to the Meshtastic LoRa network.
- Meshtastic to Bitchat: The bridge listens for incoming LoRa messages from the Meshtastic network. When a message arrives, it broadcasts it over Bluetooth to all connected Bitchat clients.
Prerequisites
- A Linux computer with a Bluetooth adapter.
- A Meshtastic device connected via USB (e.g., /dev/ttyUSB0 or /dev/ttyACM0).
- Python 3.7 or higher.
Installation
- Clone this repository.
Create a virtual environment (recommended):
python3 -m venv venv source venv/bin/activateInstall the required Python libraries:
pip install -r requirements.txt
Required for iOS Support
To prevent "Enter PIN to pair" popups on iOS devices, you must optimize the BlueZ configuration.
Edit Bluetooth Settings:
Edit /etc/bluetooth/main.conf:
sudo nano /etc/bluetooth/main.conf
Find the [General] section and ensure these lines are set:
JustWorksRepairing = never
ControllerMode = le
Privacy = device
Disable Battery Plugin: The battery plugin often triggers pairing requests. You should disable it in the service definition.
Edit the service file:
sudo nano /lib/systemd/system/bluetooth.service
Find the ExecStart line and add -P battery at the end. Note that the path to bluetoothd may vary depending on your distribution (e.g., /usr/lib/... or /usr/libexec/...):
# Example (keep your existing path, just add -P battery at the end)
ExecStart=/usr/libexec/bluetooth/bluetoothd -P battery
Apply Changes:
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
Usage
- Connect your Meshtastic device to the computer via USB.
- Ensure your Bluetooth adapter is active.
Run the bridge script:
python3 mesh-bit.pyOpen the Bitchat app on your phone and bring it close to the bridge. It should connect automatically.
Troubleshooting
Bluetooth on Linux can sometimes become unresponsive or get stuck in a bad state. If the bridge fails to discover devices or connect, follow these steps to reset the system.
Stop the script by pressing Ctrl+C.
Force kill any lingering Python processes that might be holding the adapter:
pkill -f "python.*mesh-bit"Restart the Bluetooth service (requires sudo):
sudo systemctl restart bluetooth(Optional) If issues persist, you can try resetting the HCI interface directly:
sudo hciconfig hci0 down sudo hciconfig hci0 upRun the script again.
Credits
This project was built with help and inspiration from the following open source projects:
- bitchat-python: https://github.com/kaganisildak/bitchat-python
- Meshtastic Python: https://github.com/meshtastic/Meshtastic-python