💾 Archived View for sdf.org › rg19 › core › 2023.01.28.gmi captured on 2023-01-29 at 04:30:54. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
A couple of years ago, I decided to build a wireless weather station based on the Adafruit Feather and a LoRa radio. My first purchase included most of the sensors and a Feather M4 Express, but no radio and no enclosure. It turned into a rats nest of wires that could only print a comma-separated string of numbers to the terminal, but the inital prototype was functional. It spent most of its existence in this state, collecting dust as it sat unprotected on the desk.
Then, about two years ago I finally got around to buying a Feather M0 RFM95 with a 915MHz LoRa bonnet to go with the Raspberry Pi Zero. When they arrived, I expected to be on the air within a matter of minutes, but the excitement dissipated quickly when I discovered the M0 did not come with CircuitPython already installed. While reading the instructions on Adafruit, it seemed simple enough to do myself. Just plug it into the computer, push the reset button twice to start the bootloader mode and mount the corresponding storage device that would be listed by 'lsblk'. Once that was done, I'd download the "uf2" file for CircuitPython and put it on the "boot drive". Well, this is where things started to go downhill...
I plugged in the M0 and ran 'lsblk' but found nothing. I tried the reset button and found... nothing, but the onboard LED went from blinking to pulsing, so I knew that part worked. Upon further inspection of the instructions, I learned that the M0 didn't even have the UF2 bootloader, the very thing that makes it show up as a storage device (and likewise permits installing Python). Turns out the board came with the Arduino bootloader, so right out of the box it was useless to me.
Eventually I find the instructions needed to get the UF2 bootloader installed, but was horrified to learn that it requires using the Arduino IDE (barf), which in turn meant using the only PC in the house which happens to run on Windows 7 (scream). To top it all off, the entire process would involve using Firefox (groan) to read the instructions, download the required packages and mess around with the Ghastly Unholy Interference that passes for a desktop (blasphemer!).
What might have been half an hour felt more like an hour and a half as I waited for Firefox to load, waited for drivers to install, waited for board definitions to download and install, waited for more drivers to install... That's a chunk of time I'm never getting back, and all to install some software that will *never* be used again. Eventually it came time to click the "Upload" button in the IDE which would then put the UF2 bootloader on the M0. The gods must have been in a good mood that morning because it worked. The board reset and a new device appeared, so I quickly copied the uf2 file to the new "Featherboot" and once again the board reset, showing up now as a "CircuitPy" with an empty "code.py" file already in place.
Jolly good! Now be gone, unholy clicky click nonsense! Back to the dark confines of the terminal for me. I rush upstairs to start filling that empty file with some code. At some point I remember the bonnet, so I start to set things up. The Raspberry Pi Zero is in a plastic case with the headers exposed, but the bonnet has a rather thin connector which cannot fit deep enough into the case. Rather than do the sensible thing and remove the case, I instead choose to plug the bonnet into the Pimoroni pHAT Stack, or tried to anyway. One of the contacts on the bonnet was malformed, causing a pin to get bent on the Stack and preventing the bonnet from seating properly. I figured it might still be making contact, so I go to plug in the ribbon cable on the Pi... and then I get a sudden rush of nostalgia. Out of nowhere, a long lost memory comes flooding back.
It was probably 2006, I was in the basement tinkering with an old IBM desktop. Having just put the CPU back onto the motherboard, I tried to turn on the machine but was met with a loud beep and nothing on the monitor. A rather strange smell started to fill the room. This meant nothing to me at first since the old machine was already quite smelly (you know that odour, sort of metallic and distinctly computer-like). Thinking the CPU might not be seated properly, I turn off the machine and try to correct the problem, only to get burned when I touch the CPU. I had forgotten to put the heatsink back on, allowing the CPU to burn up within seconds.
As it turns out, that very same smell began to fill this room after connecting the ribbon cable, similar to how water smells after exiting a hot garden hose. A few seconds later, smoke started to rise from beneath the metal plate that covers the radio on the bonnet. I managed to fry a new toy before I could even play with it. It turns out the ribbon cable was rotated the wrong way when plugging into the pHAT Stack, destroying a $30+ component and crushing all of my hopes and dreams.
Well I bought another radio bonnet and figured I should probably set up the Raspberry Pi with the required software. After all, the *idea* of building this weather station started over a decade ago when I first learned about microcontrollers, and only recently has it actually started to become reality thanks to Adafruit and CircuitPython. Once again, things went downhill... Being stubborn in my stance against systemd, I chose to run Void Linux on the Pi since it was already the daily driver on my other machines. Unfortunately, previous experience has shown that Void tends to have issues with Python dependency hell, as discovered when trying to build QGIS from source (and failing miserably, not on the Pi of course). I tried installing everything needed to run Adafruit's Blinka and communicate with the hardware, but was met with errors which I do not know how to solve, and was not motivated enough to try and figure out how. For some reason, this killed all motivation and the project was scrapped again. The breadboard with the sensors and Feather M0 continued to sit on the desk, collecting dust, blinking every five seconds as it printed the latest readings to the picocom terminal.
...And then I got tired of looking at the damn thing, reminding me every day of what could have been, had I simply used Raspian OS. Around a week ago, I put Raspian back on the Pi and (correctly) wired the LoRa bonnet, then tested it with the example code.
SUCCESS! The bonnet lit up with life, no funny smells or smoke, and the M0 was reprogrammed to actually use the onboard radio, with messages successfully transmitted to (and received by) the Pi. Finally, another step toward building something I'd dreamed of for so long. And if that wasn't enough, I also got around to testing the Sparkfun AS3935 lightning detector for the first time, another sensor which had been sitting in the parts box since the first purchase alongside others which have yet to be used. Currently there are no thunder storms here in January (yet), but there are some sources of noise which have triggered the device.
In spite of this recent move forward, the project is still likely to remain in the current state for some time to come. I still need to figure out how to wire up the Sparkfun wind vane/rain gauge/aneometer combo and read the values. There is also the need for a proper enclosure for the electronics, plus some solar panels to charge the battery. Regardless, this has certainly improved my outlook on the prospect of a DIY wireless weather station.