Pure Micropython LoRa library

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
martynwheeler
Posts: 8
Joined: Thu Jan 28, 2021 10:36 pm

Pure Micropython LoRa library

Post by martynwheeler » Sat Jan 30, 2021 1:47 pm

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

uCTRL
Posts: 47
Joined: Fri Oct 12, 2018 11:50 pm

Re: Pure Micropython LoRa library

Post by uCTRL » Sat Jan 30, 2021 11:16 pm

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?

martynwheeler
Posts: 8
Joined: Thu Jan 28, 2021 10:36 pm

Re: Pure Micropython LoRa library

Post by martynwheeler » Sun Jan 31, 2021 10:18 am

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.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Pure Micropython LoRa library

Post by davef » Sun Jan 31, 2021 10:45 am

My guess: CR is coding rate and SF is spreading factor. Thanks for posting the project.

martynwheeler
Posts: 8
Joined: Thu Jan 28, 2021 10:36 pm

Re: Pure Micropython LoRa library

Post by martynwheeler » Sun Jan 31, 2021 10:56 am

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 :-)

Post Reply