-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Add CO2 sensing with SCD4X #4601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Since this one has temperature and humidity in addition to co2, it looks like it spans our EnvironmentMetrics and AirQualityMetrics. Do you have a sense for how easy it would be to put the co2 in AirQualityMetrics and keep the temp/humidity in EnvironmentMetrics? |
|
I'll work on moving it over to AirQualityMetrics instead of EnvironmentMetrics - although I noticed that IAQ is also in EnvironmentMetrics, should that be moved as well? |
|
Hm yeah, I'm looking closer at AirQualityModule and it's going to be more involved than I'd hoped - AirQualityModule explicitly wants a Adafruit_PM2.5 sensor ( |
|
Thanks for the heads up! Will take a look in the next few days. |
Previously the module was designed around a single sensor. This patch brings it into line with the same design as EnvironmentTelemetry.
|
@Coloradohusky - I hacked together some things over at It compiles ... but I haven't got it further than that :) Do you think you'd be able to hack from there and test with your sensor? |
|
@Coloradohusky , have hacked this a bit more. In theory you might also get a screen on your UI with CO2 readings too. Can you test & improve? =D |
|
Was checking it out just now! Will keep testing 😄 |
|
OK, over to you -- I'll hold off making any more commits |
|
Haven't had much luck yet - it properly detects the sensor, but doesn't grab any measurements. Not sure what's preventing the measurements but will keep testing |
|
As mentioned before, I didn't got this branch in a working state and started over. There are also many changes in the firmware ongoing and the PMSA003I got also some changes, which must be applied here. I suggest to start a new branch with the SCD4x sensor and keep it simple. Get it working to read out the values and send them via telemetry. In my opinion the support for displays can be added in another PR, but it is a nice to have.
I did another approach, at least for the SCD30: The SCD30 comes with an extra temperature/humidity sensor (RH/T something) integrated for calibration. I have to read the datasheet for the SCD4x if it is alike. Therefore I suggest to use the values from the integrated temperature/humidity sensor as environment metrics and calibration, if no other sensor is available. I also wanted to start on a new branch this week, since I have now a SCD4x. |
|
Hi @hafu, We are doing a hackathon next week to integrate a whole bunch of air quality sensors into meshtastic (we are coming from a project called smartcitizen with a lot of sensors supported including these). For the hackathon, we have a selection of sensors that overlap with: scd30, scd40, sfa30, sen5x and sen6x series which we are mapping here: fablabbcn#4, and most of them are multisensor nodes that have to be agreed on how the firmware treats the readings. I think it'd be great if we manage to all sync on this effort, and have a joint approach for integrating these... We can probably discuss the reasoning on discord or a joint call together? I think we can find an agreement on the approach, and potentially even work on a new branch together (maybe on the hackathon repo? What do you think? |
Sounds great! This would also be my first major contribution to the project. I did some tinkering with modules, sensors and build my customized meshtastic firmware. Getting CO2 sensors running with meshtastic is on my to do list since the beginning of the year. I give discord another try, if this is the preferred way. Tomorrow I have some time to discuss. A call is also possible tomorrow. |
A comment to an old comment: I had some issues with the SCD30 too. I figured out, that the SCD30 only works reliable with 5V. Maybe the 3.3V power rail is a bit to low and prevents the sensor from working properly. |
I think this should be no issue... we have used SCD30 for very looong data collections (+2 years). (some SCD30 docs here https://docs.smartcitizen.me/knowledge/air/co2/Sensirion_SCD30/) |
I think one very good way to start would be to have a clean branch, updated with master, that has the decouple of |
|
I now have a functional SCD4X and am starting to test and edit this patch a bit. I can confirm the I2C detection code works at least :) |
This patch adds I2C detection support SCD40/SDC41 CO2 sensors. It's a start to get meshtastic#4601 over the line :) Co-Authored-By: @Coloradohusky
|
Trying to clean this up a little for you so you can have a more pleasant hackathon. |
* Add detection code for SCD4X This patch adds I2C detection support SCD40/SDC41 CO2 sensors. It's a start to get #4601 over the line :) Co-Authored-By: @Coloradohusky * Remove SCD4X from Portduino
Now we have the ability to detect multiple AirQualitySensors, follow the lead of other sensor types and create supporting methods and objects for using this information. Continued cherry-picking to get meshtastic#4601 over the line :) Co-Authored-By: @Coloradohusky
Now we have the ability to detect multiple AirQualitySensors, follow the lead of other sensor types and create supporting methods and objects for using this information. Continued cherry-picking to get meshtastic#4601 over the line :) Co-Authored-By: @Coloradohusky
* Add detection framework for multiple AirQuality sensors Now we have the ability to detect multiple AirQualitySensors, follow the lead of other sensor types and create supporting methods and objects for using this information. Continued cherry-picking to get #4601 over the line :) Co-Authored-By: @Coloradohusky * Update src/main.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@oscgonfer Sorry, I got sick, but I got some energy today and tried out your PR and gave some feedback. |
This PR adds support for CO2 sensing with the SCD40/SCD41 sensors. These sensors also support temperature and relative humidity.
Currently, it is using
startLowPowerPeriodicMeasurement, which has an update interval of ~30 seconds. However, the datasheet mentions ameasure_single_shotfor lower power use, but says it is limited to SCD41 sensors only. Nonetheless, I tried it on my SCD40 sensor and it appeared to work fine.measure_single_shotalso includes a delay of 5 seconds for each use.Average Supply Current:
Other than that, the only differences between SCD40 and SCD41 are a wider CO2 interval and higher accuracy.
See SCD4x Low Power Operation and the Datasheet for more information.
Thanks