We have seen quite a lot of projects on the RAK itracker and I definitely had a blast using this board to its full potential. With some many on board sensors and connectivity option, this is a beast of a board and definitely a complete solution in the TRACKER BOARD department. 5/5 for that.
This tutorial will only cover the GPRS parts of the board. You can also get the NB-IoT or Cat M ability by creating your own firmware based on the testing source code provided by RAKWireless on their GitHub page: https://github.com/RAKWireless/RAK8212-itracker-firmware-based-on-nRF5SDK15.0.0-with-DFU
OK, let’s jump in.
What is RAK8212itracker?
RAK8212 itacker module is versatile developer board aimed at aiding in quick prototypes using NB-IoT. The board includes a vast array of connectivity options (NB-IoT, BLE 5.0 and GPS) and sensors like an accelerometer, a light sensor and a barometric sensor.At the heart of the module is the venerable Nordic nRF52832 BLE processor. The NB-IoT connectivity is provided by the Quectel BG96 module. The RAK8212 module is Arduino friendly and can be programmed using the IDE. The board also provides SWD interface for programming the nRF52832 core. The combination of BLE and NB-IoT provides flexible low power consumption development along with myriad of application option ranging from telemetry to live tracking and environment sensing. With RAK8212 tracker board the sky is the limit for your ideas !! RAK8212 has some features as follow:
Ø Arduino Compatible – Host controller nRF52832 has been widely used in Arduino environment.
Ø Integrated Quectel BG96 NB-IoT wireless communication Module, with GPS built-in.
Ø Integrated LIS3DH ultra low-power, high performance 3-axes “nano” accelerometer.
Ø Integrated LIS2MDL ultra-low-power, high-performance 3-axis digital magnetic sensor.
Ø Integrated BME280 ultra low-power, high linearity, high accuracy sensors for pressure, humidity and temperature.
Ø Integrated OPT3001 that measures the intensity of visible light.
Ø Size 43mm x 38mm x 18mm.
Ø Operation temperature -40°C to +85°CØ Power supply 3.5V to 18V (power at solar panel connector P2).
You can get more detail about RAK8212 from here: http://www.rakwireless.com/en/download/RAK8212/Hardware%20Design
What is BG96?
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module offering a maximum data rate of 300 Kbps down link and 375 Kbps up link. It features ultra-low power consumption, and provides pin-to-pin compatibility with Quectel LTE module EG91/EG95, Cat NB1 (NB-IoT) module BC95, UMTS/HSPA module UG95/UG96 and GSM/GPRS module M95.
According to the Hologram website:
Hologram provides flexible tools for securely connecting IoT devices. Whether you're deploying at scale or building your first connected product, Hologram's products handle all your connectivity infrastructure needs.
Hologram provides the cellular connectivity across continents to enable GSM connectivity for your end devices. It’s really cool. They support NB-IoT wherever the services are enabled (sadly in India, NB-IoT is yet to reach mainstream public consumption).However, in countries like China, USA, you can use the sim for NB-IoT connectivity as well (do check the coverage for narrow-band connectivity before going in for the NB-IoT options.)
Let’s get started !!!
First,programthe firmware of RAK8212
RAKWireless provides a whole firmware which is an example for RAK8212 module on their GitHub page:
This firmware is based on the newest nRF5 SDK 15.0.0 and Softdevice S132 v6.0.0. It includes a Softdevice S132 V6.0.0, a bootloader supported OTA-DFU, and an application for RAK8212 module. You can use this firmware directly on RAK8212 module to send “hello world” to Hologram online service via GPRS. You can also send any data from RAK8212 module to anyone via NB-IoT or Cat M easily by developing your own firmware according to the source code of the example firmware provided by RAKWireless on their GitHub page.
Before our starting, we should install nRFgo Studio on our PC. It is a programing tool provided by Nordic. Surely, you can use any other programing tools too.
Program the firmware provided byRAKWireless to RAK8212 module directly
Firstly, let’s download the firmware from RAKWireless page( https://github.com/RAKWireless/RAK8212-itracker-firmware-based-on-nRF5SDK15.0.0-with-DFU), and find out the firmware file “RAK8212_ALL.hex”, which is in the folder “Firmware hex for SWD” and will be used to program into RAK8212 module soon.
Secondly, let’s select a programing method. There are two methods you can select: SWD interface and OTA-DFU.
If there is no firmware on your RAK8212 module, you must select this method for programing. You can also select this method surely even if there is already a firmware on your RAK8212 module.
According to the picture above, we connect RAK8212 module with PC via ARM Emulator, and open nRFgo Studio on our PC. Then we select “nRF5x programing” in the Device Manager panel, and the following UI will be shown in front of us:
We can click the “Erase all” button to erase the firmware which had been programed into our RAK8212 module before, and it doesn’t matter that we start to program without erasing the old firmware.
Now, let’s program the firmware:
Click the “Browse”button and select the firmware file which is a.hex file;
Click the “program”button to start;
RAKWireless provides a bootloader for RAK8212 module which is included in the firmware provided by RAKWireless on their GitHub page: https://github.com/RAKWireless/RAK8212-itracker-firmware-based-on-nRF5SDK15.0.0-with-DFU, and this bootloader provides the DFU function.
We can program the firmware for RAK8212 module via BLE OTA with the nRF Toolbox app (Android: 1.17 or later, iOS: 4 or later)or the nRF Connect app (4.4 or later, Android only at this time) when it works in the DFU mode.
Note: Only if the DFU button of the RAK8212 module is pressed during the module startup, it will work in the DFU mode.
To protect the target device against malicious attackers trying to impersonate the rightful sender of the firmware update, the init packet of the firmware package must be signed.
You can either create your own firmware package or use the testing package “rak8212_iTracker_all.zip” provided by RAKWireless in the folder “ Firmware Zip for OTA-DFU”. This testing package includes Softdevice, bootloader, and application. You must note that this DFU package can be used only when the old Softdevice in the RAK8212 module is S132 V6.0.0. In the same folder, there is another testing package “rak8212_iTracker_app.zip”, which is only an application part package. These packages have been generated using a private key that corresponds to the default public key in the provided firmware.This public key must not be used in production.
You can program the firmware via OTA-DFU according the following steps:
a. Transfer the zip firmware package that you want to upload to the mobile device:
§ On iOS: Connect the mobile device to your computer and open iTunes. Select the mobile device and then Apps > nRFToolbox (or nRF Connect). Then you can drag and drop a file directly into the application's internal storage. Alternatively, send an email attachment to the app from the mobile device itself. See the app's documentation for more information.
§ On Android: Connect the mobile device to your computer. Enable file transfer between the computer and the device and copy the zip file into a folder of your choice.
b. Use the nRF Toolbox or nRF Connect app to select a target device and a zip package and to start the process.
Observe that the device resets and runs the new application, bootloader, or SoftDevice.
Creating your own firmware
If you want to create your own firmware package for a project, you must pay attention to the following things:
To protect the target device against malicious attackers trying to impersonate the rightful sender of the firmware update, the init packet of the firmware package must be signed, So you need to create a private key and public key for your firmware.
Firstly, you may need to install nrfutil which is a Python package and command-line utility that supports Device Firmware Updates (DFU)and cryptographic functionality.Installing nrfutil
You can install nrfutil from the Python Package Index (PyPI) or you can run or install it from the sources. In this tutorial, we Install nrfutil from PyPI.
Firstly, the following prerequisites must be installed:
· Python 2.7 (2.7.6 or later, but not Python 3)
· pip (it has been included in Python 2.7 package)
nrfutil is available as a package in the Python Package Index(PyPI) and can be downloaded and installed directly using the Python installer program pip.
Enter the following command to install the latest published version from PyPI:
pip install nrfutil
This command installs nrfutil and all required packages.
Refer to the description in the following web link for more detail: http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.tools%2Fdita%2Ftools%2Fnrfutil%2Fnrfutil_installing_from_pypi.htmlCreate a private key and public key for your project
Note: The private key should be kept with very limited distribution, because it can be used to create valid firmware images to update your device. It must never be lost, because without the key, there is noway to create new DFU images
The following commands use nrfutil to generate keys based on the secp256r1 curve:
# Generate a private key in c:\vault\priv.pem
nrfutil keys generate c:\vault\priv.pem
# Display the public key that corresponds to the generated private key
# (in code format to be used with DFU)
nrfutil keys display --key pk --format codec:\vault\priv.pem
Let’s store the generated content into a file named dfu_public_key.c.
Copy the dfu_public_key.c file to the bootloader project folder, replacing the existing file.
OK, Let’s try to connect to Hologram online service!
How to use Hologram online service
Visit the official website of Hologram. Click on"DASHBOARD" in the upper right corner @ Hologram.io and create your account.
Then click on "sign up" at the bottom of the page. Enter the registration interface. Follow the prompts to fill in the information to register.
Activate SIM card
After successful registration, log into your Hologram account and enter your Dashboard interface. Next you need to activate your purchased Hologram SIM card. Click on "Activate you first SIM" in the upper right corner of the page.
Enter the activation interface, according to the given prompts, fill in the information, you can complete the activation of the SIM car
After successful registration, enter the SIM card information interface. After waiting for a period of time, you will seethe “Live” status.
your sim is now activated. You can start using your sim to now send and receive data. you can also use it for SMS send and receive as well. Make sure you check out the FUP for your plans and use the features accordingly to avoid additional costs.
Send “Hello World” to Hologram via GPRS
Now, let’s try to send some data from RAK8212 itracker to Hologram via GPRS.
Great! We can see some “Hello World” just sent by us on the Hologram web page.