decrypting a LoRa prayer
Monday, October 14 2019
My sleep was interrupted multiple times last night by the dogs, beginning with them doing one of their classic high-speed night-time pet door exits, the kind accompanied by much whimpering anticipation. The whimpering could be heard continuing some distance into the woods and the dogs weren't heard from again for something like an hour. Eventually, though, Ramona could be heard barking in the distance, before long even Neville's much quieter barking could be heard. But then things fell mostly silent. Lying there in bed, I began to worry that maybe a bear had been through and knocked over the full shit bucket I'd recently removed from the brownhouse (bears love human shit at least as much as dogs do) and now the dogs were greedily gorging themselves on it. So I got up and went outside with a flashlight to see what was up. Ramona was nearby, but southwest of the house (that is, away from the shit bucket), and she was so worked up she started barking at me. Then I heard them, off in the distance to the south maybe a half mile away: coyotes. They have a crazy sound that can even prick-up the hair on the back of my neck. Evidently they'd been emboldened by the full moon and come in closer to the house than usual, but then the Ramona and Neville had run them off. And now the dogs were policing a perimiter where the coyotes cussed them out from afar. This series of events is very similar to one that happened almost exactly three years ago, back when Neville was wearing a GPS tracker collar. (Through the years, I've noticed that it's not uncommon for incidents with a particular species of wild animal to recur on nearly the same day in subsequent years.)
In hopes of getting back to sleep quickly, I spent the rest of the night in the greenhouse upstairs.
Today started cool, but by this afternoon it was sunny, with temperatures in the high 60s. Soon after getting home, I went immediately to the stone wall and carried a number of large rocks from some distance away to its eastmost end. Despite all the rocks, I didn't make all that much progress. I must've worked a fairly long time, because I was eventually swarmed by Crazy Dave's three berserk dogs. Judging from how they reacted to me, they must be becoming familiar with me. They weren't as belligerent as they've been in the past, and the blue merle Australian shepherd even deigned to sniff my hand.
Back in the laboratory, I resumed my LoRa experiments. Yesterday I'd noted that the keys in my Arduino sketch weren't apparently being used to encrypt the transmitted data, something I wanted to get to the bottom of. After some investigation, I realized that the "Hello World" LoRa sketch I was using was somewhat different from the one being used by Andreas Spiess ("the guy with the Swiss accent"). So I tried out Spiess' version. It worked even worse, failing to transmit anything at all. But it contained all the same named methods as my version. So I replaced these one by one with the ones from my version until data was being transmitted. At this point, I noticed that the Dev Address was now showing up in the packet in plain text, though this might've only been because my dummy one happened to be a palindrome and (as I mentioned yesterday) I still had a lot of confusion about the order to present the bytes in the keys and IDs. I also noticed that the payload was changing with every transmission, even though the data, keys, and IDs were not changing. I kept trying to decrypt these packets in an online web tool without success, but then I realized that I probably had the keys backwards. When I reversed them, the decryption produced a byte stream that, when put into a byte-to-text converter, produced the plaintext I'd been hoping to see for weeks. (In this case it was "young man, it's the YMCA!") I'd finally both transmitted and received data! (Here's the sketch, if you'd like a working example to start with.)
Getting this to work meant that I now knew all I would need to know to build a LoRa-based GPS tracker, but if I wanted to build a LoRa-based Disturbatron, I would need to figure out how to do the opposite, that is, to receive LoRa messages on an Arduino. But now that I had a working sketch and knowledge of how the keys and IDs are ordered, it would probably be easy to figure out.
I used a lithium battery pack to power my Arduino with its little Dragino LoRa shield and then tried placing it a little less than a quarter mile away down the Farm Road to see if I could get a signal from there. Sadly, I couldn't, but that probably wasn't a deal breaker given how poorly every component in this setup had been optimized. And moving the LoRa board to about 200 feet from the laboratory made it possible to receive packets once more.
Meanwhile Gretchen had been down in New Jersey visiting a former prisoner-student (named "Jersey"), and on her way home, she stopped at the Trader Joes' in Paramus to get a load of all the frozen and shelf-stable staples we like to buy there.
For linking purposes this article's URL is:feedback
previous | next