LoRa/LoRaWAN tutorial 53: Payload Formatters (V3), fport and json

Mobilefish.com
Mobilefish.com
9.3 هزار بار بازدید - 3 سال پیش - If you like this video
If you like this video and want to support me, go this page for my donation Paypal or crypto addresses:
mobilefish

This is part 53 of the LoRa/LoRaWAN tutorial.

In this tutorial I will explain what fport is and a short refresher what a json object is.
I will also explain what payload formatters are and show you several Javascript payload formatters examples.

This presentation can be found at:
https://www.mobilefish.com/download/l...

All my LoRa/LoRaWAN tutorials and presentations can be found at:
https://www.mobilefish.com/developer/...

The LoRa packet comprises of three elements: Preamble, header (optional) and payload.

To create the Radio Frequency (RF) waterfall, a RTL-SDR (Software Define Radio) dongle is used.  
More information:
RTL-SDR Dongle and GQRX on Mac OS X
The RTL-SDR dongle is nameless but has the following chipsets:
The radio tuner: Rafael Micro R820T2
The demodulator: RealTek RTL2832U

FPort means Frame Port.
FPort is 1 byte in size.
Allowed values: 1-223, except fports 200-203.
This byte is always sent, even if you use it or not.

My end device uses this Arduino sketch:
https://www.mobilefish.com/download/l...
This sketch uses the MCCI LoRaWAN LMIC library in my Arduino IDE (v1.8.10)
https://github.com/mcci-catena/arduin...

In the sketch, change function LMIC_setTxData2 to change the fport value.
LMIC_setTxData2(fport, data, data_length, confirmed)

- There are LoRaWAN end devices where fports can not be changed.
 These devices have fixed fport values.
- There are LoRaWAN end devices where fports can be changed programmatically (for  example in an Arduino sketch) or with at-commands.
- There are LoRaWAN end devices where fports can only be changed by modifying, compiling and uploading the new firmware to the end device.

Payload formatters allow you to process data going to and from end devices.
When a binary payload is sent from end device to LoRaWAN network (uplink), the data can be converted using, for example, a Javascript payload formatter.  
The data can be converted to human readable data.

When a message is sent from the LoRaWAN network to the end device (downlink), the message can be converted using, for example, a Javascript payload formatter.  
The message can be converted from human readable data to binary data.

The payload formatters used in the V2 console can not be copy-and-pasted directly in the V3 console.
The V2 and V3 payload formatters are different.
For example, the function names and the function parameters are different.

In the V3 console several payload formatters can be used:
- Javascript payload formatters
 https://www.thethingsindustries.com/d...
- Cayenne Low Power Payload formatters
 https://www.thethingsindustries.com/d...
- Device specific payload formatters
 Device manufacturers may have payload formatters designed to work with their devices.
 https://github.com/TheThingsNetwork/l...

The V3 payload formatters can be applied to an entire application, or to a specific end device.
The payload formatter tester is only available on the device level and not on the application level.

The decodeUplink function has only one function parameter (input) which is a json object.
The encodeDownlink function has only one function parameter (input) which is a json object.
If you specify a downlink formatter the encodeDownlink function is required but not the decodeDownlink function.
The decodeDownlink formats the binary data “bytes” into human readable data, just like the decodeUplink function.

Check out all my other LoRa/LoRaWAN tutorial videos:
LoRa/LoRaWAN tutorials

Subscribe to my YouTube channel:
@mobilefish

The presentation used in this video tutorial can be found at:
https://www.mobilefish.com/developer/...

#mobilefish #lora #lorawan
3 سال پیش در تاریخ 1400/03/17 منتشر شده است.
9,391 بـار بازدید شده
... بیشتر