Unable to connect to an IC2/UART interface board or the adjoined sensor

My issue with the [NDIR Z-16 CO2 sensor](100,000ppm MH-Z16 NDIR CO2 Sensor with I2C/UART 5V/3.3V Interface for Arduino/Raspeberry Pi | Sandbox Electronics .) is that I cannot get a readout.

The setup includes Arduino Uno, an I2C/UART interface board and the NDIR Z-16 sensor.

I downloaded the sellers sketches and libraries:

#include <Wire.h>
#include <NDIR_I2C.h>

NDIR_I2C mySensor(0x4D); //Adaptor's I2C address (7-bit, default: 0x4D)

void setup()
{
    Serial.begin(9600);

    if (mySensor.begin()) {
        Serial.println("Wait 10 seconds for sensor initialization...");
        delay(10000);
    } else {
        Serial.println("ERROR: Failed to connect to the sensor.");
        while(1);
    }
}

void loop() {
    if (mySensor.measure()) {
        Serial.print("CO2 Concentration is ");
        Serial.print(mySensor.ppm);
        Serial.println("ppm");
    } else {
        Serial.println("Sensor communication error.");
    }

    delay(1000);
}

I have the switch in the I2C position and wires connected as shown on the attached pictures:

When I open the serial monitor the LED on arduino flashes a bit, but no output is given on the serial monitor.

If I remove a wire from analog pins A4 or A5 the serial monitor displays the text "ERROR: Failed to connect to the sensor.". The same text is displayed if the wires from the I2C/UART interface board points SDA and SCL are connected elsewhere on the Arduino Uno board.

What could solve my issue?

Thanks!!

The image shows the SCL/SDA wires the wrong way round. It should be A4 = SDA, A5 = SCL

Does your power supply deliver enough current as the web site you linked says...

NOTE: Your USB2.0 port on your PC may not be able to provide sufficient current to power the sensor and your Arduino in the same time. To minimize the supply voltage fluctuation on the sensor, it is recommended to use an external 12V power supply on your Arduino.

Hi Riva!

This did not end solving the issue and no output is still produced on the serial monitor, but thanks!

My power supply was indeed at 9V and I tuned it up to 12V now.

I also changed the wiring as per your instructions.

Any ideas?

First thing to try is the I2C scanner from here. Upload it and see if it finds the NDIR at 0x4D.
If it finds it then the problem might still be power related as maybe your external PSU or the regulator on the Arduino cannot deliver the current needed (your powering the NDIR from the Arduino 5V pin in the picture).

If you don't find it then maybe try the software serial example instead and see if it hangs.

Do you get nothing at all or do you see the "Wait 10 seconds for sensor initialization..." message?

Hi and thanks!

I tried the I2C scanner according to the instructions, but the message on the serial monitor output stops at "Scanning..." and no further messages are displayed.

When using the sellers NDIR_I2C example no message is displayed at all on the serial monitor when the wiring is A4 = SDA, A5 = SCL

I tried the sellers NDIR_SoftwareSerial example to connect using UART:

#include <SoftwareSerial.h>
#include <NDIR_SoftwareSerial.h>

//Select 2 digital pins as SoftwareSerial's Rx and Tx. For example, Rx=2 Tx=3
NDIR_SoftwareSerial mySensor(2, 3);

void setup()
{
    Serial.begin(9600);

    if (mySensor.begin()) {
        Serial.println("Wait 10 seconds for sensor initialization...");
        delay(10000);
    } else {
        Serial.println("ERROR: Failed to connect to the sensor.");
        while(1);
    }
}

void loop() {
    if (mySensor.measure()) {
        Serial.print("CO2 Concentration is ");
        Serial.print(mySensor.ppm);
        Serial.println("ppm");
    } else {
        Serial.println("Sensor communication error.");
    }

    delay(1000);
}

I had the I2C/UART interface board set at UART mode and wiring connected as shown in the attached pictures.

The message I got was "ERROR: Failed to connect to the sensor."

Still not working then. Is there something wrong with my setup?

As a last resort it might be worth swapping the RX/TX wires around and trying again but if that does not work then maybe the module is faulty/damaged or you have power problems.

Hi, I found the solution to this issue and want to share it here, even if it is not technical.

I emailed the seller and they told that the 4 pin cable provided in the kit has been faulty a few times in the past. I bought some new cables and the thing works now just as intended.

Thanks for the support Riva!

Glad you figured it out in the end. Happy CO2 sensing.