ttn-liv / devices

Example code for devices
8 stars 0 forks source link

How to determine location and thus LoRa frequency? #5

Open originalfoo opened 7 years ago

originalfoo commented 7 years ago

In this section it states:

The beautiful thing about this is that you don't have to care about the specifics of the gateway you are connecting to. You only care about the application you are connecting to, and wherever you place your LoRa IoT device it will connect to available gateways and "just work" (as long as you're operating on the appropriate frequency).

This bit left me pondering:

(as long as you're operating on the appropriate frequency)

How do I know the correct frequency, if I don't know where my device is deployed? For example, if I've created a product that sells worldwide, how do I:

ajlennon commented 7 years ago

Your device won't work on multiple frequencies will it?

(This is part of the problem with sub-GHz which drives lots of us to the other sets of problems inherent in 2.4GHz)

originalfoo commented 7 years ago

With something like LoPy I should be able to tell the device what frequency to use (which will affect the antenna it needs) so long as I know what frequency is applicable at the deployment location.

I assume with TTN there's a database somewhere of the various hubs (or whatever the central nodes are called) and the frequency they operate at, hopefully also the power of the signal to get a rough approximation of range (I assume I can tell the LoPy what power it should transmit at in return).

Ultimately I think I'll end up using FiPy rather than the LoPy, so I can fall back to cellular networks as a last, battery munching, resort.

For the sensor pod I'm working on, having it be able to work anywhere is a major requirement. I could potentially create different versions for different regions, but I'd rather go to great lengths to avoid that if possible.

ajlennon commented 7 years ago

With a lot of the sub GHz parts I've looked at such as the TI CCxxxx you can indeed set the frequencies as you wish. What has struck me as odd about the Aliexpress LoRa parts I've seen is that they are pre-configured to specific frequencies before they send them to you.

All of that aside it's not much use if you need to swap out the antenna to get things going

originalfoo commented 7 years ago

Hrm, looks like LoPy is locked to two frequencies:

As far as I can tell, a single 900MHz antenna will handle both 868 and 915 MHz to an acceptable level.

Do LoRa gateways send out beacons that would allow end-nodes to detect when there is a potential gateway within range?

ajlennon commented 7 years ago

It may perhaps be because that's what they've got the certifications for?

On LoRa I dunno. It all seems fairly automatic, as the nodes don't need to know specifics about the gateways so I imagine it must be something like that.

DefProc commented 7 years ago

If you're creating a device, then you have to know which regulatory framework you're operating it in, so you choose the frequency for the area as per the LoRa Alliance spec (some regions are not yet defined - caveat early adopters).

Gateways are transparent listeners, if they receive LoRaWAN messages, they forward them to their routing server and reply with any response (ours send to router.eu.thethings.nework). If there's no gateway, you get no response, or if it's a gateway that forwards to a server that doesn't know your device id & app keys, you get no response, or if it's not listening on the same frequency range, the gateway doesn't hear anything.

The first thing the radio does on power on is to organise a session key for communications with the application server. If you want to ensure that you remain in range of a gateway, you can request and ACK to confirm receipt of any transmission.

DefProc commented 7 years ago

I should also mention that there is the UK forums for TTN too: https://www.thethingsnetwork.org/forum/c/country/uk