STC31 Returning Highly Varied/Incorrect Values

Attempting to build a prototype using the STC31 CO2 sensor (https://www.sparkfun.com/products/18385). However, I am experiencing a couple of issues, tried the following things, and have observed the following potential symptoms. These runs are all using sample code for the STC31 arduino library, or some light variation on top (for example, averaging an array to try to smooth the resulting values). The sensor is sitting inside a sealed chamber with ambient air in it sitting on nylon standoffs.

Components:

  • RedBoard Plus

  • USB/USB-C cable going to Windows 10 Laptop

  • 625mA 3.3V Power Supply

  • STC31 Sensor
  • Issues:

  • The sensor will start observing a seemingly random value for CO2 concentrations and hover around that observation for the life of the program. For example, one run it may start at -9% CO2 concentration and over around there. Another run it may start at 10% CO2 concentration and hover around there. This is all in the same ambient air environment by mere minutes between runs.

  • When the sensor does appear to be operating correctly (reporting around 0.04% CO2 or ~440 PPM) the readings vary wildly. I may get the following readings as follows which average to ~440 PPM +/- 10%, but the individual readings are highly varied:

    CO2 %: -0.02

    CO2 %: 0.06

    CO2 %: 0.02

    CO2 %: -0.01


  • What I’ve Tried:

    In order to rectify this I have tried to use the soft reset, forced recalibration, and automatic recalibration methods in the library to attempt to get the sensor to behave. However, no combination of these options results in the sensor operating consistently on first boot and the either or both of the above issues are present.

    What I’ve Observed:

    When I first set this system up I had the RedBoard plugged in to both the computer and the wall. When I ran the self-test in this scenario I got an error response of 0x0200 (VDD Out of Range). I was able to rectify this by removing the external power supply and powering the setup through the laptop connection only. I’m not sure if this has anything to do with it, but I am seeing the same inconsistent results once the self test started passing.

    Maybe try measuring VDD with a voltmeter to see if it is fluctuating?

    There’s also usually a burn-in period while the sensors on the board get up to temp…are the tests being performed after reaching steady temps? Also, are the RH, temp, etc being set before the calibration routine?

    Yeah, I’ll check the VDD to ensure it is stable.

    Yes, I am compensating for RH & Temp before the calibration routine(s). All of these tests were run for a max of 10 minutes, but seeing a fluctuation in the range of -20% → 15% in a static environment between restarts (no noticeable pattern) seemed strange to me. Let me try running these for longer. Will get back with the results. Thank you!

    Hi,

    The self-test response of 0x0200 (VDD Out of Range) is a bit worrying.

    How long is the Qwiic cable between the RedBoard and the STC31? I’m wondering if the cable length is causing issues / errors.

    It would be helpful if you could post a photo of your set-up. Add a wiring diagram too if possible - a photo of a sketch would help.

    (I’m a bit puzzled why you thought a separate 3.3V power supply was necessary. The Qwiic cable will provide power for the STC31 board.)

    Best wishes,

    Paul

    Another clue would be if you see any “STC3x::measureGasConcentration: encountered error reading STC3x data.” errors in the debug messages. That indicates that all is not well with the I2C communication - the CRC check is failing. The CO2 and Temperature measurements will stick at the previous / initial value if that happens.