Feature request: calibrate_linear ideally takes more than two calibration values #3354
-
Describe your core improvementFor ADC sensor voltage measurement, it is more intuitive if calibrate_linear could take more than two values. For example, calibrate_linear:
- 0.5 -> 1
- 1.0 -> 10
- 2.0 -> 50Where linear calculation applies between two values.
Current limitationscalibrate_linear only supports two values when calibration can have many points. Technical benefitsI am looking to set up a home water pressure sensor with esp32 and I would likely try to calibrate the sensor every 10psi to get an accurate enough for me reading of the water pressure. Multiple calibration points makes sense to increase accuracy of whatever is being measured. Additional contextI have no experience with this so am just experimenting. When I was looking up how to calibrate esp32 adc I found this confusing issue report esphome/issues#2768 Requiring only two calibration values seems pretty limiting. You can still have a linear calibration between two values going from smaller to bigger when you have high and low values. A list of values would just be linearly calibrated between next highest and next lowest if the list has multiple values. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The example in the documentation for calibrate_linear shows multiple data points. By default it does a least_squares linear fit to your datapoints, but I think you can accomplish what you want by specifying |
Beta Was this translation helpful? Give feedback.
The example in the documentation for calibrate_linear shows multiple data points. By default it does a least_squares linear fit to your datapoints, but I think you can accomplish what you want by specifying
method: exact.