Sensirion / arduino-i2c-scd4x

Arduino library for Sensirion SCD4x sensors
BSD 3-Clause "New" or "Revised" License
48 stars 19 forks source link

Measure stability at startup #13

Closed ChristopheLaurent closed 2 years ago

ChristopheLaurent commented 2 years ago

I've just started using SCD41 evaluation module with an Arduino UNO for preliminary test purpose. It works with your provided example, but I found that the measures takes about 1 minute to stabilize, as you can see in the recorded data below (stable conditions, actual temperature = 21 deg) :

Serial: 0xC03ABF073B4D Waiting for first measurement... (5 sec) CO2 [ppm], Temp [degC], Humidity [%] 832, 22.03, 29.41 827, 21.98, 29.49 808, 21.88, 29.72 831, 21.81, 30.01 858, 21.74, 30.38 863, 21.65, 30.48 859, 21.58, 30.70 854, 21.52, 30.76 852, 21.46, 30.89 884, 21.40, 31.37 934, 21.37, 31.87 954, 21.31, 31.96 1020, 21.28, 32.06 1095, 21.24, 32.38 1141, 21.21, 33.02 1166, 21.19, 33.02 1167, 21.15, 32.77 1166, 21.15, 32.62 1151, 21.13, 32.46

I plan to use this module with a battery powered ESP32 board, in order to do a periodic CO2 measure (basically every minute) during a couple of days. I planned to have my module in deep sleep between 2 successive measures. Each measure should not last more than a couple of seconds.

What would be the best hardware and/or software design to get an accurate measure between two deep sleep ?

Let's suppose that my ESP32 wakes up every minute to do a single measure. Should the SDC41 be powered all the time, with a periodic measure period = 30s using startLowPowerPeriodicMeasurement(), so that the ESP32 reads a measure less than 30s old ?

psachs commented 2 years ago

Hi @ChristopheLaurent

For periodic measure mode you do not need to wake up and receive the measurements if you are not interested in them. However, the sensor module will draw power while in periodic measure mode (e.g. 3mA @5V in low power mode. see datasheet). So my suggestion is to run the sensor in low power mode but drop every other measurement (since you only wake up e.g. once per minute).

Worst case is of course that your measurement is 30s old. However, for CO2 low power applications I wouldn't be to concerned about that as the CO2 levels don't change that fast in a normal environment.

It is also perfectly normal that the sensor needs around 60s to stabilize after power up depending on environment and measurement mode.