General Gravity

SEN0536 CO2 sensor

userHead brooksdr 2024-05-21 13:58:18 312 Views1 Replies

I have written code to read CO2 data from this sensor and display it along with data from a BME280 T/RH/P sensor on a small OLED. When I try to add data logging to this system, I of course initialize the RTC to get and store a date/time on the data logging shield. But then when I upload the data logging code for the CO2 sensor, the time is correct for the first set of data outputs, but after subsequent trips through the if… loop to get CO2 data that data is OK but the date/time is corrupted. 

     This makes no sense to me and I'm at a loss for what to do about it. Does anyone have an explanation or suggestions??

2024-05-26 08:05:22

Hi, you did not mention what board you're using as your main controller and which RTC you are using. Maybe you are running out of memory. Arduino microcontrollers have limited RAM, and when you initialize multiple sensors and peripherals, it's easy to exceed available memory.Use the freeMemory() function to check for memory overflows.

If both your RTC and CO2 sensor are using the I2C bus, there could be conflicts.

Here is an ESP32-based CO2 monitoring system. You can check it for more references. 

https://www.pcbway.com/project/shareproject/CO2_Monitoring_System_d36aa302.html

userHeadPic lia.ifat