RAKWireless started selling a modular hardware platform that allows for anyone to take their core modules which contain a controller and radio, and pair them with pre-made sensor or I/O modules to let you create a custom device in minutes. This is paired well with Qubitro which allows anyone to take their device and in minutes start exporting data to the cloud and applications. Together they make a powerful pair where a custom device that can monitor your fridge or commercial operations can be deployed in less time it takes to make a sandwich.
In order to get started, all you need is a RAKWireless base board, RAKWireless sensor modules, and a RAKWireless ESP32 core which can be connected to a computer running the Arduino IDE or PlatformIO. Note that the example is written with PlatformIO in mind and will automatically install all the needed libraries if used.
SetupTo get the computer ready for the project which only needs to be done once, download the Arduino IDE or vscode, if you are using vscode make sure to install the PlatformIO plugin from the extensions tab.
When choosing the Arduino IDE, to add support for the RAK WisBlocks simply add the following URL to the boards manager URL list, then in the boards manager searching for "RAK" will show a board package for the ESP32 core which can then be installed. https://raw.githubusercontent.com/RAKwireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless_index.json
If using PlatformIO, please follow this guide to add WisBlock support.
To download all the dependencies to run this example, PlatformIO users will only need to open the project and hit the compile button for the first time, however if using the Arduino IDE, the library manager needs to be opened and the following libraries must be installed-
Adafruit BME680
SparkFun SHTC3 Humidity and Temperature Sensor
ClosedCube OPT3001
SparkFun LIS3DH Arduino
Arduino_LPS22HB
ArduinoJson
QubitroMqttClient
The last thing to do is take the base WisBlock board, and attach the ESP32 core to the base by plugging it in and screwing it down. Add any sensors you'd like as well in the sensor slots, the example allows for any sensor used in the WisBlock starter kit to be tested easily including temp/humidity, air pressure, light, gas, environmental, and accelerometer.
Uploading your FirmwareClone the Qubitro example projects for the WisBlocks or download directly from the GitHub website. This will download a folder containing different Qubitro made WisBlock examples, note that these are meant to be used as example to let you play with the hardware and get started, so they are quite simple and are not the lowest power. For the ESP32 core we will be using the 01-ESP32WiFi-Sensors example which should be opened in your IDE of choice.
git clone https://github.com/qubitro/wisblock-sensornode-example.git
Please note if using the Arduino IDE the "main.cpp" file must be renamed to "QubitroRAKESP32Example.ino".
The only file that needs to be updated to get the example running is "main.h" which allows for any of the sensors to be enabled by uncommenting the preprocessor definition, and and Wi-Fi details can be added to the WIFI_SSID and WIFI_PASS declarations. To authenticate with Qubitro, add the new device to your project's device list, then visit the settings tab for that device. There you will find the ID and token to paste into the main file in the QUBITRO_DEVICE_ID and QUBITRO_DEVICE_TOKEN. Other details can be changed within the main.h file like if you'd like to power gate your sensors (Which may not be desirable for things like gas monitoring), if you'd like to use TLS (Enabled by default), and the data frequency.
// main.h configuration file for project
#ifndef MAIN_H
#define MAIN_H
#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <QubitroMqttClient.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <ArduinoJson.h>
#define WIFI_SSID "WIFI_SSID_HERE"
#define WIFI_PASS "WIFI_PASS_HERE"
#define QUBITRO_DEVICE_ID "PASTE_DEVICE_ID_HERE"
#define QUBITRO_DEVICE_TOKEN "PASTE_DEVICE_TOKEN_HERE"
// Comment out to disable a sensor
#define SHTC3_TEMP_HUM_SENSOR
#define LPS22_PRESSURE_SENSOR
//#define OPT3001_LIGHT_SENSOR
//#define LIS3DH_ACCEL_SENSOR
//#define BEM680_ENV_SENSOR
//#define UBLOX_GPS
#define VBAT_MV_PER_LSB 10
#define VBAT_DIVIDER_COMP 0
#define PIN_VBAT WB_A0
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
// Comment out to disable powergating
#define POWERGATE_SENSORS
#define POLL_TIME 600000
#define USE_SSL 1
#define BUFFER_LEN 1024
bool populateSensorData(char *buffer);
void initSensors();
#endif
Once the main.h file is configured, short the BOOT0 pin on the Wisblock core to the ground pin next to it, the ESP32 core should have came with headers and a jumper to do this but a pair of tweezers will also work. When the reset button is pressed with the shorted jumper, the ESP32 goes into a programming mode. Note that you can jump and press the button, then disconnect the jumper and the ESP32 will remain in programming mode until the reset button is pressed again. Press the upload code button in your IDE, and when complete, press the reset button again, you should be able to open the serial console and watch the device connect to Wi-Fi and start publishing to Qubitro.
Now that your data is flowing into Qubitro, you can see the raw data in the device page as a table, as well as create custom dashboards using the easy to use drag and drop interface.
And that's it! The setup can take a moment but uploading for new devices which may vary in attached sensors can take under a minute!
Comments
Please log in or sign up to comment.