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