How can I use this…

Just over a week ago I purchased a RAK811 LPWAN Evaluation Board -AS923 and now I want to trial it with selection of devices and configurations.

Initially I didn’t want to modify the shield by removing resistors as I only have one, and I’m not certain what device(s) it will be used with. The initial hardware configuration required jumpers for the serial port, ground and 5V power.

Arduino Uno R3 and RAK811 LPWAN Evaluation board 5V config

After looking at the schematic it should be possible to use the shield with a 3v3 device.

RAK 811 EVB schematic pg1
RAK 811 EVB schematic pg2

I confirmed this with a Seeeduino V4.2 devices set to 3v3, by putting a jumper on J1 and shifting the jumper wire from the 5V to the 3V3 pin.

Seeeduino V4 and RAK811 LPWAN Evaluation board 3V3 config

The next step was to see how I could get the RAK shield working on other devices without jumpers. On Arduino Uno R3 devices D0&D1 are the hardware(HW) serial port which are used for uploading sketches, and diagnostic logging.

The shield also connects the module serial port to D0&D1 to D10&D11, so by removing R17&R19 the shield should work on a device This would also allow the use of the Serial Peripheral Interface(SPI) port for other applications.

Using the HW Serial port but without any logging.

Unplugging the jumpers to upload was painful but the lack of logging made it really hard to debug my code.

To get around this I configured a SoftwareSerial port on D2&D3 for logging.

 * This demo is only supported after RUI firmware version on RAK811
 * Master Board Uart Receive buffer size at least 128 bytes. 
//#define SERIAL_BUFFER_SIZE 128
//#define _SS_MAX_RX_BUFF 128
#include "RAK811.h"
#include "SoftwareSerial.h"
#define WORK_MODE LoRaWAN   //  LoRaWAN or LoRaP2P
#define JOIN_MODE OTAA    //  OTAA or ABP
String DevEui = "..."; // From TTN
String AppEui = "...";
String AppKey = "...";
#else JOIN_MODE == ABP
String NwkSKey = "...";
String AppSKey = "...";
String DevAddr = "...";

#define TXpin 3   // Set the virtual serial port pins
#define RXpin 2

SoftwareSerial DebugSerial(RXpin,TXpin); // Declare a virtual serial port for debugging
#define ATSerial Serial

char buffer[]= "48656C6C6F20776F726C6435";

bool InitLoRaWAN(void);
RAK811 RAKLoRa(ATSerial,DebugSerial);

void setup() {
  ATSerial.begin(9600); //set ATSerial baudrate:This baud rate has to be consistent with  the baud rate of the WisNode device.

  if(!RAKLoRa.rk_setWorkingMode(0))  //set WisNode work_mode to LoRaWAN.
    DebugSerial.println(F("set work_mode failed, please reset module."));
  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.")); 

  DebugSerial.println(F("Start to join LoRaWAN..."));
  while(!RAKLoRa.rk_joinLoRaNetwork(60))  //Joining LoRaNetwork timeout 60s
    DebugSerial.println(F("Rejoin again after 5s..."));
  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.")); 

bool InitLoRaWAN(void)
  if(RAKLoRa.rk_setJoinMode(JOIN_MODE))  //set join_mode:OTAA
    if(RAKLoRa.rk_setRegion(0))  //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 < 300000L;)
    for (unsigned long start = millis(); millis() - start < 10000L;)
      String ret = RAKLoRa.rk_recvData();
      if(ret != NULL)
        DebugSerial.println("ret != NULL");
        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

I used an FTDI module I had lying around to connect the diagnostic logging serial port on the test rig to my development box.

Using the HW Serial port but with logging.

Now I only had to unplug the jumpers for D0&D1 and change ports in the Arduino IDE. One port for debugging the other for downloading.

Depending on the application I may remove R8 so I can manually reset the shield.