Author Topic: LoRa Packet Design  (Read 295 times)

ecliptic

  • Newbie
  • *
  • Posts: 21
  • Country: us
LoRa Packet Design
« on: July 19, 2019, 10:01:27 AM »
I'm building my first LoRa based project, and I had a question on packet design.  My project involves the following:

1) A group of nodes that transmit various information to a gateway.
2) The gateway receives the information, processes it, and issues a command back to the node.
3) The node receives the command, and then goes to sleep.

I have this workflow working with a BLE radio; however, I want to expand my range with LoRa (RFM95).  I've been reading about how LoRa works, and my understanding is that any node that is listening on the same frequency receives all data transmitted on it.  I was wondering if there are some basic/standard patterns that are used to achieve a more point-to-point communication (i.e. the node processes the command from the gateway that is specific for that node).

I'm thinking I could put some metadata in the packet that nodes can parse and ignore if it's not for them, but I wasn't sure there was a more standard approach (maybe using the radio itself... some register maybe?).  Thank you!

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
Re: LoRa Packet Design
« Reply #1 on: July 19, 2019, 10:12:11 AM »
All that is handled with a hardware packet handler in the transceiver chip.
A library like RadioHead would implement that and make it easy for you to set network and node Ids so packets are filtered.

ecliptic

  • Newbie
  • *
  • Posts: 21
  • Country: us
Re: LoRa Packet Design
« Reply #2 on: July 19, 2019, 10:22:47 AM »
Hi Felix,

Thank you for the fast reply.  I've been looking at the RH_RF95.h file; however, I don't see any options to set the network/node id.  I see the following register entry "RH_RF95_REG_39_SYNC_WORD" which may be the network.  Am I missing it?

https://www.airspayce.com/mikem/arduino/RadioHead/RH__RF95_8h_source.html

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
Re: LoRa Packet Design
« Reply #3 on: July 19, 2019, 10:28:26 AM »
Unfortunately RadioHead is just the driver and if you read the details, it does not implement addressed messaging, and you will have to use a manager like their ReliableDatagram protocol to send addressed messages with LoRa.
Here's an example of using that with RF95.

ecliptic

  • Newbie
  • *
  • Posts: 21
  • Country: us
Re: LoRa Packet Design
« Reply #4 on: July 19, 2019, 10:31:47 AM »
Ahh! Thank you so much.

ecliptic

  • Newbie
  • *
  • Posts: 21
  • Country: us
Re: LoRa Packet Design
« Reply #5 on: July 19, 2019, 06:28:16 PM »
After digging in a little further, it looks like you can set the node ID; however, it doesn't look like there's a network ID.  Is the NetworkID equivalent to the Sync Word register?

Otherwise, it looks like I'll have to add something at the application layer.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
Re: LoRa Packet Design
« Reply #6 on: July 21, 2019, 06:54:42 PM »
In all my practice, network ID was never very useful to be honest. Because you'd want to isolate networks by frequency and not share spectrum between networks, and just setting an ID doesn't do that. The only advantage is easy sniffing between networks.
Since you have to set a parameter to have different networks ... why not change the channel/frequency? Then that's your "network".

ecliptic

  • Newbie
  • *
  • Posts: 21
  • Country: us
Re: LoRa Packet Design
« Reply #7 on: July 23, 2019, 11:30:05 PM »
I wasn't aware you could do that.  As long as I keep the frequency between 868.0 - 915.0 right?  How many decimal points can I go down?  I assumed LoRa did something with the spread factor that was it's version of frequency "hopping", and the developer was forced to set the frequency to 915.0.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
Re: LoRa Packet Design
« Reply #8 on: July 24, 2019, 12:30:45 PM »
Each ISM frequency band has certain upper/lower limits. For instance "915mhz ISM band" is really 902-928, but the band its limits will vary by region. So you can hop and play within those limits.
In LoRa the frequency is usually the center frequency around which the LoRa protocol will up/down-"chirp".
For LoRa protocol details see these helpful resources:

- Data Rate and Spreading Factor

- and this video:


ecliptic

  • Newbie
  • *
  • Posts: 21
  • Country: us
Re: LoRa Packet Design
« Reply #9 on: July 25, 2019, 09:43:09 AM »
Very helpful!  Thanks.  I was messing with changing frequencies yesterday and it works great!  I have a hobby project where I test my gateway and nodes in my office before I deploy them outside, so I was looking for alternatives to setting node identifiers.