Sensirion / raspberry-pi-i2c-scd4x

RaspberryPi driver for Sensirion SCD4x sensors
BSD 3-Clause "New" or "Revised" License
20 stars 9 forks source link

read errors #3

Closed saket424 closed 3 years ago

saket424 commented 3 years ago

I hooked up a new sensirion scd41 sensor to a raspberry pi 3a+. It worked for a while and then abruptly started failing. Any ideas why?

pi@pi3a1:~/raspberry-pi-i2c-scd4x $ ./scd4x_i2c_example_usage serial: 0x13079f073b37 Waiting for first measurement... (5 sec) CO2: 497 ppm Temperature: 25.81 °C Humidity: 24.57 RH CO2: 537 ppm Temperature: 25.41 °C Humidity: 24.96 RH CO2: 533 ppm Temperature: 24.91 °C Humidity: 25.37 RH CO2: 537 ppm Temperature: 24.47 °C Humidity: 25.80 RH CO2: 539 ppm Temperature: 24.12 °C Humidity: 26.20 RH CO2: 545 ppm Temperature: 23.74 °C Humidity: 26.59 RH CO2: 540 ppm Temperature: 23.33 °C Humidity: 26.99 RH CO2: 538 ppm Temperature: 23.05 °C Humidity: 27.35 RH CO2: 536 ppm Temperature: 22.48 °C Humidity: 27.97 RH CO2: 536 ppm Temperature: 22.16 °C Humidity: 28.24 RH CO2: 536 ppm Temperature: 21.94 °C Humidity: 28.56 RH CO2: 536 ppm Temperature: 21.74 °C Humidity: 28.80 RH CO2: 536 ppm Temperature: 21.49 °C Humidity: 29.11 RH CO2: 535 ppm ... ... Temperature: 18.03 °C Humidity: 37.25 RH CO2: 463 ppm Temperature: 18.07 °C Humidity: 37.24 RH CO2: 463 ppm Temperature: 18.03 °C Humidity: 37.25 RH Error executing scd4x_read_measurement(): -1 Error executing scd4x_read_measurement(): -1 Error executing scd4x_read_measurement(): -1 Error executing scd4x_read_measurement(): -1

saket424 commented 3 years ago

now it even has trouble retrieving the serial number

pi@pi3a1:~/raspberry-pi-i2c-scd4x $ ./scd4x_i2c_example_usage Error executing scd4x_get_serial_number(): -1 Error executing scd4x_start_periodic_measurement(): -1 Waiting for first measurement... (5 sec) Error executing scd4x_read_measurement(): -1 Error executing scd4x_read_measurement(): -1

psachs commented 3 years ago

Hi,

Are you working with the most recent code and example? One thing you have to consider, is that the SCD41 has an internal measurement command which has to be stopped, before starting again. This should however also be solved by remove the power supply for a short while.

If you tried this already and it still fails try to perform a factory reset and afterwards a self test. It would also help to post the result of the self test (the data that is written to the sensor_status) .

uint16_t sensor_status = 0;

scd4x_perform_factory_reset();
scd4x_perform_self_test(&sensor_status);