I can't Send message from rak831 to rak811

How can ı send message from rak831 to my rak 811. please help me.

Can you tell me which server you are using? Does he work in classC or class A?

I just sent a message from rak811 to rak 831. i use ttn. i am beginner. i dont know class or class c. can you help me? What should i use?

Downlink will appear through ttn’s node interface, and data can be distributed.

I know this. But i want to send data from rak831 to rak811. Without using ttn.

Only the tested data can be sent through RAK831, but the node cannot recognize the data and needs to send and receive it through a server.

So my server is ttn or i should use lora server. Which one?

Both are possible, depending on your personal needs.

I did downlink. but just one. I can’t understand this. I give my source code. please help me.

#include “RAK811.h”
#include “SoftwareSerial.h”

#define WORK_MODE LoRaWAN
#define JOIN_MODE OTAA

String DevEui = “00000000000000000”;
String AppEui = “00000000000000000”;
String AppKey = “0000000000000000000000000000”;

#define TXpin 11
#define RXpin 10
#define ATSerial Serial
SoftwareSerial DebugSerial(RXpin, TXpin);

RAK811 RAKLoRa(ATSerial, DebugSerial);

char* buffer = “BB”;

bool InitLoRaWAN(void)
{
if (RAKLoRa.rk_setWorkingMode(WORK_MODE))
{
if (RAKLoRa.rk_initOTAA(DevEui, AppEui, AppKey))
{
DebugSerial.println(“You init OTAA parameter is OK!”);
while (RAKLoRa.rk_joinLoRaNetwork(JOIN_MODE))
{
bool flag = false;
for (unsigned long start = millis(); millis() - start < 90000L;)
{
String ret = RAKLoRa.rk_recvData();
if (ret.startsWith(STATUS_JOINED_SUCCESS))
{
DebugSerial.println(“You join Network success!”);
return true;
}
else if (ret.startsWith(STATUS_RX2_TIMEOUT) || ret.startsWith(STATUS_JOINED_FAILED))
{
DebugSerial.println(“You join Network Fail!”);
flag = true;
DebugSerial.println(“The device will try to join again after 5s”);
delay(5000);
}
}
if (flag == false)
{
DebugSerial.println(“Pleases Reset the module!”);
delay(1000);
return false;
}
}
}
}
delay(1000);
return false;
}

void ttn_send()
{
unsigned char tries = 0;
while (true)
{
if (RAKLoRa.rk_sendData(1, 1, buffer)) {
Serial.println(“Message sent correctly!”);
return;
}

    tries++;
    if (tries > 3) break;

    Serial.println("Error, trying again...");
    delay(5000);
}
Serial.println("Error sending message :(");

}

void ttn_receive() {

// at+recv=<status>,<port>[,<rssi>][,<snr>],<len>[,<data>]\r\n
// STATUS_RECV_DATA == 0
String r = RAKLoRa.rk_recvData();
if (r.length()) 
{
    Serial.print("Response: ");
    Serial.println(r);

    if (r.startsWith("at+recv=0,")) 
    {
        bool state = r.endsWith(",31");  
    }

}
}

void setup()
{
DebugSerial.begin(115200);
while(DebugSerial.read() >= 0){}
while(!DebugSerial);
DebugSerial.println(“Basladi - UP”);

ATSerial.begin(115200);
delay(100);
DebugSerial.println(RAKLoRa.rk_getVersion());
delay(200);
DebugSerial.println(RAKLoRa.rk_getBand());
delay(200);

while(!InitLoRaWAN());
}
int i=0;
void loop()
{
static unsigned long last = 0;
if ((last == 0) || (millis() - last > 6000)) {
last = millis();
ttn_send();
}
delay(2000);
ttn_receive();
delay(2000);

}

In classA mode, only one uplink data is required to obtain one data to be sent. According to your log, you can see that one data has not been successfully sent and has been retransmitted. If the data is sent again, there will be an error prompt.

ı understand you. but if ı don’t downlink, all data is send. if ı doing downlink just one send data ,No more data is going.ı can’t understand this.

In classA mode, a window will be opened after an uplink data, and it will be automatically closed after a period of time. The receiving window must be opened again through a new uplink data before receiving can continue.

So how can ı this ? connect and disconnect ?

I don’t understand what you mean, maybe this can help you, abp mode, otaa mode, which can directly send data, must be joined first

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.