QWIIC Environmental(ENS160/BME280) Sensor does not appear to AVR-DB- AVR-IoT Cellular Mini, DxCore, I2C modifications

QWIIC Environmental(ENS160/BME280) Sensor does not appear to AVR-DB- AVR-IoT Cellular Mini,
I have uploaded this program to a AVR- IoT Cellular Mini(AVR-DB family):
Code:
Libraries: GitHub - sparkfun/SparkFun_Indoor_Air_Quality_Sensor-ENS160_Arduino_Library

It is a altered example, trying to attempt to make it work with AVR-DB chips.

/* Ex1_Combined_Basic_Example_ENS160_BME280.ino

This example shows basic data retrieval from the SparkFun Environmental Combo Breakout
from the Air Quality Sensor (ENS160) and Atmospheric Sensor (BME280).

This example shows how to read sensor readings from the ENS160 (air quality index tVOC, and eCO2)
and BME280 (humidity, pressure, and current temperature) over I2C.

Modified by:
Ho Yun "Bobby" Chan @ SparkFun Electronics August, 2023
Basic Example for the ENS160 Originally Written by:
Elias Santistevan @ SparkFun Electronics October, 2022
Basic Example for the ENS160 Originally Written by:
Nathan Seidle @ SparkFun Electronics March 9th, 2018

Products:
Air Quality Sensor  (ENS160)             -  https://www.sparkfun.com/products/20844
Humidity and Temperature Sensor (BME280) -  https://www.sparkfun.com/products/13676

Repository:
https://github.com/sparkfun/SparkFun_Indoor_Air_Quality_Sensor-ENS160_Arduino_Library

SparkFun code, firmware, and software is released under the MIT
License(http://opensource.org/licenses/MIT).

*/
//#define Serial3 //Serial3USB  //Uncomment if you are using a native USB like the Atmega32U4 or SAMD21


#include <Wire.h>
#include "SparkFun_ENS160.h"  // Click here to get the library: http://librarymanager/All#SparkFun_ENS160
#include "SparkFunBME280.h"   // Click here to get the library: http://librarymanager/All#SparkFun_BME280
#include <Arduino.h>

#include "log.h"
SparkFun_ENS160 myENS;
BME280 myBME280;

int ensStatus;

void setup() {
  Wire1.begin();

  Serial3.begin(115200);

  if (!myENS.begin()) {
    Serial3.println("Did not begin.");
    while (1)
      ;
  }

  if (myBME280.beginI2C() == false)  //Begin communication over I2C
  {
    Serial3.println("The sensor did not respond. Please check wiring.");
    while (1)
      ;  //Freeze
  }

  // Reset the indoor air quality sensor's settings.
  if (myENS.setOperatingMode(SFE_ENS160_RESET)) {
    Serial3.println("Ready.");
  }
  delay(100);

  // Device needs to be set to idle to apply any settings.
  // myENS.setOperatingMode(SFE_ENS160_IDLE);

  // Set to standard operation
  // Others include SFE_ENS160_DEEP_SLEEP and SFE_ENS160_IDLE
  myENS.setOperatingMode(SFE_ENS160_STANDARD);

  // There are four values here:
  // 0 - Operating ok: Standard Operation
  // 1 - Warm-up: occurs for 3 minutes after power-on.
  // 2 - Initial Start-up: Occurs for the first hour of operation.
  //                                              and only once in sensor's lifetime.
  // 3 - No Valid Output
  ensStatus = myENS.getFlags();
  Serial3.print("Gas Sensor Status Flag: ");
  Serial3.println(ensStatus);
}

void loop() {
  if (myENS.checkDataStatus()) {
    Serial3.print("Air Quality Index (1-5) : ");
    Serial3.println(myENS.getAQI());

    Serial3.print("Total Volatile Organic Compounds: ");
    Serial3.print(myENS.getTVOC());
    Serial3.println("ppb");

    Serial3.print("CO2 concentration: ");
    Serial3.print(myENS.getECO2());
    Serial3.println("ppm");

    Serial3.print("Humidity: ");
    Serial3.print(myBME280.readFloatHumidity(), 0);
    Serial3.println("RH%");

    Serial3.print("Pressure: ");
    Serial3.print(myBME280.readFloatPressure(), 0);
    Serial3.println("Pa");

    Serial3.print("Alt: ");
    //Serial3.print(myBME280.readFloatAltitudeMeters(), 1);
    //Serial3.println("meters");
    Serial3.print(myBME280.readFloatAltitudeFeet(), 1);
    Serial3.println("feet");

    Serial3.print("Temp: ");
    //Serial3.print(myBME280.readTempC(), 2);
    //Serial3.println(" degC");
    Serial3.print(myBME280.readTempF(), 2);
    Serial3.println(" degF");

    Serial3.println();
  }



  delay(200);
}

From my knowledge, the AVR-DB family uses Serial3 and Wire1 for UART(to serial monitor) and I2C,

The output of that program when uploaded with the built in programmer(curiosity) is:

Did not begin.

I have pushed the QWIIC connectors all the way in,
the power LED on the sensor()ENS160/BME280) turns on.

More info:
IDE 2.x.x
MacOS Sonoma
AVR-IoT Cellular Mini Microchip IoT Documentation
DxCore, latest version(drazzy)
Power is good,
I probed the SDA and SCL pins on the QWIIC connector and they are 3.3v
the power for the QWIIC connector is also 3.3v

I think this is a software issue.

I changed:

wire to wire1
Serial to Serial3

Thank you

here is a example of where someone successfully managed to use stemma/qwiic sensors with the same board: Sensor Cube 1 - Hackster.io

hoping that I don't have to modify a library(not sure how)
I think there is another argument I have to call for the setting up functions......

Is the QWIIC board identified by a I2C scanner ?

If not, can you detect any other I2C devices with an I2C scanner ?

I do not know, as I don’t have a I2C scanner,

I also don’t know,

I suppose I can use a I2C scanning program on a different 3.3V board……..
(I have a Pico and a ESP32,)
Thank you

Try a Google search on;

arduino i2c scanner

A scanner will tell you if any I2C devices are detected.

Thanks!
Will do!
Probably this week,

I’ll also try other QWIIC cables.

I have used one of Adafruit's program to scan.
There are somehow 3 devices detected,
Here is the output:

Scanning...
19:55:18.620 -> I2C device found at address 0x19  !
19:55:18.653 -> I2C device found at address 0x53  !
19:55:18.718 -> I2C device found at address 0x77  !
19:55:18.751 -> done

I think one of the addresses might be a built in sensor, have to check

Ok,
so 0x77 and 0x53 are used by the sensor,
not sure what went wrong......

@srnet
I have solved this.
It was a mistake in which I forgot to tell the library which Wire to use,
Solved.
Thank you very much.

(code, if anyone wants it)

/* Ex1_Combined_Basic_Example_ENS160_BME280.ino

This example shows basic data retrieval from the SparkFun Environmental Combo Breakout
from the Air Quality Sensor (ENS160) and Atmospheric Sensor (BME280).

This example shows how to read sensor readings from the ENS160 (air quality index tVOC, and eCO2)
and BME280 (humidity, pressure, and current temperature) over I2C.

Modified by:
Ho Yun "Bobby" Chan @ SparkFun Electronics August, 2023
Basic Example for the ENS160 Originally Written by:
Elias Santistevan @ SparkFun Electronics October, 2022
Basic Example for the ENS160 Originally Written by:
Nathan Seidle @ SparkFun Electronics March 9th, 2018

Products:
Air Quality Sensor  (ENS160)             -  https://www.sparkfun.com/products/20844
Humidity and Temperature Sensor (BME280) -  https://www.sparkfun.com/products/13676

Repository:
https://github.com/sparkfun/SparkFun_Indoor_Air_Quality_Sensor-ENS160_Arduino_Library

SparkFun code, firmware, and software is released under the MIT
License(http://opensource.org/licenses/MIT).

*/
//#define Serial3 //Serial3USB  //Uncomment if you are using a native USB like the Atmega32U4 or SAMD21


#include <Wire.h>
#include "SparkFun_ENS160.h"  // Click here to get the library: http://librarymanager/All#SparkFun_ENS160
#include "SparkFunBME280.h"   // Click here to get the library: http://librarymanager/All#SparkFun_BME280
#include <Arduino.h>

#include "log.h"
SparkFun_ENS160 myENS;
BME280 myBME280;

int ensStatus;

void setup() {
  Wire1.begin();

  Serial3.begin(115200);
  //delay(5000);
  //Serial3.println("Setting up.....");
  
  // myENS.setOperatingMode(SFE_ENS160_RESET);
  // myBME280.beginI2C();

  if (!myENS.begin(Wire1)) {
    Serial3.println("Did not begin.");
    while (1)
      ;
  }

  if (myBME280.beginI2C(Wire1) == false)  //Begin communication over I2C
  {
    Serial3.println("The sensor did not respond. Please check wiring.");
    while (1)
      ;  //Freeze
  }

  // Reset the indoor air quality sensor's settings.
  if (myENS.setOperatingMode(SFE_ENS160_RESET)) {
    Serial3.println("Ready.");
  }
  delay(100);

  // Device needs to be set to idle to apply any settings.
  // myENS.setOperatingMode(SFE_ENS160_IDLE);

  // Set to standard operation
  // Others include SFE_ENS160_DEEP_SLEEP and SFE_ENS160_IDLE
  myENS.setOperatingMode(SFE_ENS160_STANDARD);

  // There are four values here:
  // 0 - Operating ok: Standard Operation
  // 1 - Warm-up: occurs for 3 minutes after power-on.
  // 2 - Initial Start-up: Occurs for the first hour of operation.
  //                                              and only once in sensor's lifetime.
  // 3 - No Valid Output
  ensStatus = myENS.getFlags();
  Serial3.print("Gas Sensor Status Flag: ");
  Serial3.println(ensStatus);
}

void loop() {
  if (myENS.checkDataStatus()) {
    Serial3.print("Air Quality Index (1-5) : ");
    Serial3.println(myENS.getAQI());

    Serial3.print("Total Volatile Organic Compounds: ");
    Serial3.print(myENS.getTVOC());
    Serial3.println("ppb");

    Serial3.print("CO2 concentration: ");
    Serial3.print(myENS.getECO2());
    Serial3.println("ppm");

    Serial3.print("Humidity: ");
    Serial3.print(myBME280.readFloatHumidity(), 0);
    Serial3.println("RH%");

    Serial3.print("Pressure: ");
    Serial3.print(myBME280.readFloatPressure(), 0);
    Serial3.println("Pa");

    Serial3.print("Alt: ");
    //Serial3.print(myBME280.readFloatAltitudeMeters(), 1);
    //Serial3.println("meters");
    Serial3.print(myBME280.readFloatAltitudeFeet(), 1);
    Serial3.println("feet");

    Serial3.print("Temp: ");
    //Serial3.print(myBME280.readTempC(), 2);
    //Serial3.println(" degC");
    Serial3.print(myBME280.readTempF(), 2);
    Serial3.println(" degF");

    Serial3.println();
  }



  delay(200);
}