Skip to main content

RAK12037 WisBlock CO2 Sensor Module Quick Start Guide

Prerequisite

What Do You Need?

Before going through each and every step on using the RAK12037 WisBlock CO2 Sensor Module, make sure to prepare the necessary items listed below:

Hardware

Software

  • Download and install the Arduino IDE.
  • To add the RAKwireless Core boards on your Arduino board, install the RAKwireless Arduino BSP. Follow the steps in the GitHub repo.

Product Configuration

Hardware Setup

RAK12037 is a WisBlock Sensor that extends the WisBlock system based on the SCD30 module. This module uses NDIR CO2 sensor technology to sense CO2 and has an integrated temperature and humidity sensor. Ambient humidity and temperature can be measured by monitoring and compensating for external heat sources without the need for additional components. The small module height allows easy integration into different applications. The SCD30 features dual-channel detection for superior stability and ±30 ppm + 3% accuracy.

For more information about RAK12037, refer to the Datasheet.

RAK12037 module can be connected to the IO slot of WisBlock Base to communicate with the WisBlock Core, as shown in Figure 1. Also, always secure the connection of the WisBlock module by using compatible screws.

Zoomable
Figure 1: RAK12037 connection to WisBlock Base

Assembling and Disassembling of WisBlock Modules

Assembling

The RAK12037 module can be mounted on the IO slot of the WisBlock Base Board, as shown in Figure 2. Also, always secure the connection of the WisBlock module by using compatible screws.

Zoomable
Figure 1: RAK12037 mounting connection to WisBlock Base module
Disassembling

The procedure in disassembling any type of WisBlock module is the same.

  1. First, remove the screws.
Zoomable
Figure 1: Removing screws from the WisBlock module
  1. Once the screws are removed, check the silkscreen of the module to find the correct location where force can be applied.
Zoomable
Figure 1: Detaching silkscreen on the WisBlock module
  1. Apply force to the module at the position of the connector, as shown in Figure 5, to detach the module from the baseboard.
Zoomable
Figure 1: Applying even forces on the proper location of a WisBlock module
NOTE

If you will connect other modules to the remaining WisBlock Base slots, check on the WisBlock Pin Mapper tool for possible conflicts.

After all this setup, you can now connect the battery (optional) and USB cable to start programming your WisBlock Core.

warning
  • 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 RAK12037 WisBlock Module

  1. 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.

  2. You need to select first the WisBlock Core you have.

RAK4631 Board

Zoomable
Figure 1: Selecting RAK4631 as WisBlock Core

RAK11200 Board

Zoomable
Figure 1: Selecting RAK11200 as WisBlock Core

RAK11310 Board

Zoomable
Figure 1: Selecting RAK11310 as WisBlock Core
  1. Next, copy the following sample code into your Arduino IDE:
Click to view the code
/**
@file RAK12037_BasicReadings_SCD30.ino
@author rakwireless.com
@brief Example of reading SCD30 sensor and displaying data through serial port.
@version 0.1
@date 2022-1-18
@copyright Copyright (c) 2022
**/

#include <Wire.h>

#include "SparkFun_SCD30_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_SCD30

SCD30 airSensor;

void setup()
{
pinMode(WB_IO2, OUTPUT);
digitalWrite(WB_IO2, HIGH);

// Initialize Serial for debug output
time_t timeout = millis();
Serial.begin(115200);
while (!Serial)
{
if ((millis() - timeout) < 5000)
{
delay(100);
}
else
{
break;
}
}

Serial.println("SCD30 Basic Readings Example.");

Wire.begin();

delay(500);

if (airSensor.begin() == false)
{
Serial.println("Air sensor not detected. Please check wiring. Freezing...");
while (1)
{
delay(10);
}
}
}

void loop()
{
if (airSensor.dataAvailable())
{
Serial.print("co2(ppm):");
Serial.print(airSensor.getCO2());

Serial.print(" temp(C):");
Serial.print(airSensor.getTemperature(), 1);

Serial.print(" humidity(%):");
Serial.print(airSensor.getHumidity(), 1);

Serial.println();
}
else
Serial.println("Waiting for new data");

delay(3000);
}
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 RAK12037 WisBlock Example Code Repository and this sample code in GitHub will work on all WisBlock Core.

  1. Once the example code is open, install the SparkFun_SCD30 library by clicking the yellow highlighted link, as shown in Figure 9 and Figure 10.
Zoomable
Figure 1: Accessing the library used for RAK12037 Module
Zoomable
Figure 1: Installing the compatible library for RAK12037 Module
  1. After the 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.
NOTE

If you're 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.

Zoomable
Figure 1: Selecting the correct Serial Port
Zoomable
Figure 1: Uploading the RAK12037 example code
  1. When you have successfully uploaded the example sketch, open the serial monitor of the Arduino IDE and set the baud rate correctly. You will then see the sensor's output, as shown in Figure 13. Therefore, your RAK12037 is properly communicating with the WisBlock core.
Zoomable
Figure 1: RAK12037 CO2 Sensor Serial Readings