DEV Community

Cover image for Monitoring Air Quality with BleuIO and Renesas RRH62000 on EK-RA4M2
Bleuio tech
Bleuio tech

Posted on

Monitoring Air Quality with BleuIO and Renesas RRH62000 on EK-RA4M2

In this tutorial, we demonstrate how to use the Renesas EK-RA4M2 MCU, the Renesas RRH62000 All-in-One Air Quality Sensor Module, and the BleuIO Bluetooth Low Energy (BLE) USB Dongle to collect and transmit air quality data wirelessly. The RRH62000 sensor module measures key environmental parameters such as:

  • eCO₂ (Equivalent Carbon Dioxide)
  • Humidity (%)
  • Temperature (°C)
  • Particulate Matter (PM1, PM2.5, PM10) (µm/cm³)
  • Total Volatile Organic Compounds (TVOC) (mg/m³)
  • Indoor Air Quality Index (IAQ)

The EK-RA4M2 MCU reads data from the sensor via I²C, processes the information, and transmits it over BLE using the BleuIO USB dongle. The advertised data can be monitored using BLE scanning applications, and the sensor values can also be displayed in RTTViewer on a connected PC.

Requirements

Before getting started, ensure you have the following hardware and software:

Hardware

Software

You can download the complete example project here:

➡️ GitHub Repository

Hardware Setup

Connecting EK-RA4M2 and BleuIO Dongle

  1. Connect EK-RA4M2 to your PC using a micro-USB cable via the J10 (Debug1) port.
  2. Plug the BleuIO dongle into a USB OTG cable and connect it to J11 (USB Full Speed) on the EK-RA4M2 board.
  3. Set jumpers:
    • Place J12 on pins 1-2.
    • Remove J15 completely.

Reference Diagram:

Connecting RRH62000 Air Quality Sensor

Connect the RRH62000 sensor module to EK-RA4M2 as follows:

  • Power: Connect 5V and GND from RRH62000 to 5V and GND on EK-RA4M2.
  • I²C Communication:
    • SCL (Clock) → SCL on EK-RA4M2
    • SDA (Data) → SDA on EK-RA4M2
    • GND → GND on EK-RA4M2

Reference Diagrams:

Importing the Project into e² Studio

  1. Open e² Studio IDE and choose a workspace. Click Launch.
  2. Download or clone the project from GitHub and place the “bleuio_ra4m2_rrh62000_example” folder inside your workspace.
  3. Go to File → Import and select Existing Projects into Workspace under the General tab.
  4. Click Browse… and locate the project folder.
  5. Select the project and click Finish to import it.

Importing Example Project:

Building and Running the Example

  1. Build the project by clicking the build icon.
  2. Set up debugging:

    • Click the down arrow next to the Debug icon and select Debug Configurations…
    • Under Renesas GDB Hardware Debugging, choose bleuio_ra4m2_sensor_rrh62000_example Debug_Flat and click Debug.
  3. Run the program:

    • Open RTTViewer and connect using the following settings:
      • Connection to J-Link: USB
      • Target Device: R7FA4M2AD
      • Interface & Speed: SWD, 4000 kHz
      • RTT Control Block Address: 0x200009dc
  4. In e² Studio, click Resume twice to start execution.

  5. The program starts running:

    • All LEDs turn on for 1 second, then only the red LED remains on.
    • The red LED turns off when BleuIO is initialized.
    • The green LED turns on when advertising starts.
  6. Sensor data is displayed in RTTViewer.

Scanning and Decoding BLE Advertising Data

Scan the Dongle using nRF Connect

Use a BLE scanning app like nRF Connect to view the advertised data:

Decoding the Advertising Message

Example raw BLE advertisement:

02010619FF3600016491803010300030105060306080192
Enter fullscreen mode Exit fullscreen mode

All air quality sensor values except eCO2 is split into two bytes. The first byte is the whole number and the second byte is the decimal. For example

1649 is the temperature value. The whole number is 16 and the decimal is 49. Converting it from hex gives

us: 23.73 °C

The eCO2 value is 2 bytes, big endian.

Breaking it down:

Data Description Decoded Value
020106 Advertising flag (connectable)
19 Message size
FF Manufacturer Specific Data
3600 Renesas Manufacturer ID (Little Endian)
Air Quality Advertised Data
1649 Temperature (°C) 23.73°C
1803 Humidity (%RH) 24.3% RH
0103 IAQ Index 1.3
0003 TVOC (mg/m³) 0.3 mg/m³
0105 PM1 (µm/cm³) 1.5
0603 PM2.5 (µm/cm³) 6.3
0608 PM10 (µm/cm³) 6.8
0192 eCO₂ (ppm) 402 ppm

This project successfully demonstrates how to use the BleuIO Bluetooth dongle, EK-RA4M2 MCU, and Renesas RRH62000 sensor to wirelessly monitor air quality. The BLE advertisements can be scanned and decoded to extract real-time air quality data.

For the full source code and updates, visit:

➡️ GitHub Repository

Top comments (0)