RAK12033 WisBlock 6-Axis Accelerometer Sensor Module Quick Start Guide
Prerequisite
Package Inclusions
Before going through each and every step on using the RAK12033 WisBlock Module, make sure to prepare the necessary items listed below:
Hardware
- RAK12033 WisBlock 6-Axis Accelerometer Sensor Module
- Your choice of WisBlock Base
- Your choice of WisBlock Core
- USB Cable
- RAK19005 WisBlock Sensor Extension Cable (optional)
- Li-Ion/LiPo battery (optional)
- Solar charger (optional)
Software
- Download and install the Arduino IDE.
- To add the RAKwireless Core boards to your Arduino board, install the RAKwireless Arduino BSP. Follow the steps in the Github repo.
Product Configuration
Hardware Setup
WisBlock can integrate this module which extends the WisBlock system with a gyroscope and accelerometer sensor.
For more information about RAK12033, refer to the Datasheet.
RAK12033 module can be connected to the sensor's slot of WisBlock Base to communicate with the WisBlock Core, as shown in Figure 1. It will work on SLOT C to F. Also, always secure the connection of the WisBlock module by using compatible screws.
RAK12033 has two digital output lines for interrupt signal, so two input GPIOs from WisBlock Core are needed to capture these interrupts. Slot A and B use WB_IO2 which is dedicated to switching the power supply (3V3_S) to Sensor Slots. It can't be used as input.
Slots C, D, E & F are possible to be used if the size of the module fits in and if the slot is available, which depends on the specific type of WisBlock Base board.
Assembling and Disassembling of WisBlock Modules
Assembling
As shown in Figure 2, the location for Slot C, D, E, and F are properly marked by silkscreen. Follow carefully the procedure defined in WisBlock Base board assembly/disassembly instructions to attach a WisBlock module. Once attached, carefully fix the module with one or more pieces of M1.2 x 3 mm screws depending on the module.
This chip is very sensitive, and the tightness of the mounting screws will affect its zero offset. Therefore, we recommend that once the RAK12033 is installed, do not repeatedly loosen or tighten the screws. The zero offset must need to be calibrated again every time loosening or tightening the screw the screws. Recommended screw torque range: 0.032 - 0.054 N-m.
Disassembling
The procedure in disassembling any type of WisBlock module is the same.
- First, remove the screws.
- Once the screws are removed, check the silkscreen of the module to find the correct location where force can be applied.
- Apply force to the module at the position of the connector, as shown in Figure 6, to detach the module from the baseboard.
If you will connect other modules to the remaining WisBlock Base slots, check on the WisBlock Pin Mapper tool for possible conflicts. RAK12033 uses I2C communication lines and two IO pins for interrupt signals, and it can cause possible conflict, especially on some IO modules.
After all this setup, you can now connect the battery (optional) and USB cable to start programming your WisBlock Core.
- Batteries can cause harm if not handled properly.
- Only 3.7-4.2 V Rechargeable LiPo batteries are supported. It is highly recommended not to use other types of batteries with the system unless you know what you are doing.
- If a non-rechargeable battery is used, it has to be unplugged first before connecting the USB cable to the USB port of the board to configure the device. Not doing so might damage the battery or cause a fire.
- Only 5 V solar panels are supported. Do not use 12 V solar panels. It will destroy the charging unit and eventually other electronic parts.
- Make sure the battery wires match the polarity on the WisBlock Base board. Not all batteries have the same wiring.
Software Configuration and Example
Initial Test of the RAK12033 WisBlock Module
-
Install the RAKwireless Arduino BSP for WisBlock by using the
package_rakwireless_index.json
board installation package, the WisBlock Core should now be available on the Arduino IDE. -
You need to select the WisBlock Core you have.
RAK4631 WisBlock Core
RAK11200 WisBlock Core
RAK11310 WisBlock Core
- Next, copy the following sample code into your Arduino IDE:
Click to view the code
/**
@file RAK12033_6_Axis_BasicReadings_IIM_42652.ino
@author rakwireless.com
@brief Get IIM-42652 sensor data and output data on the serial port.
@version 0.1
@date 2021-12-28
@copyright Copyright (c) 2021
**/
#include "RAK12033-IIM42652.h"
IIM42652 IMU;
void setup()
{
time_t timeout = millis();
// Initialize Serial for debug output.
Serial.begin(115200);
while (!Serial)
{
if ((millis() - timeout) < 5000)
{
delay(100);
}
else
{
break;
}
}
Serial.println("RAK12033 Basic Reading example.");
Wire.begin();
if (IMU.begin() == false)
{
while (1)
{
Serial.println("IIM-42652 is not connected.");
delay(5000);
}
}
}
void loop()
{
IIM42652_axis_t accel_data;
IIM42652_axis_t gyro_data;
float temp;
float acc_x ,acc_y ,acc_z;
float gyro_x,gyro_y,gyro_z;
IMU.ex_idle();
IMU.accelerometer_enable();
IMU.gyroscope_enable();
IMU.temperature_enable();
delay(100);
IMU.get_accel_data(&accel_data );
IMU.get_gyro_data(&gyro_data );
IMU.get_temperature(&temp );
/*
* ±16 g : 2048 LSB/g
* ±8 g : 4096 LSB/g
* ±4 g : 8192 LSB/g
* ±2 g : 16384 LSB/g
*/
acc_x = (float)accel_data.x / 2048;
acc_y = (float)accel_data.y / 2048;
acc_z = (float)accel_data.z / 2048;
Serial.print("Accel X: ");
Serial.print(acc_x);
Serial.print("[g] Y: ");
Serial.print(acc_y);
Serial.print("[g] Z: ");
Serial.print(acc_z);
Serial.println("[g]");
/*
* ±2000 º/s : 16.4 LSB/(º/s)
* ±1000 º/s : 32.8 LSB/(º/s)
* ±500 º/s : 65.5 LSB/(º/s)
* ±250 º/s : 131 LSB/(º/s)
* ±125 º/s : 262 LSB/(º/s)
* ±62.5 º/s : 524.3 LSB/(º/s)
* ±31.25 º/s : 1048.6 LSB/(º/s)
* ±15.625 º/s : 2097.2 LSB/(º/s)
*/
gyro_x = (float)gyro_data.x / 16.4;
gyro_y = (float)gyro_data.y / 16.4;
gyro_z = (float)gyro_data.z / 16.4;
Serial.print("Gyro X:");
Serial.print(gyro_x);
Serial.print("º/s Y: ");
Serial.print(gyro_y);
Serial.print("º/s Z: ");
Serial.print(gyro_z);
Serial.println("º/s");
Serial.print("Temper : ");
Serial.print(temp);
Serial.println("[ºC]");
IMU.accelerometer_disable();
IMU.gyroscope_disable();
IMU.temperature_disable();
IMU.idle();
delay(2000);
}
If you experience any error in compiling the example sketch, check the updated code for your WisBlock Core Module that can be found on the RAK12033 WisBlock Example Code Repository and this sample code in Github will work on all WisBlock Core.
- Once the example code is open, install the RAK12033-IIM42652 library, as shown in Figure 10.
- After successful installation of the library, you can now select the right serial port and upload the code, as shown in Figure 11 and Figure 12.
If you are using the RAK11200 as your WisBlock Core, the RAK11200 requires the Boot0 pin to be configured properly first before uploading. If not done properly, uploading the source code to RAK11200 will fail. Check the full details on the RAK11200 Quick Start Guide.
- When you have successfully uploaded the example sketch, open the serial monitor of the Arduino IDE to see the sensor's reading logs. If you see the logs, as shown in Figure 13, then your RAK12033 is communicating with the WisBlock core properly.