RAK WisBlock
Rapidly prototype hardware with the new modular hardware solution from RAK wireless.
In order to assist our customers with a short time to market, we partnered with RAKwireless and are providing support for the deployment of their hardware.
WisBlock Kit

WisBlock Kit

WisBlock is a modular system that makes it easy to implement low power wide area network (LPWAN) into your IoT solution by Rakwireless.
For now, the core available for the WisBlock system has an nRF52840 Bluetooth microcontroller along with a LoRa radio which makes a good low power pair that also provides options for implementing provisioning over BLE.
Included in the baseboard is the circuitry for battery charging, solar charging, USB, LEDs, and expansion slots for various sensors or IO blocks with the ability to cut power to both.
The Starter Kit also contains sensors for temperature/humidity, acceleration, light, barometric pressure, and environment (temperature, humidity, eCO2 combined) along with a set of IO modules for RS485, cellular CAT-M/CAT-MB2, Wi-Fi, current measurement, analog inputs, and expansion.

Arduino IDE/PlatformIO Setup

Instructions for setting up either the Arduino IDE or PlatformIO are available here and will be kept up to date by RAK. If using Arduino the setup is like any board with a board URL pointing to:
1
https://raw.githubusercontent.com/RAKwireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless_index.json
Copied!

Learning by Example

We at Qubitro have prepared a working example for people just unboxing WisBlocks to get started with if making a sensor node. We chose to use PlatformIO since it allows our example to automatically download all dependencies, and we get the features of VSCode. Note it should also work with Arduino if main.cpp is renamed to wisblockQubitroNodeExample.ino.
GitHub - qubitro/wisblock-sensornode-example: A basic LoRaWAN sensor node example made with RAK WisBlocks
GitHub
Qubitro WisBlock Sensor Node Example
First either download or clone the GitHub repository and open the folder in VSCode after installing the PlatformIO extension.
1
https://github.com/qubitro/wisblock-sensornode-example
Copied!
PlatformIO tool buttons should appear on the bottom of the screen, and pressing the checkmark will compile the project for the first time, downloading all required dependencies.
PlatformIO Toolbar
Within the project, there are three major files: main.cpp: Contains the main application code and LoRaWAN handlers. main.h: For selecting the active sensors and bits for linking. sensors.cpp: Contains functions for reading and handling the selected sensors.
Depending on what sensors are attached to the WisBlock base, comment the #define statements out to describe a sensor not connected.
Following that, the device EUI, application EUI, and application key can be populated from The Things Network, or a self-hosted The Things Stack (On The Things Stack dashboard, there is a handy button in the text boxes for these values that encodes them to a C-like-array which makes it easy). Below the LoRaWAN information and sensor selection, sensor power gating can be disabled, and the poll time can be adjusted from its ten-minute default.
With the arrow button in the PlatformIO toolbar, the application will be uploaded to the WisBlock Core, and either on the serial port open or in 20 seconds, the hardware will initialize and connect to a nearby public LoRaWAN gateway. If the green LED stays on, and blue flashes, there is a hardware initialization issue with one of the sensors.
This Qubitro example is based on the RAK examples in order to provide a pleasant experience to use out of box experience on the Qubitro platform, and show a good example of all the concepts used at once which can be easily extended or copied from for your own application.
The two Qubitro nodes using this example with their gateway

The Things Stack Formatter

To format the data from this example node, the following formatting code can be applied to the things stack which is composed of some of the basics shown in the LoRaWAN section. This can either be for the entire TTN application from the applications uplink payload decoder tab or just for the device by using the payload formatter on the device tab.
The formatter follows a very basic packet format, where the first byte contains a flag for each bit, each bit representing sensor data being present in the packet, followed by a 16-bit battery voltage value, followed by sensor values each 32-bits.
1
function decodeUplink(input) {
2
var data = {};
3
var events = {
4
1: "setup",
5
2: "interval",
6
};
7
8
function bytesToFloat(bytes) {
9
// Taken from SO, sorry for not linking, but we need to do this because js is weird
10
var bits = bytes[3]<<24 | bytes[2]<<16 | bytes[1]<<8 | bytes[0];
11
var sign = (bits>>>31 === 0) ? 1.0 : -1.0;
12
var e = bits>>>23 & 0xff;
13
var m = (e === 0) ? (bits & 0x7fffff)<<1 : (bits & 0x7fffff) | 0x800000;
14
var f = sign * m * Math.pow(2, e - 150);
15
return f;
16
}
17
18
// Temp data is present
19
if ((input.bytes[0] & 0x1) > 0) {
20
data.temp = bytesToFloat(input.bytes.slice(3,7));
21
}
22
// Humidity data is present
23
if ((input.bytes[0] & 0x2) > 0) {
24
data.humidity = bytesToFloat(input.bytes.slice(7,11));
25
}
26
// Pressure data is present
27
if ((input.bytes[0] & 0x4) > 0) {
28
data.pressure = bytesToFloat(input.bytes.slice(11,15));
29
}
30
// Gas data is present
31
if ((input.bytes[0] & 0x8) > 0) {
32
data.gas = 0;
33
for (i = 0; i < 4; i++) {
34
data.gas = (data.gas << 8) | input.bytes[18-i];
35
}
36
}
37
// Light data is present
38
if ((input.bytes[0] & 0x10) > 0) {
39
data.light = bytesToFloat(input.bytes.slice(19,23));
40
}
41
// Accl data is present
42
if ((input.bytes[0] & 0x20) > 0) {
43
data.accel = bytesToFloat(input.bytes.slice(23,27));
44
}
45
46
for (i = 0; i < 2; i++) {
47
data.battery = (data.battery << 8) | input.bytes[2-i];
48
}
49
data.battery = data.battery / 1000;
50
51
return {
52
data: data,
53
warnings: [],
54
errors: [],
55
event: events[input.fPort]
56
};
57
}
Copied!

Monitor Data

Qubitro automatically syncs devices and device data from The Things Stack.
Click on device/s to visualize data as seen on the following screenshot.

Possible Future WisBlock Projects

With the power of Qubitro and WisBlocks, it's possible to make all kinds of projects in minimal time and effort. Tune in layer to check back if we add them to our WisBlocks examples.
    Bluetooth data collection gateway with cellular backhaul
    Remote solar charge monitor
    Air quality monitor
    CoAP over OpenThread lighting controller
    Asset tracking device
    Single-channel LoRaWAN gateway
    PLC Monitor over RS-485
    Triggering external services in real-time with Qubitro rule engine.
Last modified 2mo ago