Page 1 of 1

Pure Micropython LoRa library

Posted: Sat Jan 30, 2021 1:47 pm
by martynwheeler
Hi,
In case anyone is interested, I have ported a python library to micropython to utilise LoRa communication from a microcontroller using the RFM95 module.

https://github.com/martynwheeler/u-lora

I have tested it on a Raspberry Pi Pico so far and it is all working. The library is different from the Adafruit circuit python lib as it does not require any other libs so should work on any micropython implementation. It also uses interrupts to trigger the microcontroller when the RFM95 module receives a message.

I'd be grateful if anyone can test it on other boards.

Thanks in advance,

Martyn

Re: Pure Micropython LoRa library

Posted: Sat Jan 30, 2021 11:16 pm
by uCTRL
Thanks for posting.

I would like to see an option for users to set up Lora parameters individually , BW, SF and CR.

Code: Select all

class ModemConfig():
    Bw125Cr45Sf128 = (0x72, 0x74, 0x04)
    Bw500Cr45Sf128 = (0x92, 0x74, 0x04)
    Bw31_25Cr48Sf512 = (0x48, 0x94, 0x04)
    Bw125Cr48Sf4096 = (0x78, 0xc4, 0x0c)
To save me looking up the data sheet, BW looks obvious. But what is the meaning of the CR and SF numeric in those variable names?

Re: Pure Micropython LoRa library

Posted: Sun Jan 31, 2021 10:18 am
by martynwheeler
Thanks for the reply. I will look into that for the future, these are common settings. Looks like the adafruit library allows fine tuning of these parameters. I will dive into the docs and take a look.

Re: Pure Micropython LoRa library

Posted: Sun Jan 31, 2021 10:45 am
by davef
My guess: CR is coding rate and SF is spreading factor. Thanks for posting the project.

Re: Pure Micropython LoRa library

Posted: Sun Jan 31, 2021 10:56 am
by martynwheeler
Thanks for that. think that uCTRL was asking what the value settings for the parameters correspended to, ie how to set a particular value for coding rate, spreading factor etc. This is a bit more involved, I need to look at the bits in the relevant registers and how they are set. I will look into it when I have more time. This was my first foray into micropython and kept me busy on a rainy Saturday morning :-)