RAK12003 WisBlock Infrared Temperature Sensor Module Quick Start Guide
Prerequisite
- Assemble the RAK12003 with a WisBlock Base and WisBlock Core by following the RAK12003 Installation Guide.
- Download and install the Arduino IDE, then add the RAKwireless Core boards by installing the RAKwireless Arduino BSP.
- USB Cable
- Li-Ion/LiPo battery (optional)
- Solar charger (optional)
Initial Test of the RAK12003 WisBlock Module
NOTE
- This guide uses the RAK4631 WisBlock Core to demonstrate the configuration process. You can also use the RAK11200 or RAK11300 as the WisBlock Core.
- When using the RAK11200, configure the BOOT0 pin correctly before uploading the source code. Otherwise, the upload may fail. For detailed instructions, refer to the RAK11200 Quick Start Guide.
-
Install the RAKwireless Arduino BSP for WisBlock by using the
package_rakwireless_index.jsonboard installation package. The WisBlock Core should now be available on the Arduino IDE. -
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 RAK12003_FIR_MLX90632.ino
* @author rakwireless
* @brief This example shows how to read both the remote object temperature and the local sensor temperature.
* and prints out the temperature data to the Serial console.
* @version 0.1
* @date 2021-01-20
*
* @copyright Copyright (c) 2021
*/
#include <Wire.h>
#include "SparkFun_MLX90632_Arduino_Library.h" // Click here to get the library: http://librarymanager/AllSparkFun_MLX90632_Arduino_Library
#define MLX90632_ADDRESS 0x3A
MLX90632 RAK_TempSensor;
void setup()
{
TwoWire &wirePort = Wire;
MLX90632::status returnError;
time_t timeout = millis();
Serial.begin(115200);
while (!Serial)
{
if ((millis() - timeout) < 5000)
{
delay(100);
}
else
{
break;
}
}
Serial.println("MLX90632 Read Example");
Wire.begin(); //I2C init
if (RAK_TempSensor.begin(MLX90632_ADDRESS, wirePort, returnError) == true) //MLX90632 init
{
Serial.println("MLX90632 Init Succeed");
}
else
{
Serial.println("MLX90632 Init Failed");
}
}
void loop()
{
float object_temp = 0;
object_temp = RAK_TempSensor.getObjectTempF(); //Get the temperature of the object we're looking at
Serial.print("Object temperature: ");
Serial.print(object_temp, 2);
Serial.print(" F");
float sensor_temp = 0;
sensor_temp = RAK_TempSensor.getSensorTemp(); //Get the temperature of the sensor
Serial.print(" Sensor temperature: ");
Serial.print(sensor_temp, 2);
Serial.print(" C");
Serial.println();
}
NOTE
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 RAK12003 WisBlock Example Code Repository. This sample code in Github will work on all WisBlock Core.
- Once the example code is open, install the SparkFun MLX90632 library by clicking the yellow highlighted link.
Figure 1: Accessing the library used for RAK12003 Module
Figure 1: Installing the compatible library for RAK12003 Module- After successful installation of the library, you can now select the right serial port and upload the code.
Figure 1: Selecting the correct Serial Port
Figure 1: Uploading the RAK12003 example code- When you 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, then your RAK12003 is properly communicating to the WisBlock core.
Figure 1: RAK12003 sensor data logs