Events

:

:

Elektronik | Funk | Software

Der Technik-Blog

  • Social Media

    Werbung:


    New Posts


    Events

    • Keine zukünftigen Events vorhanden

    The Tech-Blog

    LoRaWAN Gateway UDP Packet Forwarder

    LoRaWAN UDP Packet Forwarder 1

    Alex @ AEQ-WEB

    This article is about the functionality of the LoRaWAN UDP Packet Forwarder. It is software developed by Semtech for the LoRaWAN gateway, enabling efficient data packet exchange with the network server using the UDP protocol. With a special example code in C++, which functions as a UDP packet listener on port 1700 to receive data from a gateway, received data packets can be displayed. This example allows for a closer analysis of the precise workings of the Semtech Packet-Forwarder, providing a deep insight into the world of LoRaWAN.

    The Gateway

    For this example, a MikroTik LR8 LoRaWAN Gateway is used. The MikroTik LR8 comes with the UDP Packet Forwarder pre-installed, which serves as the interface between the gateway and the LoRaWAN network server. The LoRaWAN gateway operates bidirectionally, meaning it both receives data from the end device and sends it to the LoRaWAN network server via the Packet Forwarder, and vice versa. The network server can communicate with the gateway to send data packets to its end devices through the gateway. In this example, a unique, easily recognizable ID (Gateway EUI) is assigned to the LoRaWAN gateway: AA AA AA AA AA AA AA FF. This ID is immediately identifiable in raw data analysis, making it easy to trace.

    Werbung:

    Raw Data Analysis

    If a simple UDP listener is started on port 1700 on a computer or server, and the IP address is entered in the gateway, the listener typically receives a data packet multiple times per minute. When these data are displayed in plaintext, some "cryptic" characters initially appear, followed by readable information in JSON format. The readable JSON data contains information about the gateway’s status or represents a received LoRaWAN packet. However, first, attention is given to the "cryptic" characters, as seen in the following image:

    The unreadable characters here always have a specific length of 12 bytes. When converted to hexadecimal, the previously assigned Gateway EUI and additional hexadecimal characters become visible:

    Bytes 0 to Byte 11 are always transmitted before each JSON message, and sometimes packets are sent consisting only of these 12 bytes. The Gateway EUI consists of 8 bytes (Bytes 4 - 11), and the bytes are composed as follows:

    Werbung:

    Bytes Description
    Byte 0 Protocol version used (2)
    Byte 1-2 Random token for a packet, generated by the gateway (XXXX)
    Byte 3 Message type (2, Pull Data)
    Byte 4-11 Gateway EUI (AA AA AA AA AA AA AA FF)
    From Byte 12 Message in plaintext/JSON format

    This example uses protocol version 2. Each message from a gateway contains a random token consisting of two bytes. When the network server responds to a message from the gateway, these exact two bytes are sent back, allowing the gateway to match the message. This is mostly used for acknowledgments of receipt.

    The 5 message types (identifiers) are as follows:


    Byte 3 Description
    00 Push Data: According to the gateway settings, push data is sent multiple times per minute. This keeps the port open between routers, gateway, and network server. Additionally, the network server is informed that the gateway is still connected.
    01 Push Ack: A Push Ack (Acknowledged) is sent back from the network server to the gateway with the same token. This provides the gateway with a confirmation of receipt from the network server.
    02 Pull Data: This message type (identifier) informs the network server that a data record (status message or LoRaWAN packet) is attached to the gateway EUI.
    03 Pull Resp: A message with a "Pull Response" allows the network server to send a data packet to an end device via the gateway. This is possible anytime after receiving the first "Pull Data" or "Push Data".
    04 Pull Ack: The network server responds with a "Pull Ack" to each received "Pull Data" packet.
    05 Tx Ack: The gateway confirms the transmission of a data packet to the network server. If the data packet is successfully sent, the data length is exactly 12 bytes. In case of an error, the gateway sends additional error details from byte 12 in JSON format.

    Werbung:

    JSON from Byte 12

    The first 12 bytes in hexadecimal format always precede each JSON message, whether it is sent from the gateway to the network server or vice versa. Further details on the structure of JSON messages can be found in the next article: XXXX


    Info: This page was automatically translated and may contain errors
    122X122

    About the Author

    Alex, the founder of AEQ-WEB. He works for more of 10 years with different computers, microcontroller and semiconductors. In addition to hardware projects, he also develops websites, apps and software for computers.

    Top articles in this category:

    Dragino LHT65 with TTN V3 setup

    Register LHT65 in TTN V3 (OTTA)

    • Video
    • DE/EN

    This article is about the registration of one LHT65 with TTN V3 with OTTA and about the payload decoder necessary for data processing

    read more
    ESP32 LoRa Board LoRaWAN TTN ABP Connect

    LoRaWAN & TTN with ESP32

    • Video
    • DE/EN

    The ESP32 LoRa board from Heltec supports LoRa. This article is about access and data transfer to LoRaWAN & TTN

    read more

    Social Media

    Werbung:


    New Posts


    Events

    • Keine zukünftigen Events vorhanden