Meshtastic for the Greater Good [Hackaday]

View Article on Hackaday

Last week, my city was hit by a tornado. That’s not surprising here in Oklahoma, and thankfully this event was an F0 or possibly even an EF0 — a really weak tornado. Only a couple roofs collapsed, though probably half the houses in town are going to need roof repairs, thanks to the combination of huge hail and high winds. While it wasn’t too bad, power did go down in a few places around town, and this led to an interesting series of events.

Chat messages were coming in like this: “That was a [power] flicker, yeah. Even took down my Internet.” Followed by “Whee, [fiber Internet] got knocked out and now Starlink has too many clouds in the way.” And after ten minutes of silence, we got a bit worried to see “Time to hide under a bed. … Is cell service back?” It is a bit spooky to think about trying to help neighbors and friends after a disaster, in the midst of the communication breakdown that often follows. If he had needed help, and had no working communications, how long would it have taken for us to go check on him?

How do you stay connected here?
avivi, CC BY-SA 2.0

I had already been exploring an open source project that might be able to help. A follower described a problem where communication could be cut off in the midst of a large protest in her home country, and she needed a way to stay connected in a crowd.

One of the possible solutions was Meshtastic, an encrypted wireless protocol that uses meshing to distribute messages and location data. It runs on a few different development boards, and some of the hardware is surprisingly affordable. For instance, the WisBlock Meshtastic starter kit is a mere $24.99. Use a USB-C cable to hang that off your phone, and you can connect to nearby metastatic channels, or create your own private channel.

The Magic

The Meshtastic radio magic comes from LoRa, a wireless protocol running on the sub-1 GHz bands. One of the winning features of that band is that no amateur license is required, up to a 1 W broadcast strength. If you have your Ham license, feel free to turn up the power — but with the caveat that amateurs can’t use encryption. And that’s one of Meshtastic’s features; it uses AES encryption to keep conversations private. More on the configuration in a bit.

I hear you radio geeks scoffing, “A measly watt?”  But people have managed 128 mile (206 km) LoRa contacts on quite a bit less than that full watt. Yes, that test did involve a weather balloon, but the second-place test was a still-respectable 103 mile (166 km) distance managed peak-to-peak across water. You may notice that both records required elevation. The 915 MHz band that Meshtastic targets is still pretty dependent on line-of-sight — no ionosphere skipping here. And with only a 1 watt output power, we’re not blasting though much earth.

So to make up for the less-than-stellar propagation of the frequency band, the Meshtastic protocol makes every node a potential repeater. If your radio can talk to your buddy’s radio up on the hill, that device works as a repeater, and rebroadcasts the packet, giving your message a much wider reach. By default, each packet is limited to three hops, and the protocol tries to be smart about not flooding the aether with useless echoes. But if you can get a couple of radios in elevated locations across your area, you can manage pretty good coverage.

Usefullness

OK, so what can you do with it? Keep in mind that LoRa isn’t winning any throughput contests. No streaming video or file-sharing here. Meshtastic works best when sending text messages, either directly to another radio, or to a shared channel. And if your radio knows where it’s at, it can send location data every few minutes to the primary shared channel. There are other modules, like sending telemetry data like temperature and humidity across the network, or a rather impressive experimental module that sends low bit-rate audio across the aether. The system was originally designed for friends going hiking, camping, or even hang gliding together.

Radio on the Hill

I have several use-cases where Meshtastic just might be the killer app. One is disaster recovery. If I can talk a few friends into stashing a radio, if tornado really comes and ruins our day, we’ll have a backup communication net to organize getting help where it’s needed. But on a day-to-day basis, I’m much more interested in giving one of the battery-powered radios with each of my kids, before letting them out the door. Suddenly don’t see the kid where expected? Ping the radio for a location update.

I have a 6 dBi antenna about 20 feet up in my back yard, trying to get all the range I can. I regularly get three and a half miles of coverage across town, with a few dead zones in valleys. Talking someone in the right spot into a repeater will make quite a difference on that front. And on the far end, I’ve established a pretty robust 10 mile link from the local mountain-top. Line-of-sight is king.

Getting Started

When I first discovered Meshtastic, the hook that really got me interested was that low price. A pair of WisBlock kits or Lilygo T-Beams gets you started, but the performance of the little PCB antenna isn’t amazing. And it’s nice to have a GPS module and battery for the radio. And of course you’ll want to 3d-print a case for it, because who wants to carry around a raw PCB and dangling antenna? There are some cases and even pre-assembled kits on Etsy and Tindie. And Rokland is one of the favored suppliers of the Meshtastic devs.

For a bit more power, there’s the Station G1 by B&Q Consulting that has an amplifier scaling output power all the way up to 3.5 W, if you want to turn off encryption and send your ham radio call-sign with each packet. To keep encryption on, you’ll need to limit the output to a single watt. Though my testing really indicates that the line of sight becomes a problem long before transmit power, and turning up the power doesn’t help that situation dramatically.

From there, you just need two or more radios with a shared channel. By default, Meshtastic radios use the LongFast channel, with a shared blank encryption key, as sort of a public channel. Something to be aware of is that if you broadcast location information, it goes out over the Primary channel. So you might want to set a private channel with a unique encryption key as your primary, and define the LongFast channel as a secondary, to participate in the public channel. To do that, in Lora settings, set the channel number to 20, and add a secondary channel named “LongFast” with the pre-shared key set to “AQ==”.

And with that, you’re set. You can track a vehicle or person, send text messages that don’t rely on the Internet or Cellular network, and even do a few extra tricks. One of those more interesting tricks is the Meshtastic support for sending packets on to a MQTT server. That’s a topic for another day.

If you’re looking for more information, there was a great FLOSS Weekly interview with a couple of the Meshtastic devs that I can recommend with some admitted bias. Beyond that, I’ve been peppering the Meshtastic Discord with questions, suggestions, and bug reports for over a month now, and it’s been a very welcoming community. If you have any questions, dive in. And look forward to more fun to be had with Meshtastic integrating with other projects.