Hi friends, Please someone that can give me support, I need to send a downlink message from TTN LNS, and I want activate a relay, if someone has a example of sketch to RAK11300 module in Arduino IDE, how to receive information in the Module.
You can use the example sketch of LoRaWAN_OTAA_ABP in RAK11300. Then modify the lorawan_rx_handler.
Something like this:
void lorawan_rx_handler(lmh_app_data_t *app_data)
{
Serial.printf("LoRa Packet received on port %d, size:%d, rssi:%d, snr:%d, data:%s\n",
app_data->port, app_data->buffsize, app_data->rssi, app_data->snr, app_data->buffer);
uint8_t relay_command = *app_data->buffer;
if(relay_command==1)
{
Serial.println("LED on");
// Make relay on here
}
else
{
Serial.println("LED off");
// Make relay off here
}
}
As you see here, I added the variable relay_command. In this sketch, sending value 0x01 will turn on the LED. Then, any other value will turn if off.
Thank you very much Carl, now with that example I can send messages downlink to my Board with RAK11300 module, I will be showing the PCB reading to energy meter with several electric parameters and doing actions to cut electrical service and re connect the electrical service.
I am sending information to LNS (TTI), but I am facing that issue:
When I try to send that frame:
01A203020100A305A103020107E60918060D2114000000000000012C000000000000000000000000000001900000005C000000000000000000002E1800000000000003E80000177300000000
That frame contains all information from energy meter, but I am not send the frame whole, I have to cut the frame for example: 01A203020100A305A103
when I try to send 10 or more bytes I got error:
lmh_send fail count 8
Sending frame now…
lmh_send fail count 9
Sending frame now…
lmh_send fail count 10
Sending frame now…
lmh_send fail count 11
when I cut the frame I got success:
Sending frame now…
lmh_send ok count 13
TX finished
Sending frame now…
lmh_send ok count 14
TX finished
Sending frame now…
lmh_send ok count 15
TX finished
I am using the method in the example sending: Hello!
For the send error, it can have multiple sources.
How often do you try to send the message?
Is ADR enabled?
Which example code are you using? The one that is coming with the Arduino BSP or the example from our WisBlock Github repo