RAK13101 WisBlock GSM/GPRS Module Quick Start Guide
Prerequisite
- Assemble the RAK13101 with a WisBlock Base and WisBlock Core by following the RAK13101 Installation Guide.
- Download and install the Arduino IDE, then add the RAKwireless Core boards by installing the RAKwireless Arduino BSP.
- USB Cable
- GNSS and GSM Antennas
- Li-Ion/LiPo battery (optional)
- Solar charger (optional)
Software Configuration and Example
The RAK13101 WisBlock GSM/GPRS Module uses UART serial communication lines. In this example code, you will be able to send AT commands to the RAK13101 module. This will ensure that your RAK13101 is functional and ready for your IoT project.
NOTE
- This guide uses the RAK4631 WisBlock Core to demonstrate the configuration and upload process. The example is also compatible with other WisBlock Cores, including the RAK11200 and RAK11310.
- When using RAK11200 as WisBlock Core, configure the BOOT0 pin properly before uploading the firmware. Incorrect BOOT0 configuration may cause the firmware upload to fail. For more information, refer to the RAK11200 Quick Start Guide.
- You need to select first the WisBlock Core you have.
Figure 1: Selecting RAK4631 as WisBlock Core- Next, copy the following sample code into your Arduino IDE:
Click to view the example
/**
@file Unvarnished_Transmission.ino
@author rakwireless.com
@brief unvarnished transmission via USB
@version 0.1
@date 2021-6-28
@copyright Copyright (c) 2020
**/
#include <Wire.h>
#define POWER_KEY WB_IO5
void setup()
{
time_t serial_timeout = millis();
Serial.begin(115200);
while (!Serial)
{
if ((millis() - serial_timeout) < 5000)
{
delay(100);
}
else
{
break;
}
}
Serial.println("AT CMD TEST!");
// Check if the modem is already awake
time_t timeout = millis();
bool moduleSleeps = true;
Serial1.begin(9600);
delay(1000);
Serial1.println("ATI");
//MC20 init
while ((millis() - timeout) < 6000)
{
if (Serial1.available())
{
String result = Serial1.readString();
Serial.println("Modem response after start:");
Serial.println(result);
moduleSleeps = false;
}
}
if (moduleSleeps)
{
// Module slept, wake it up
pinMode(POWER_KEY, OUTPUT);
digitalWrite(POWER_KEY, 0);
delay(200);
digitalWrite(POWER_KEY, 1);
delay(2000);
digitalWrite(POWER_KEY, 0);
delay(1000);
}
Serial.println("MC20 power up!");
}
void loop()
{
int timeout = 100;
String resp = "";
String snd = "";
char cArr[128] = {0};
while (timeout--)
{
if (Serial1.available() > 0)
{
resp += char(Serial1.read());
}
if (Serial.available() > 0)
{
snd += char(Serial.read());
}
delay(1);
}
if (resp.length() > 0)
{
Serial.print(resp);
}
if (snd.length() > 0)
{
memset(cArr, 0, 128);
snd.toCharArray(cArr, snd.length() + 1);
Serial1.write(cArr);
delay(10);
}
resp = "";
snd = "";
}
- You can now select the right serial port and upload the code.
Figure 1: Selecting the correct Serial Port
Figure 1: Uploading the RAK13101 example codeNOTE
If you experience any error in compiling the example sketch, check the updated code for the RAK13101 Module that can be found on the WisBlock Example Code Repository.
- When you successfully uploaded the example sketch, open the Serial Monitor of the Arduino IDE to see the initial logs. If you do not see any logs, you can try to disconnect the USB cable and battery, then reconnect again with the battery first. If you see that the LED of the RAK13101 is blinking after a few seconds, the module is now initialized properly.
Figure 1: RAK13101 initial logs- There are times that you might not see the initial logs if you open the Serial Monitor. The best way to test if the module is working is by sending actual AT commands. You can try to send the basic commands,
ATandATI.
Figure 1: RAK13101 AT and ATI command