← All entries
Project WhisperNet: Off grid encrypted messaging with a LoRa radio.

Project WhisperNet: Off grid encrypted messaging with a LoRa radio.

With my concerns of general internet privacy, i had the urge to build an encrypted end-to-end radio messaging device. I even had a test scenario setup as i had a friend living about 500 meters away, and technically LoRa should be able to hit 10km. So if it did work i actually had a use case for it.

I settled on using an RP2040 as the core, mainly because I was curious what it was capable of and wanted to try it out. For the radio, I ordered a RA-02 module, which basically is a SX1278 LoRa chip breakout board.

image image

The firmware

I got a prototype working in MicroPython first, then switched to the Pico-SDK. It was easy to work with. I did the development on Linux since the Pico-SDK was easier to setup there.

image

I made my own persistent storage solution using the RP2040's internal SPI Flash that had features such as rotating blocks for wear leveling, magic and CRC error checking.

I also utilized the RP2040's PIO state machines:

  • RGB LED Driver: I wrote drivers for the onboard RGB LED using PIO to handle animations (like pulsing) without blocking the CPU.
  • RadioLib Modification: I had to patch the RP2040's RadioLib. It was originally using the second core for timing FSK and OOK modulations, which conflicted with my persistent config saving process. I replaced that timing logic with a PIO program so I could keep everything on one core. I didn't want to overcomplicate the project since the feature-to-work ratio wasn't worth it.

For the interface part, I made the device enumerate as a USB CDC Serial device. Users could connect with a serial terminal and get a shell into the device. The shell was not complicated but fully modular. You could write new commands and integrate them just by adding them to a list.

image

The legal gray area

So this was what i was actually worried about with this whole project. Since the configs were fully writable, you could force the SX1278 to transmit on any frequency you wanted. licensed or not. Plus, LoRa modulation technically isn't intended for end-to-end encrypted text messaging on certain bands. Like polluting the 433Mhz range with constant LoRa messages.

All of this added up to me not putting the source code on GitHub, even as a private repo. I didn't even back it up locally or to my NAS (which was totally my fault).

Testing the device and my stupidity

After the firmware was done, I tested it IRL. In the city, we could only get about 300m of range, so the project was just left to rot. Everything else that was written as a feature was working in that 300 meter range. I was hoping to use the persistent config subsystem on other projects as i coded that to be as abstract and general as possible.

Fast forward about 3 months: I completely forgot the code was on my dual-booted Linux partition. I nuked the drive to reinstall Linux as my daily driver. That was a sad day when I remembered the firmware existed on that partition only.

A weird way to get a new idea

Realizing the firmware was gone forever actually sparked a new idea: building a Linux-kernel-like or UNIX-like system for the RP2040. It might be a good exercise to learn how a kernel actually works and implement a small clone of it.