0

i have an Arduino uno board and a sparkfun ccs811 sensor. I tried to reproduce the howto from the sparkfun homepage (https://learn.sparkfun.com/tutorials/ccs811-air-quality-breakout-hookup-guide?_ga=2.45231532.967238096.1560976781-258902726.1560976781), including the error states part.

I uploaded one picture of the wiring (updated). I also tried to use an alternative hardware connection with SDA to A4 and SCL to A5 as it is mentionned in the code comments (see homepage).

However, it is just not working and i always get this error code in the serial monitor beginCore exited with: I2C_ERROR

Here is my code (without the top comment block):

#include <Wire.h>

#include "SparkFunCCS811.h" //Click here to get the library: http://librarymanager/All#SparkFun_CCS811

#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();
Serial.print("beginCore exited with: ");
switch ( returnCode )
{
case CCS811Core::SENSOR_SUCCESS:
 Serial.println("SUCCESS");
 break;
case CCS811Core::SENSOR_ID_ERROR:
 Serial.println("ID_ERROR");
 break;
case CCS811Core::SENSOR_I2C_ERROR:
 Serial.println("I2C_ERROR");
 break;
case CCS811Core::SENSOR_INTERNAL_ERROR:
 Serial.println("INTERNAL_ERROR");
 break;
case CCS811Core::SENSOR_GENERIC_ERROR:
 Serial.println("GENERIC_ERROR");
 break;
default:[enter image description here][2]
 Serial.println("Unspecified error.");
}


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
}

enter image description here

  • 1
    Can it be, that your ground connection to the sensor is at the wrong place? On the image it looks like the violet wire is connected one pin to the right of the ground pin – chrisl Oct 12 at 16:28
  • You were right; i just fixed it and uploaded a new image. But its still not working. – Harry333 Oct 12 at 17:30
5

You need to solder those headers to the breakout. Just inserting them into the plated-through-holes doesn't give a reliable connection.

  • So simple, though hard to recognize :D – Sim Son Oct 13 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.