Hayes AT Commands (for RAK811 LoRaWAN) with Node-RED using flow (context) functions and variables

Hi,

I would like to share my flow to manage AT sequences (array of AT commands) for RAK811 breakout board.
The RAK811 breakout is a 3.3V LoRaWAN board. It can be connected with a FTDI to a USB port of a PC or a Raspberry Pi SBC. It can also be connected to Rpi UART (Rx/Tx) GPIO (15/14).

The flow is able to manage an array of expected AT answers with an expected timeout for each answer.


Have fun...

Regards,
David


 Download Node-RED Flow

Exemple of AT sequence for LoRaWAN OTAA + Uplink & Downlink :
msg.payload=
[
    {
        "topic": "JOIN OTAA",
        "ATcommand": "at+join=otaa",
        "expectedAnswers": [
            {
                "expected_answer": "OK",
                "wait_time_ms": 2000,
                "error": "Echec authentification otaa (error RAK811)"
            },
            {
                "expected_answer": "at+recv=3",
                "wait_time_ms": 20000,
                "error": "Echec authentification otaa (pas de réponse du concentrateur)"
            }
        ]
    },
    {
        "topic": "SEND & RECEIVE",
        "ATcommand": "at+send=0,2,"+msg.payload,
        "expectedAnswers": [
            {
                "expected_answer": "OK",
                "wait_time_ms": 2000,
                "error": "Echec de la transmission (error RAK811)"
            },
            {
                "expected_answer": "at+recv=2",
                "wait_time_ms": 20000,
                "error": "Echec de la transmission (no answer from network)"
            },
            {
                "expected_answer": "at+recv=0",
                "wait_time_ms": 2000,
                "extractOutput" : true, // answer is a coma separated payload
                "positionInResponse":3, // position of the answer in the payload (0 to X)
                "responseName":"Réponse RX RAK 811 (Downlink Message)",

                "error": "Pas de message RX (downlink) après transmission",
                "errorReport":false //just warn if no answer after timeout
            }

        ]
    }
]
;
return msg;


Commentaires

Posts les plus consultés de ce blog

Suite applicative QRCROSS

Projet TBI-Wii - Installation & Démonstration

Relevé d'informations avant la modélisation... (2013)