|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <title>2025-09 Running Meshtastic Daemon on Raspberry Pi 4B</title> |
| 6 | + <style> |
| 7 | + body { |
| 8 | + background: #fdf5e6; |
| 9 | + font-family: "Times New Roman", serif; |
| 10 | + color: #111; |
| 11 | + margin: 0; |
| 12 | + padding: 0; |
| 13 | + } |
| 14 | + header.page-top { |
| 15 | + text-align: center; |
| 16 | + margin: 20px 0 10px; |
| 17 | + } |
| 18 | + header.page-top img { |
| 19 | + max-width: 160px; |
| 20 | + height: auto; |
| 21 | + } |
| 22 | + article.post { |
| 23 | + max-width: 860px; |
| 24 | + margin: 0 auto 40px; |
| 25 | + padding: 0 20px 20px; |
| 26 | + border: 3px double #8b4513; |
| 27 | + background: rgba(255, 255, 255, 0.9); |
| 28 | + } |
| 29 | + article.post h1, |
| 30 | + article.post h2 { |
| 31 | + font-family: "Georgia", serif; |
| 32 | + } |
| 33 | + article.post .lede { |
| 34 | + font-weight: bold; |
| 35 | + } |
| 36 | + article.post table { |
| 37 | + width: 100%; |
| 38 | + border-collapse: collapse; |
| 39 | + } |
| 40 | + article.post th, |
| 41 | + article.post td { |
| 42 | + border-bottom: 1px solid #d2b48c; |
| 43 | + padding: 6px; |
| 44 | + text-align: left; |
| 45 | + } |
| 46 | + article.post code { |
| 47 | + background: #fffaf0; |
| 48 | + padding: 0 3px; |
| 49 | + border: 1px dotted #d2b48c; |
| 50 | + } |
| 51 | + article.post pre { |
| 52 | + background: #000; |
| 53 | + color: #0f0; |
| 54 | + padding: 10px; |
| 55 | + overflow-x: auto; |
| 56 | + } |
| 57 | + footer.page-foot { |
| 58 | + text-align: center; |
| 59 | + margin-bottom: 30px; |
| 60 | + font-style: italic; |
| 61 | + } |
| 62 | + a.back-home { |
| 63 | + display: inline-block; |
| 64 | + margin: 15px 0; |
| 65 | + } |
| 66 | + </style> |
| 67 | +</head> |
| 68 | +<body> |
| 69 | + <header class="page-top"> |
| 70 | + <h1>2025-09 Running Meshtastic Daemon on Raspberry Pi 4B</h1> |
| 71 | + <p><a class="back-home" href="./index.html">← Return to the homepage</a></p> |
| 72 | + </header> |
| 73 | + |
| 74 | + <article class="post"> |
| 75 | + <p class="lede"> |
| 76 | + This is a minimal, no-frills write-up of how I built and ran the Linux-native Meshtastic daemon |
| 77 | + (<code>meshtasticd</code>) on a Raspberry Pi 4 Model B running <strong>ArchLinuxARM</strong>, using a |
| 78 | + <strong>Waveshare SX1268 (433/443 MHz) LoRa HAT</strong> mounted on the 40-pin header (SPI). It captures exactly what |
| 79 | + worked for me, with the versions I used. |
| 80 | + </p> |
| 81 | + |
| 82 | + <hr /> |
| 83 | + |
| 84 | + <h2>Hardware</h2> |
| 85 | + <ul> |
| 86 | + <li>Raspberry Pi 4 Model B</li> |
| 87 | + <li>Waveshare SX1268 LoRa HAT (433/443 MHz), connected via SPI</li> |
| 88 | + </ul> |
| 89 | + |
| 90 | + <h2>Assumptions</h2> |
| 91 | + <ul> |
| 92 | + <li>Fresh-ish ArchLinuxARM userspace with sudo/root access</li> |
| 93 | + <li>SPI enabled via Raspberry Pi boot firmware (<code>/boot/config.txt</code>)</li> |
| 94 | + </ul> |
| 95 | + |
| 96 | + <hr /> |
| 97 | + |
| 98 | + <h2>1) Install dependencies</h2> |
| 99 | + <pre><code>pacman -S --needed git vim base-devel python python-pipx bluez bluez-libs bluez-utils libgpiod yaml-cpp fmt clang openssl cmake pkgconf |
| 100 | +</code></pre> |
| 101 | + |
| 102 | + <h2>2) Install PlatformIO and Meshtastic Python CLI</h2> |
| 103 | + <pre><code>pipx install platformio meshtastic |
| 104 | +</code></pre> |
| 105 | + |
| 106 | + <h2>3) Clone firmware and build the native target</h2> |
| 107 | + <p>I pinned to the tag I tested:</p> |
| 108 | + <pre><code>git clone https://github.com/meshtastic/firmware |
| 109 | +cd firmware |
| 110 | +git checkout v2.7.11.ee68575 |
| 111 | +pio run -e native |
| 112 | +</code></pre> |
| 113 | + |
| 114 | + <h2>4) Check and install the binary</h2> |
| 115 | + <pre><code>cd .pio/build/native |
| 116 | +./program --version |
| 117 | +install -m 0755 program /usr/local/bin/meshtasticd |
| 118 | +meshtasticd --version |
| 119 | +</code></pre> |
| 120 | + |
| 121 | + <h2>5) Configure Meshtastic daemon for the Waveshare HAT</h2> |
| 122 | + <p>Create the config directory and file:</p> |
| 123 | + <pre><code>mkdir -p /etc/meshtasticd |
| 124 | +vim /etc/meshtasticd/config.yaml |
| 125 | +</code></pre> |
| 126 | + |
| 127 | + <p>My working <code>/etc/meshtasticd/config.yaml</code> (GPIOs are BCM numbers):</p> |
| 128 | + <pre><code>Module: Radio |
| 129 | +Lora: |
| 130 | + Module: SX126x |
| 131 | + Region: EU_433 |
| 132 | + SPI: |
| 133 | + Device: /dev/spidev0.0 |
| 134 | + Pins: |
| 135 | + NSS: 8 |
| 136 | + RESET: 25 |
| 137 | + DIO1: 24 |
| 138 | + BUSY: 23 |
| 139 | +</code></pre> |
| 140 | + |
| 141 | + <h2>6) Enable SPI in the boot firmware</h2> |
| 142 | + <p>Edit the Pi’s boot config:</p> |
| 143 | + <pre><code>vim /boot/config.txt |
| 144 | +</code></pre> |
| 145 | + <p>Add:</p> |
| 146 | + <pre><code>dtparam=spi=on |
| 147 | +dtoverlay=spi0-0cs |
| 148 | +</code></pre> |
| 149 | + <p><em>Note:</em> some notes used <code>idtoverlay</code> by typo; the correct key is <code>dtoverlay</code>.</p> |
| 150 | + |
| 151 | + <h2>7) Load SPI module and reboot</h2> |
| 152 | + <pre><code>echo spi_bcm2835 | sudo tee /etc/modules-load.d/spi.conf |
| 153 | +reboot |
| 154 | +ls -l /dev/spidev0.0 |
| 155 | +</code></pre> |
| 156 | + |
| 157 | + <h2>8) Create a systemd service</h2> |
| 158 | + <pre><code>vim /etc/systemd/system/meshtasticd.service |
| 159 | +</code></pre> |
| 160 | + |
| 161 | + <p>Service file contents:</p> |
| 162 | + <pre><code># /etc/systemd/system/meshtasticd.service |
| 163 | +[Unit] |
| 164 | +Description=Meshtastic Daemon (Linux-native) |
| 165 | +After=network.target |
| 166 | + |
| 167 | +[Service] |
| 168 | +ExecStart=/usr/local/bin/meshtasticd -c /etc/meshtasticd/config.yaml |
| 169 | +Restart=always |
| 170 | + |
| 171 | +# Start as root unless you've set udev rules for /dev/spidev0.0 and gpio |
| 172 | + |
| 173 | +User=root |
| 174 | +Group=root |
| 175 | + |
| 176 | +[Install] |
| 177 | +WantedBy=multi-user.target |
| 178 | +</code></pre> |
| 179 | + |
| 180 | + <p>Enable and start:</p> |
| 181 | + <pre><code>systemctl enable --now meshtasticd |
| 182 | +</code></pre> |
| 183 | + |
| 184 | + <h2>9) Verify</h2> |
| 185 | + <p>Use the Meshtastic CLI to confirm the daemon is up and reachable:</p> |
| 186 | + <pre><code>meshtastic --info |
| 187 | +</code></pre> |
| 188 | + |
| 189 | + <hr /> |
| 190 | + |
| 191 | + <h2>Notes / Pin mapping</h2> |
| 192 | + <ul> |
| 193 | + <li><strong>SPI device:</strong> <code>/dev/spidev0.0</code></li> |
| 194 | + <li><strong>NSS/CS (CE0):</strong> BCM 8</li> |
| 195 | + <li><strong>RESET:</strong> BCM 25</li> |
| 196 | + <li><strong>DIO1:</strong> BCM 24</li> |
| 197 | + <li><strong>BUSY:</strong> BCM 23</li> |
| 198 | + </ul> |
| 199 | + <p>Different Waveshare revisions may wire RESET/DIO/BUSY differently; adjust the YAML if initialization fails.</p> |
| 200 | + |
| 201 | + <h2>Optional: run non-root</h2> |
| 202 | + <p>If you want to drop root, add udev rules for <code>/dev/gpiochip*</code> and <code>/dev/spidev0.0</code>, put your service user in the corresponding group(s), and switch <code>User=</code>/<code>Group=</code> in the service file.</p> |
| 203 | + |
| 204 | + <hr /> |
| 205 | + |
| 206 | + <h2>Appendix: Full command list (copy-paste)</h2> |
| 207 | + <pre><code># install dependencies |
| 208 | +pacman -S --needed git vim base-devel python python-pipx bluez bluez-libs bluez-utils libgpiod yaml-cpp fmt clang openssl cmake pkgconf |
| 209 | + |
| 210 | +# install platformio and meshtastic python lib |
| 211 | + |
| 212 | +pipx install platformio meshtastic |
| 213 | + |
| 214 | +# install native firmware on latest available tag |
| 215 | + |
| 216 | +git clone https://github.com/meshtastic/firmware |
| 217 | +cd firmware |
| 218 | +git checkout v2.7.11.ee68575 |
| 219 | +pio run -e native |
| 220 | + |
| 221 | +# check and install binaries |
| 222 | + |
| 223 | +cd .pio/build/native |
| 224 | +./program --version |
| 225 | +install -m 0755 program /usr/local/bin/meshtasticd |
| 226 | +meshtasticd --version |
| 227 | + |
| 228 | +# configure meshtastic daemon for waveshare hat |
| 229 | + |
| 230 | +mkdir -p /etc/meshtasticd |
| 231 | +vim /etc/meshtasticd/config.yaml |
| 232 | + |
| 233 | +# /etc/meshtasticd/config.yaml |
| 234 | + |
| 235 | +Module: Radio |
| 236 | +Lora: |
| 237 | +Module: SX126x |
| 238 | +Region: EU_433 |
| 239 | +SPI: |
| 240 | +Device: /dev/spidev0.0 |
| 241 | +Pins: |
| 242 | +NSS: 8 |
| 243 | +RESET: 25 |
| 244 | +DIO1: 24 |
| 245 | +BUSY: 23 |
| 246 | + |
| 247 | +# configure boot config to enable spi |
| 248 | + |
| 249 | +vim /boot/config.txt |
| 250 | + |
| 251 | +# /boot/config.txt |
| 252 | + |
| 253 | +dtparam=spi=on |
| 254 | +dtoverlay=spi0-0cs |
| 255 | + |
| 256 | +# enable spi module and reboot |
| 257 | + |
| 258 | +echo spi_bcm2835 | sudo tee /etc/modules-load.d/spi.conf |
| 259 | +reboot |
| 260 | +ls -l /dev/spidev0.0 |
| 261 | + |
| 262 | +# create systemd service and enable |
| 263 | + |
| 264 | +vim /etc/systemd/system/meshtasticd.service |
| 265 | + |
| 266 | +# /etc/systemd/system/meshtasticd.service |
| 267 | + |
| 268 | +[Unit] |
| 269 | +Description=Meshtastic Daemon (Linux-native) |
| 270 | +After=network.target |
| 271 | + |
| 272 | +[Service] |
| 273 | +ExecStart=/usr/local/bin/meshtasticd -c /etc/meshtasticd/config.yaml |
| 274 | +Restart=always |
| 275 | +User=root |
| 276 | +Group=root |
| 277 | + |
| 278 | +[Install] |
| 279 | +WantedBy=multi-user.target |
| 280 | + |
| 281 | +systemctl enable --now meshtasticd |
| 282 | + |
| 283 | +# check daemon |
| 284 | + |
| 285 | +meshtastic --info |
| 286 | +</code></pre> |
| 287 | + </article> |
| 288 | + |
| 289 | + <footer class="page-foot"> |
| 290 | + <img src="./animated-mail-image-0311.gif" alt="Animated Mailboxes" /> |
| 291 | + <div><a href="./index.html">Back to COM0 on the Web</a></div> |
| 292 | + </footer> |
| 293 | +</body> |
| 294 | +</html> |
0 commit comments