Configuring a Pico and Lora P2P

Hi There,
I have a Pico connected to a Lora SX126X module and a second Pico W connected to another SX126x module. I have them talking to each other using Lora with a library I found here.

The library appears really well written.

I’m just running the Ping example to start with and it seems to be working.

However I’m not sure what I should change to be compliant with Australian rules.

This page Australia
Has the following details

For AU915, we use Frequency Sub Band 2, also known as channels 8-15, or 916.8MHz through to 918.2MHz.

So do I simply change the freq=923 to something inbetween 916.8 and 918.2 say 917 as it’s roughly in the middle.

Configuration section from the ping example

# LoRa
sx.begin(freq=923, bw=500.0, sf=12, cr=8, syncWord=0x12,
         power=-5, currentLimit=60.0, preambleLength=8,
         implicit=False, implicitLen=0xFF,
         crcOn=True, txIq=False, rxIq=False,
         tcxoVoltage=1.7, useRegulatorLDO=False, blocking=True)

Thanks
David

3 Likes

Hi David,

Great question!

It looks like you’ve fallen into the trap of LoRa vs LoRaWAN.
Since your devices are communicating outside of the LoRaWAN stack (i.e. not connected to a gateway). you should be good to send packets.

HOWEVER, since you are on the airwaves you still have to comply with ISM regulations (let me preface, I’m no lawyer and haven’t thoroughly studied these regulations).
This document outlines the usable frequencies for IoT applications and the maximum allowed power output, to be polite its best to setup P2P devices outside of local LoRaWAN frequencies.

PS: you can check local gateways with https://ttnmapper.org/

Keen to see your project done! You should send it through to Core to go on the projects page once you’ve finished it :slight_smile:

2 Likes

Hi Liam,
I have read through that PDF and nothing leapt out at me saying that I shouldn’t pic something between 915 - 928 Mhz. I also checked out that Lora Wan map and there is nothing within 300km of me so I’m not likely to interfere during testing. :slight_smile:
I’m in the country in the NSW Northern Rivers area. Buying a ~$500 LoraWan router would be ridiculous for my project.
I’m not quite sure why I should be “polite” and choose some other frequency in fact I probably can’t choose another valid one legally or the devices are not capable of doing that anyway. Even with the prospect that LoraWan will enter my neighbourhood over time I doubt my application will cause any problems.
It’s a remote gate sensor that will send a signal when the gate is opened. At most 4-6 times a day.
I’m also considering sending some heart beat style status notifications every few hours. It also seems I’m using these modules as intended.

I have been thinking about sending in a project document to Core Electronics for publication as this seems like an interesting use of the technology.
Thanks for your input.
David

2 Likes

Hi David,

Between 915-928 MHz is perfect, agree on the LoRaWAN router, definitely not necessary for your project (if ever you need to manage upwards of 50 or so nodes it might be nice to have but definitely out of scope).

Great to see a heartbeat signal included and yeah the due diligence of looking out for regulations and asking these questions is great!

Please do! It sounds like an amazing project and we’d + other Makers would love to see it :smiley:
Liam

2 Likes

Hi David. That’s a nice project you’ve got there.
I’m also trying to get a simple peer-to-peer LoRa link going.
I was wondering if you could help me. I’m trying to use the ehong-tl driver.
It looks really good.
Problem is, when I run the firmware (to transmit, on a Pico 2W with the latest LoRa hat - that actually connects underneath the pico, using Thonny) it only gets as far as sx126x.reset() returning the error code:
ERR_CHIP_NOT_FOUND

It’s like the Pico’s RP2040 is not actually talking to the SX1262 chip.
I’m new to Pico (and generally Pi). I’m aware of raspi-config / dtoverlay stuff with Pi.
Is there anything I should do before running the sx1262 code in order to get the SPI/reset/IRQ/data signals connected between the 2 chips on a Pico?
(I’m expecting you’ll say no but hoping you’ll say yes!)

Hi Neil,
Sounds like you are having fun.
I’m a little confused by all the part numbers so not really sure what you are trying to get to work together.
I did end up sending a document to Core describing the completed project with links to GitHub where I posted my code so you should hunt that down if your hardware is similar to mine.
In the beginning I found a ping test in the example code that was on another site, I think it was wave share from memory. That code is in my project.
Make your hardware connections as simple as possible with just enough stuff to do the ping test. It literally sends the word “ping” from one device to the other and then the receiver replies with “pong”
Once you get that to work add things one at a time and test test test.
I have a simple debug routine in my code that I can include in all my projects.
It outputs each variable to the screen then adds a line to a text file so you can see exactly what is happening and where things go wrong or at least how far it gets. I included a DebugLevel variable so once completed I could just set it to 0 and turn it off. That way if I needed the debug code again it’s all still there.

I also recall I was getting strange errors that made no sense and the solution was to add garbage collections to my code. Seems micro python isn’t deallocating memory or you simply need to do it manually.

I had fun mucking around with data encryption and ended up exceeding the maximum string length :cowboy_hat_face:. Turns out that’s 255 characters.
I hope this gives you some ideas to narrow the field with your project.
Do post again with your progress.
David.