Sensirion SCD30 AirQuality Sensor for Reef-Pi

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
I have finished the first release for my SCD30 software interface for Reef-Pi:

Installation Instructions can be found in the ReadMe on the main Page.
 
OP
OP
S

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
For anybody who wants to get the sensor:
if you operate your I2C network at 5V with a level shifter instead of 3.3V, take care that you buy a SCD30 board that also includes a level shifter, as the SCD30 natively couples its SCL and SDA lines to its internal 3.3V, not the external VCC.
I for example got the Adafruit SCD30 board which includes this level shifting and I could simply hook up to my 5V I2C network
 
OP
OP
S

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Data looks pretty nice:
1671130662079.png
1671130917949.png


You can see the dip in the beginning when I vented the room, the drop in CO2 to 450 ppm when I recalibrated, and the increase to around 800 ppm when I opened the door and the CO2 level equilibrated across my apartment.
The temperature dip in the room to around 18°C is also nicely retraced to the temperature that my two DS18B20 temperature sensors had, showing that the temperature offset also works as expected.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,056
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Whoa :-0) .this is so cool. I really want to see some close loop validation, like ato usage should be influenced by only ambient temperature , humidity and air flow (should be Less important). Reef-pi should check this loop and establish what’s normal , and alert when things are out of whack …
 
OP
OP
S

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Whoa :-0) .this is so cool. I really want to see some close loop validation, like ato usage should be influenced by only ambient temperature , humidity and air flow (should be Less important). Reef-pi should check this loop and establish what’s normal , and alert when things are out of whack …
That would be interesting indeed !

I’ll think about a physical model that we can implement into software.
Air flow is a pretty big factor actually, depending on condition I wager, as it will disrupt the insulating layer of humid air above the water that can form in the absence of large temperature differences. As long as you don’t have a fan to cool the tank, I believe you are right though in that it should maybe range below 10% in normal rooms, depending on placement and tank geometry.
Another interesting factor is salinity, as that will decrease evaporation. That should be pretty constant in a single tank though. How much does this vary between tanks ? No experience here on my end ^^
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,056
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
That would be interesting indeed !

I’ll think about a physical model that we can implement into software.
Air flow is a pretty big factor actually, depending on condition I wager, as it will disrupt the insulating layer of humid air above the water that can form in the absence of large temperature differences. As long as you don’t have a fan to cool the tank, I believe you are right though in that it should maybe range below 10% in normal rooms, depending on placement and tank geometry.
Another interesting factor is salinity, as that will decrease evaporation. That should be pretty constant in a single tank though. How much does this vary between tanks ? No experience here on my end ^^
Could be. I mean this is exactly what we can find out once we setup the close loop modeling , what’s influencing what
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,056
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Do you have any information on how to do close loop modeling or a good spource to learn about it ?
That’s a pretty big topic, https://en.wikipedia.org/wiki/Control_system provides a good overview.
this is a good intro on closed loop control system ; https://www.techtarget.com/whatis/definition/closed-loop-control-system
at my work, we develop multiple types of closed loop control system, some pid, while other stochastic (ai/ml) and some others are mixed mode. Some examples:
planet scale auto scaling at uber : https://www.uber.com/blog/capacity-recommendation-engine/
automated go gc tuning : https://www.uber.com/blog/how-we-saved-70k-cores-across-30-mission-critical-services/
adaptive load testing using pid controller : https://www.uber.com/blog/introducing-ballast-an-adaptive-load-test-framework/

these are all our team at uber :) , hope you see the connection why reef-pi and what we do at work is somewhat similar theory but application in very different context
 
OP
OP
S

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
That’s a pretty big topic, https://en.wikipedia.org/wiki/Control_system provides a good overview.
this is a good intro on closed loop control system ; https://www.techtarget.com/whatis/definition/closed-loop-control-system
at my work, we develop multiple types of closed loop control system, some pid, while other stochastic (ai/ml) and some others are mixed mode. Some examples:
planet scale auto scaling at uber : https://www.uber.com/blog/capacity-recommendation-engine/
automated go gc tuning : https://www.uber.com/blog/how-we-saved-70k-cores-across-30-mission-critical-services/
adaptive load testing using pid controller : https://www.uber.com/blog/introducing-ballast-an-adaptive-load-test-framework/

these are all our team at uber :) , hope you see the connection why reef-pi and what we do at work is somewhat similar theory but application in very different context
Would like to see them, but the uber-pages don't exist any more, at least for me :grinning-face-with-sweat:
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,951
Reaction score
3,353
Location
Sacramento, CA area
Rating - 0%
0   0   0
Nice to see the SCD30 / NIR sensors. The little on chip CO2 estimated sensors drift so much they’re pretty pointless. Also very useful to track CO2 buildup in well sealed houses (which is why some people bring in outside air for skimmers for example)
 
OP
OP
S

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Nice to see the SCD30 / NIR sensors. The little on chip CO2 estimated sensors drift so much they’re pretty pointless. Also very useful to track CO2 buildup in well sealed houses (which is why some people bring in outside air for skimmers for example)
Absolutely ! I plan to add CO2 to my tank to feed the plants, so I would definitely like to know how much of that ends up in my living room :grinning-face-with-sweat:
 
OP
OP
S

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
What made you choose scd30 over the mh-z19 or scd40?
The SCD-30 was available as a nice package on Adafruit and was the first somewhat ReefPi compatible true CO2 sensor I found. Afterwards I didn't look further to be honest :grinning-face-with-sweat:

I had a look at the MH-Z19 just now, seems to draw a lot more current at startup and only has UART and PWM output, so it seems less easy to interface with ReefPi. But maybe I'm wrong there. Additionally, it only measures CO2, it doesn't give the full range of Temperature, Humidity and CO2.
The SCD 40 looks interesting. Does almost the same job, but with a lower range and accuracy. The SCD-41 is comparable to the SCD-30, so would be a good alternative on a smaller footprint.
 

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,520
Reaction score
1,511
Rating - 0%
0   0   0
The SCD-30 was available as a nice package on Adafruit and was the first somewhat ReefPi compatible true CO2 sensor I found. Afterwards I didn't look further to be honest :grinning-face-with-sweat:

I had a look at the MH-Z19 just now, seems to draw a lot more current at startup and only has UART and PWM output, so it seems less easy to interface with ReefPi. But maybe I'm wrong there. Additionally, it only measures CO2, it doesn't give the full range of Temperature, Humidity and CO2.
The SCD 40 looks interesting. Does almost the same job, but with a lower range and accuracy. The SCD-41 is comparable to the SCD-30, so would be a good alternative on a smaller footprint.
Ah ok. At least for co2, I don't think the 5000 range is really needed, though I do have it myself on mine . The other night at a candlelight dinner with a few too many candles I noticed that the battery of my portable monitor (I think it's got a mh-z19 in it) went out. When I got it back on it showed 2200, already wasn't very pleasant. Couldn't imagine tolerating even higher than that in my home, I usually air the room when i notice it in the 1000-1300 range. 2000 and above is more of a you need to act now.


Been wanting to switch to a diy version that I can integrate into automation so Ive been looking into the different sensors, scd30 just happens to be the most expensive one. Lack of i2c isn't nice, didn't think of that, had the esp integration route in mind.

Btw, when you have these in auto calibration mode, you need to air the room until they stabilize at or below 400 for a couple minutes every now and then, otherwise they'll drift off.
 
OP
OP
S

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Ah ok. At least for co2, I don't think the 5000 range is really needed, though I do have it myself on mine . The other night at a candlelight dinner with a few too many candles I noticed that the battery of my portable monitor (I think it's got a mh-z19 in it) went out. When I got it back on it showed 2200, already wasn't very pleasant. Couldn't imagine tolerating even higher than that in my home, I usually air the room when i notice it in the 1000-1300 range. 2000 and above is more of a you need to act now.


Been wanting to switch to a diy version that I can integrate into automation so Ive been looking into the different sensors, scd30 just happens to be the most expensive one. Lack of i2c isn't nice, didn't think of that, had the esp integration route in mind.

Btw, when you have these in auto calibration mode, you need to air the room until they stabilize at or below 400 for a couple minutes every now and then, otherwise they'll drift off.
Well "Need" is relative, 2000 isn't harmfull as far as I know, it just impairs cognitive function a bit. If I have a leak in CO2 I would actually want to know how far above 2000 I am before entering the room ^^

Regarding the sensors: you could probably make a mh-z19 work as well. Microcontrollers usually are pretty good at reading PWM duty cycle and even if that doesn't work well, you can always smooth the PWM to DC and read that with the AnalogInput. Mind only that you might need to offset the dc voltage signal depending on the signal range, since the ESP32's AnalogInputs are pretty crappy.

If you want ReefPi integration via the ESP32, this might actually be the best Route, otherwise you would have to write your own I2C functions. Another comparatively easy way would be the UART serial port. That should also be pretty easy to do in Arduino C++ with the ESP32 Arduino core. Standard Serial-class should probably work.
 

Clear reef vision: How do you clean the inside of the glass on your aquarium?

  • Razor blade

    Votes: 168 62.2%
  • Plastic scraper

    Votes: 70 25.9%
  • Clean-up crew

    Votes: 93 34.4%
  • Magic eraser

    Votes: 46 17.0%
  • Other

    Votes: 70 25.9%
Back
Top