-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add ADC multisampling #6330
Add ADC multisampling #6330
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #6330 +/- ##
==========================================
+ Coverage 53.70% 54.21% +0.50%
==========================================
Files 50 50
Lines 9408 9594 +186
Branches 1654 1691 +37
==========================================
+ Hits 5053 5201 +148
- Misses 4056 4069 +13
- Partials 299 324 +25 ☔ View full report in Codecov by Sentry. |
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
Use esphome/esphome#6330 to enable sampling on adc sensor and smooth the data. Solves #1918
You might wanna know we are playing with this solution on Blackymas/NSPanel_HA_Blueprint#1918 with positive results so far. |
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
I'm getting this when compiling with ESPHome 2024.5.0b4:
|
@edwardtfn |
What does this implement/fix?
Added a new feature to sample the ADC multiple times in one reading and return the average. This is recommended by Espressif for noise reduction. Compared to increasing the update rate of the sensor this has the advantage that some math operations only need to be executed once and the averaging is done using integers.
For now it only takes multiple samples on the ESP32 if attenuation is not set to auto.
Tested on the ESP32, ESP8266 and RP2040. Testers needed for LibreTiny.
Types of changes
Related issue or feature (if applicable): fixes
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3664
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: