New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

Old 8-bit PIC with no SPI peripheral: can it drive an SX1276 for LoRaWAN?

Old 8-bit PIC with no SPI peripheral: can it drive an SX1276 for LoRaWAN?

Solved 5 4

We have about 30 grain bin moisture probes built years ago around a PIC16F with no hardware SPI and very little RAM. Firmware is stable and the farm likes them. I’d like to bolt an SX1276 radio on and get them into Hermetry over LoRaWAN instead of the manual readings.

Can SPI be bit-banged on something this old fast enough for the radio? And is the LoRaWAN part realistic on a PIC16, or am I dreaming?

♥ 2

Could you use a LoRa module that runs the stack itself and just talk to it over UART with AT commands?

Measure twice, poll once.
♥ 0

How many probes? Matters for whether a redesign pays off.

♥ 0

30 probes, no redesign budget.

♥ 0

Two different questions.

SPI: yes, bit-banging is fine. The SX1276 has no minimum SPI clock, mode 0, and register access at a few hundred kHz from a PIC is plenty. People run raw LoRa point to point like that.

LoRaWAN: that’s where a PIC16 runs out. The stack needs crypto (AES-CMAC for the MIC), session state, and it has to open the receive windows on time after each uplink. Hermetry’s default RX1 delay is 5 s, and the window has to open within a few milliseconds of that. Doable, but not on that RAM.

So Kevin’s idea. A module with its own LoRaWAN stack (an STM32WL based one, for example) over UART. The PIC sends a join command once and then a hex payload per reading, the module handles everything else. Each probe joins with OTAA, Class A, LoRaWAN 1.0.2 to 1.0.4, which is what Hermetry’s network server does, on the same frequency plan as your gateway. A table codec turns your bytes into moisture and battery. Check LoRaWAN limits before you pick the module so its version matches, and buy it for your gateway’s band.

Accepted solution♥ 9

Got two STM32WL modules running on a test probe. The PIC sends three AT commands per reading over its spare UART, joins OTAA fine, and moisture shows up in Hermetry through a table codec. 28 to go. Thanks.

♥ 0
Viewing 6 posts – 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share