NMCC and Nicholas. Thank you for your replies. I have been through all the references and have learnt heaps. However, Iām still a bit stuck. Leaving aside mounting the Wisnode on a Mega, I have managed to get the standalone Wisnode to join my gateaway/TTN The join request was acknowledged/established the moment I put a payload into the node;
at+send=lora:1:12345678
So my next question is how do I put a ārealā payload into the node?
I have this piece of code from the RAKWireless/WisNode-Arduino-Library
/********************************************************
- This demo is only supported after RUI firmware version 3.0.0.13.X on RAK811
- Master Board Uart Receive buffer size at least 128 bytes.
********************************************************/
#include āRAK811.hā
#include āSoftwareSerial.hā
#define WORK_MODE LoRaWAN // LoRaWAN or LoRaP2P
#define JOIN_MODE OTAA // OTAA or ABP
#if JOIN_MODE == OTAA
String DevEui = ā8680000000000001ā;
String AppEui = ā70B3D57ED00285A7ā;
String AppKey = āDDDFB1023885FBFF74D3A55202EDF2B1ā;
#else JOIN_MODE == ABP
String NwkSKey = ā69AF20AEA26C01B243945A28C9172B42ā;
String AppSKey = ā841986913ACD00BBC2BE2479D70F3228ā;
String DevAddr = ā260125D7ā;
#endif
#define TXpin 11 // Set the virtual serial port pins
#define RXpin 10
#define DebugSerial Serial
SoftwareSerial ATSerial(RXpin,TXpin); // Declare a virtual serial port
char buffer[]= ā72616B776972656C657373ā;
bool InitLoRaWAN(void);
RAK811 RAKLoRa(ATSerial,DebugSerial);
void setup() {
DebugSerial.begin(115200);
while(DebugSerial.available())
{
DebugSerial.read();
}
ATSerial.begin(9600); //set ATSerial baudrate:This baud rate has to be consistent with the baud rate of the WisNode device.
while(ATSerial.available())
{
ATSerial.read();
}
if(!RAKLoRa.rk_setWorkingMode(0)) //set WisNode work_mode to LoRaWAN.
{
DebugSerial.println(F(āset work_mode failed, please reset module.ā));
while(1);
}
RAKLoRa.rk_getVersion(); //get RAK811 firmware version
DebugSerial.println(RAKLoRa.rk_recvData()); //print version number
DebugSerial.println(F(āStart init RAK811 parametersā¦ā));
if (!InitLoRaWAN()) //init LoRaWAN
{
DebugSerial.println(F(āInit error,please reset module.ā));
while(1);
}
DebugSerial.println(F(āStart to join LoRaWANā¦ā));
while(!RAKLoRa.rk_joinLoRaNetwork(60)) //Joining LoRaNetwork timeout 60s
{
DebugSerial.println();
DebugSerial.println(F(āRejoin again after 5sā¦ā));
delay(5000);
}
DebugSerial.println(F(āJoin LoRaWAN successā));
if(!RAKLoRa.rk_isConfirm(0)) //set LoRa data send package type:0->unconfirm, 1->confirm
{
DebugSerial.println(F(āLoRa data send package set error,please reset module.ā));
while(1);
}
}
bool InitLoRaWAN(void)
{
if(RAKLoRa.rk_setJoinMode(JOIN_MODE)) //set join_mode:OTAA
{
if(RAKLoRa.rk_setRegion(5)) //set region EU868
{
if (RAKLoRa.rk_initOTAA(DevEui, AppEui, AppKey))
{
DebugSerial.println(F(āRAK811 init OK!ā));
return true;
}
}
}
return false;
}
void loop() {
DebugSerial.println(F(āStart send dataā¦ā));
if (RAKLoRa.rk_sendData(1, buffer))
{
for (unsigned long start = millis(); millis() - start < 90000L;)
{
String ret = RAKLoRa.rk_recvData();
if(ret != NULL)
{
DebugSerial.println(ret);
}
if((ret.indexOf(āOKā)>0)||(ret.indexOf(āERRORā)>0))
{
DebugSerial.println(F(āGo to Sleep.ā));
RAKLoRa.rk_sleep(1); //Set RAK811 enter sleep mode
delay(10000); //delay 10s
RAKLoRa.rk_sleep(0); //Wakeup RAK811 from sleep mode
break;
}
}
}
}
The payload sits here -
char buffer[]= ā72616B776972656C657373ā;
(1) How do I, for instance, get sensor data into here?
(2) And while Iām at it, how do I get that code above into my Wisnode?
Iāll bet thatās pretty simple for someone, but right now, not for me.
Many thanks. Regards.