Renesas Air Quality Sensor ZMOD4510

I want to collect air quality data around my neighborhood. The device should be portable and with low power consumption. ZMOD4510 Outdoor Air Quality sensor can measure pollutants like ozone and NOx and calculate Air Quality Index. It can perform these measurements and calculations using a very low amount of energy.  So I've decided to use it for my project.

 

ZMOD4510 Pmod Type 6A (Extended I2C) Interface

Pmod Type 6A (Extended I2C) is a relatedly new interface spec, which was introduced in 2020. It defines the physical and electrical parameters of the interface. Not a lot of boards support it. But good think about it it still can be used with the standard I2C interface. ZMOD4510 board already has 4.7k pull-up resistors for the I2C interface. They can be disconnected by removing jumpers.

ZMOD4510 Development Plan

ZMOD4510 comes with quite extensive documentation and libraries for different MCU types and examples for Arduino and Renesas EVK, I need to develop an I2C wrapper and HAL specific to PSoC6 to be able to connect it to CY8CKIT-062S2-43012. I plan to evaluate the sensor first with Arduino 33 Nano IoT and then implement code for PSoC6.

 

ZMOD4510 Arduino Example Setup

I've first tried to use provided Arduino example from my Win10. But run into issues during the build. Win10 has limitations on the length of the commands. So I've installed IDE on my Ubuntu 20.04 following the provided guide. It is very important to complete Arduino IDE installation by running provided arduino-linux-setup.sh script, which grants permission to access serial ports. It is required to upload firmware and read output from the serial port for debugging.

 

The first step after the installation was to add the ZMOD4510 library to Arduino IDE:

Then I've added Arduino SAMD Boards using Boards Manager. Arduino Nano 33 IoT is part of the SAMD family.

ZMOD4510 library comes with an example sketch. I've opened it.

I've selected Arduino Nano 33 IoT as the target board:

At this point, I'm close to deploying it to MCU. But I need to run verify/build first.

I've connected the board and run dmesg to verify if it was connected without errors:

[  341.936131] usb 2-7: new full-speed USB device number 3 using ohci-pci
[  342.181157] usb 2-7: New USB device found, idVendor=2341, idProduct=8057, bcdDevice= 1.00
[  342.181162] usb 2-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  342.181164] usb 2-7: Product: Arduino NANO 33 IoT
[  342.181165] usb 2-7: Manufacturer: Arduino LLC
[  342.181167] usb 2-7: SerialNumber: B8A47CB350573738352E3120FF122625
[  343.598471] cdc_acm 2-7:1.0: ttyACM0: USB ACM device
[  343.607625] usbcore: registered new interface driver cdc_acm
[  343.607629] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

 

And before I can upload the sketch I've selected the target serial port. The only port I can use on my Ubuntu box is /dev/ttyACM0.

I've uploaded the sketch to the Arduino board.

 

Connecting and Testing ZMOD4510 Arduino Example

 

And I've opened the Serial Monitor in Arduino IDE. At this point, ZMOD4510 was not connected. I've expected to receive an error message. But there were no errors or anything else. Just to make sure my board and Serial Monitor are working I've tested it with the Blynk example. And everything was working as expected and I've got some text in the Serial Monitor. I've switched back to ZMOD4510  sketch and added some debug statements and delay(3000) in setup(). And I've started getting some output as well.

Initializing ZMOD4510 hardware 
Ezpected PID 25376
Reading sensor information
Error -4 during reading sensor information, exiting program!

 

I've connected ZMOD4510 to Arduino Nano 33 IoT.

 

I've used the following cables color coding

  • SCL blue
  • SDA green
  • V3.3 red
  • ground black

 

Here is how it looks:

 

I've switched it on But got the same error as before.

 

I've looked at the code in ihal_arduino,cpp, 2c_wrapper_arduino.cpp and zmod4xxx.cpp. init_hardware(&dev) calls arduino_i2c_setup() which calls Wire.begin() of Arduino I2C Wire library. And error -4 means that "ERROR_SENSOR_UNSUPPORTED". I'm expecting to get 3, which is ERROR_I2C. But I never got it even when the board was not connected at all.

 

I've verified all electrical connections and they seem fine. So now I need to identify where is the problem.

 

Here is the list of options I'm considering:

  • Connect another I2C device to verify if my Arduino Nano 33 IoT board works well.
  • Use an I2C analyzer to review communication.
  • Implement the I2C wrapper and HAL code for CY8CKIT-062S2-43012 required by the ZMOD4510 library and test the sensor from PSoC.

 

Update #1

I've used an I2C Scanner sketch from https://wiki.seeedstudio.com/Arduino_Software_I2C_user_guide/

#include <Wire.h>



void setup()

{

  Wire.begin();



  Serial.begin(9600);

   while (!Serial); // Wait for serial monitor

  Serial.println("---I2C Scanner---");

}



void loop()

{

   byte error, address;

   int nDevices;



  Serial.println("Scanning...");



  nDevices = 0;

   for(address = 1; address < 127; address++ )

  {

  Wire.beginTransmission(address);

  error = Wire.endTransmission();



  Wire.beginTransmission(address+1);



   if (error == 0 && Wire.endTransmission() != 0 ) // Special flag for SAMD Series

  {

  Serial.print("I2C device found at address 0x");

   if (address<16)

  Serial.print("0");

  Serial.print(address,HEX);

  Serial.println("!");



  nDevices++;

  }

   else if (error==4) 

  {

  Serial.print("Unknown error at address 0x");

   if (address<16) 

  Serial.print("0");

  Serial.println(address,HEX);

  }

  }

   if (nDevices == 0)

  Serial.println("No I2C devices found\n");

   else

  Serial.println("done\n");



  delay(5000);  // wait 5 seconds for next scan

}

 

It was able to detect only on-board I2C devices:

Scanning...
I2C device found at address 0x60!
I2C device found at address 0x6A!
done

 

As per https://forum.arduino.cc/t/communicating-directly-with-arduino-nano-33-iots-onboard-lsm6ds3-over-i2c/702602   0x60 is for the crypto chip and 0x6A is for the LSM6DS3.

Arduino Nano 33 IoT has built-in 4.7k pullups resistors. I've removed 4.7k pullups resistors from ZMOD4510, but I've got the same results.

 

Update #2

I've got a response from the Renesas support team on the issue with the reading data. The suggestion was to completely power off the system and then power on it again. I was a bit skeptical about it at first. But it helped! I've started getting data from the sensor now! As I understand ZMOD4510 has its own MCU. And if this MCU is in the wrong state then the only option to restart it is to power cycle. the board  And I was just doing the reset on the Arduino, which was not resetting ZMOD4510 MCU. It was a very good lesson for me.

 

Initializing ZMOD4510 hardware 
Expected PID 25376
Reading sensor information
Preparing sensor
Starting measurement
*********** Measurements ***********
 Rmox[0] = 556314.88 kOhm
 Rmox[1] = 3162.08 kOhm
 Rmox[2] = 1699.68 kOhm
 Rmox[3] = 1389.33 kOhm
 Rmox[4] = 1218.32 kOhm
 Rmox[5] = 1094.78 kOhm
 Rmox[6] = 991.05 kOhm
 Rmox[7] = 926.60 kOhm
 O3_conc_ppb = 0.00
 Fast AQI = 0 EPA AQI = 0
Warmup!
*********** Measurements ***********
 Rmox[0] = 103550.50 kOhm
 Rmox[1] = 1174.82 kOhm
 Rmox[2] = 832.85 kOhm
 Rmox[3] = 778.90 kOhm
 Rmox[4] = 736.13 kOhm
 Rmox[5] = 703.86 kOhm
 Rmox[6] = 674.41 kOhm
 Rmox[7] = 645.62 kOhm
 O3_conc_ppb = 0.00
 Fast AQI = 0 EPA AQI = 0
Warmup!

 

So the sensor is working and I can try the same procedure with the PSoC6 board.