Incorporate note about changes in ESP32 ADC (#1643)

This commit is contained in:
Carlos Garcia Saura 2021-11-20 20:31:03 +01:00 committed by GitHub
parent bbe71ea1db
commit 20b9f5846e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ Configuration variables:
- **name** (**Required**, string): The name of the voltage sensor.
- **attenuation** (*Optional*): Only on ESP32. Specify the ADC
attenuation to use. See :ref:`adc-esp32_attenuation`. Defaults to ``0db``.
- **raw** (*Optional*): Allows to read the raw ADC output without any conversion or calibration. Defaults to ``false``.
- **raw** (*Optional*): Allows to read the raw ADC output without any conversion or calibration. See :ref:`adc-raw`. Defaults to ``false``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval
to check the sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
@ -71,6 +71,27 @@ To simplify this, we provide the setting ``attenuation: auto`` for an automatic/
Even though the measurements are calibrated, the range *limits* are variable among chips due to differences in the internal voltage reference.
.. _adc-raw:
Different ESP32-ADC behavior since 2021.11
------------------------------------------
The ADC output reads voltage very accurately since 2021.11 where manufacturer calibration was incorporated. Before this every ESP32 would read different voltages and be largely innacurate/nonlinear. Users with a manually calibrated setup are encouraged to check their the installations to ensure proper output.
For users that don't need a precise voltage reading, the "raw" output option allows to have the raw ADC values (0-4095 for ESP32) prior to manufacturer calibration. It is possible to get the old uncalibrated measurements with a filter multiplier:
.. code-block:: yaml
# To replicate old uncalibrated output, set raw:true and keep only one of the multiplier lines.
raw: true
filters:
- multiply: 0.00026862 # 1.1/4095, for attenuation 0db
- multiply: 0.00036630 # 1.5/4095, for attenuation 2.5db
- multiply: 0.00053724 # 2.2/4095, for attenuation 6db
- multiply: 0.00095238 # 3.9/4095, for attenuation 11db
# your existing filters would go here
Note we don't recommend this method as it will change between chips, and newer ESP32 modules have different ranges (i.e. 0-8191); it is better to use the new calibrated voltages and update any existing filters accordingly.
.. _adc-esp8266_vcc:
ESP8266 Measuring VCC