I have sparkfun indoor air quality sensor CCS811 which needs to be interfaced with arduino. I have soldered wires on the sensors and connected with arduino. Have checked the connection with multimeter so that part works. But even using example code on library still I am not getting reading from sensor.
Code:-
#include <Wire.h>
#include "SparkFunCCS811.h"
#define CCS811_ADDR 0x5B //Default I2C Address
//#define CCS811_ADDR 0x5A //Alternate I2C Address
CCS811 mySensor(CCS811_ADDR);
void setup()
{
Serial.begin(9600);
Serial.println("CCS811 Basic Example");
Wire.begin(); //Inialize I2C Harware
//It is recommended to check return status on .begin(), but it is not
//required.
CCS811Core::status returnCode = mySensor.begin();
if (returnCode != CCS811Core::SENSOR_SUCCESS)
{
Serial.println(".begin() returned with an error.");
//while (1); //Hang if there was a problem.
}
}
void loop()
{
//Check to see if data is ready with .dataAvailable()
if (mySensor.dataAvailable())
{
//If so, have the sensor read and calculate the results.
//Get them later
mySensor.readAlgorithmResults();
Serial.print("CO2[");
//Returns calculated CO2 reading
Serial.print(mySensor.getCO2());
Serial.print("] tVOC[");
//Returns calculated TVOC reading
Serial.print(mySensor.getTVOC());
Serial.print("] millis[");
//Simply the time since program start
Serial.print(millis());
Serial.print("]");
Serial.println();
}
delay(10); //Don't spam the I2C bus
}
Things I tried:- 1) different combination of A4, A5 pins 2) 0x5A & 0x5B i2c address 3) using wake pin with ground 4) using 3.3 & 5V for powering sensor
What else needs to be done?