Using the Wareshare Hat for RPi.
Kernel configuration
dtparam=spi=on dtoverlay=spi0-0cs enable_uart=1
Kernel command line
console=tty1 root=PARTUUID=xxxxxxxx-02 rootfstype=ext4 fsck.repair=yes rootwait cfg80211.ieee80211_regdom=GB
Meshtastic
Lora: Module: sx1262 # Waveshare SX126X XXXM DIO2_AS_RF_SWITCH: true CS: 21 IRQ: 16 Busy: 20 Reset: 18 GPS: SerialPath: /dev/ttyS0 Logging: LogLevel: debug # debug, info, warn, error Webserver: Port: 443 # Port for Webserver & Webservices RootPath: /usr/share/doc/meshtasticd/web # Root Dir of WebServer
Runit
systemctl stop meshtasticd systemctl disable meshtasticd systemctl mask meshtasticd
#! /bin/bash sleep 1 #LOG exec 2>&1 ulimit -aH #RUN mkdir -p /var/lib/meshtasticd cd /var/lib/meshtasticd exec /sbin/meshtasticd -d /var/lib/meshtasticd -c /etc/meshtasticd/config.yaml
sudo apt install python3-full
mkdir -p ~/.venvs python3 -m venv ~/.venvs/meshtastic
~/.venvs/meshtastic/bin/python -m pip install pytap2 ~/.venvs/meshtastic/bin/python -m pip install meshtastic
Add ~/.venvs/meshtastic/bin to $PATH
meshtastic --port /dev/ttyACM2 --set lora.region EU_868
meshtastic --port /dev/ttyACM2 --noprot
~/.venvs/meshtastic/bin/python -m pip install --upgrade meshtastic
meshtastic --port /dev/ttyACM2 --ch-set name "XXX" --ch-index 1 Connected to radio Set name to HOME Writing modified channels to device meshtastic --port /dev/ttyACM2 --ch-set psk base64:xxx --ch-index 1 Connected to radio Writing modified channels to device
This setup sends and receives messages on the CLI on a Pi Pico attached to /dev/ttyACM2
Install
git clone https://github.com/brad28b/meshtastic-cli-receive-text cd meshtastic-cli-receive-text ~/.venvs/meshtastic/bin/python -m pip install -r requirements.txt
Prepend the following the each python script and edit the IP address and/or serial port in each script.
#! /bin/bash "exec" "`dirname $0`/python" "$0" "$@"
Copy scripts into the venv.
chmod +x *.py cp *.py ~/.venvs/meshtastic/bin
Listen
read_messages_serial.py Using serial port: /dev/ttyACM2 Initializing SerialInterface to get node info... Node info retrieved. Parsing node info... Node info parsed. Node List: {'num': '!0342a02e', 'user': {'shortName': 'Pico'}} {'num': '!014fdb61', 'user': {'shortName': 'RPi'}} Subscribed to meshtastic.receive SerialInterface setup for listening. RPi: Hello World!
Direct message
meshtastic --port /dev/ttyACM2 --dest \!014fdb61 --sendtext "Hi!"
Channel message
meshtastic --port /dev/ttyACM2 --ch-index 1 --sendtext "Hello!"
These are some parameters which can be used to sniff the LoRa radio with RTL-SDR.
region=EU_868, name=LongFast freqEnd: 869.4000.250000 MHz numChannels: 1 x 250.000kHz Radio frequency: 869.525024