-
Notifications
You must be signed in to change notification settings - Fork 54
SGP30 / SGP40 background sampling #811
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: main
Are you sure you want to change the base?
Conversation
Add SGP30 / SGP40 background sampling. Requires frequently 1s polling or returns 0 values.
0ee75ca
to
662f61c
Compare
also added sgp30 averaging option
I can confirm the SGP40 works with this PR. I tested using: Adafruit Qt Py ESP32-S3 (2MB PSRAM) Trying different settings from 1 second --> 15 minute update intervals for prolonged periods (hours) was working with the keep alive code. The SGP30 changes are untested as I don't have one on hand. |
brent and tyeth are both out right now but they'll review when return! |
Thanks @mikeysklar, this has been weighing on my mind for a while as there are a few we currently "support" that are out of spec in their current use. I thought there was an existing issue, but can't find one, must be thinking of forum discussions. The only other previous related thoughts were that it might be worth having an internal poll period defined for each component (with a matching entry in the components repo JSON definition), and then a separate publish period (the current thing in definition file), both potentially displayed to the user (publish >= poll in interface) although we'd then need to specify max and min as well as default internal poll period (fastTick speed). On the averaging front, it might be best to leave it to the current techniques, as I think it's probably expected that the moment it publishes data the value represents the current value and not a time accumulated average. The user can see averaged data instead using the dashboard and feed pages and APIs (charts and API get access to aggregated data at various time intervals), and possibly Actions. These are all minor things, and more an attempt to uncork my stored up thoughts on the issue. I'll bring it up with Brent as to how he'd like to proceed, which will be next week, but I can't see any problem with the current idea at all. |
Thank you for the larger explanation. Using a polling frequency value in the JSON config makes a lot of sense. Another issue @Timeline pointed out is deep sleep mode which I believe is still in the works. I bring it up here only that continuous background polling could cancel out the ability to use sleep mode with these sensors. A few more options to consider as JSON config values:
If you are doing hourly air quality samples it doesn't make a lot of sense to keep the controller awake and polling every second. |
Add SGP30 / SGP40 background sampling. Requires frequently 1s polling or returns 0 values.
Untested and only a proof of concept for feedback. This adds fastTick() polling to keep the SGPxx sensors producing usable data. Thanks @Timeline for the key insight of 1s polling being needed.
Difference observed between 15min polling versus 1s with the SGP40.
Address issue 732
Forum issues:
SGP30 issue with WipperSnapper
SGP40 Air Quality