Class C Walkthrough

LoRa Class C Example

Overview

LoRa motes in class A will only listen for incoming data immediately after it transmits.
If you want the mote to be able to receive data at other times, the mote will need to be in class C. Class C allows the mote to listen for incoming data any time it isn’t transmitting. Class C mode will use much more power, since it is always listening, and must be awake to listen.

Below is quick start guide to setting up Class C on an AEP and a Dot with AT firmware.

 

Configuring LoRa on Conduit AEP

Login and go to Lora Network Server in Setup.
Click Reset to Default to get in a known state.
Set the Frequency Sub Band.
Set the Network ID to Name and enter a Name below.
Set the Network Key to Passphrase and enter a passphrase below.
Set the Default Profile to DEFAULT-CLASS-C (AEP 1.6.2 and above).
Click Submit.

 

Configuring the Dot (xDot or mDot)

AT&F to put in known state.
AT+FSB=1 (set frequency sub band to match the Conduit)
AT+NI=1,BDconduit (set network ID passphrase to match Conduit)
AT+NK=1,BDconduit (set network Key passphrase to match Conduit)
AT+DC=C (set Dot to Class C)
AT&W to save settings.
AT+JOIN to connect to Conduit.
AT+SEND to acknowledge Join Accept.
AT+SEND to acknowledge first downlink MAC commands
AT+SD to switch to serial mode. Use +++ sequence to escape serial mode.

 

Check Node Class in Statistics

Login and click on Statistics.
Select the LoRa tab.
Find the Node for the Dot you had join the network. If you aren’t sure which node is the Dot, check the Device ID on the Dot with an AT&V command and match this to the Node list’s EUI. Most likely the Class will be “A”. This is the default class for a new node.

 

Change an to Class C (AEP 1.6.4)

LoRaWAN > Devices
Edit Device Row
Set Network Profile to DEFAULT-CLASS-C

 

Change an to Class C (AEP 1.4.16)

LoRaWAN > Device Configuration
Edit Device Row
Change Class to C

 

Change an Existing Node to Class C (AEP 1.4.3)

SSH into the Conduit (default IP: 192.168.2.1, default credentials: admin/admin)
Enter the command “lora-query –n” to list the current nodes. Note the Net Addr of the Dot in the node list.
Enter the command “lora-query –node-update 00000001 class C” to set the Dot’s node to class C.
Note: replace the 00000001 value with the Net Addr of the Dot (without the colons).
Enter the command “lora-query –n” to list the current nodes and verify that the Dot node is now listed as class C.
For more information and examples see following link:
https://www.multitech.net/developer/software/lora/lora-network-server/

 

Sending to Class C Dots in Node-Red

An uplink is needed for the network server to know that the device has received the Join Accept message.
The first down link after Join contains MAC commands and will need to be ACK’d with another uplink before Class C downlinks will be sent freely.

When sending a message to the Node-Red Lora Out node, the msg.eui value must be set on the msg object sent, otherwise the Conduit won’t know which Dot the message is for and won’t be able to send it. It is possible have the Lora Out set to only send to a specific eui value, but setting the msg.eui of the msg object will allow you to send to multiple Dots using the same Lora Out.

When a message is received from Lora In, the msg.eui value is automatically set as the sender, so this message can be successfully sent to Lora Out without setting the msg.eui value.

When sending a Class C message the msg.eui value usually needs to be set manually.
A function node can be used to set the msg.eui before sending it out the lora output node.

In the flow below we will setup an Inject node to output a string message. We will then use a Function node to modify the msg object’s msg.eui value with our Dot’s EUI. We will then output this message to the Lora output node which will transmit the message and the Dot will detect that the message is for it.

 

Setting Up a Simple Class C Node-Red Flow

Launch Node-Red.
Add an Inject node from the Input section.
Modify the Inject node:
Set Payload to String
Enter a message such as Hello
Leave Repeat set as None.
Add a Function node from the Function section.
Modify the Function node to the following:
msg.eui = “008000000400001b”
return msg;
(Change the msg.eui value to the EUI of the Dot. You can copy and paste the EUI from the Conduit’s LoRa statistics Node List, removing the dashes.)
Connect the Inject node to the input (left side) of the Function node.
Add a Lora node from the Output section.
Connect the output from the Function node to the Lora output node.

 

Troubleshooting

Make sure that the Conduit is showing the Node as a Class C in its Node List. The Conduit will wait until it receives a transmit from the Dot before sending if it thinks the Node is class A.
Make sure that in your Node-Red flow, the msg.eui value is getting set to the Device EUI of the Dot you wish to send to. Without the msg.eui being set, it will still behave like a Class A and only send the message to the Dot after the Dot transmits to the Conduit.When using the AT firmware, the Dot must be in a serial mode that allows it to output the incoming messages as they are received. When using the AT firmware, use the AT+SD command to put it in serial mode. Note that a +++ will escape out of serial mode so you can issue AT commands again.

Installing Node-Red Flow from Clipboard

Open the Class_C_Clipboard_Flow.txt file, select and copy the entire text for the flow.
In Node-Red, click on the Menu option (3 horizontal lines stacked), hover over Import and select the Clipboard option that then pops up.
In Import Nodes dialog that pops up, paste the previously copied text and click OK.

 

Installing Node-Red flows.json File

Use a SCP Client (such as WinSCP), connect to the Conduit using the admin credentials, navigate to the “/var/config/app/install/development/” folder and then upload the flows.json file from you PC to the Conduit, overwriting the existing file.
Afterwards restart Node-Red or reboot the Conduit.