I have followed some other peoples ideas and connected a fuel tanks sensor (Water Fuel Level Sender Tank Level Sending Unit Car Marine Boat 240-33 ohms AU | eBay) to a ESP32. Very similar setup to Water tank - water level sensor using fuel/water sender and esphome
I have setup a voltage divider (I can’t remember the resistance I ended up using, but it’s around 200 Ohms) and I get a range of voltages from about 0.6V to 2V.
The problem is that the ESP32 only seems to pickup about 15 steps for the entire 240mm range. I would like the measurements to be much more accurate then that. Does anyone have any experience with getting accurate ADC values? Is it a limitation of the ESP32? From testing the sensor the resistance seems to change linearly with the depth
My config is included below:
esphome:
name: esp32-devkitc-water-level
esp32:
board: esp32dev
framework:
type: arduino
...
sensor:
- platform: adc
pin: GPIO32
name: "Raw Water Level Voltage"
id: water_raw_voltage
unit_of_measurement: "V"
update_interval: 120s
attenuation: auto
accuracy_decimals: 3
- platform: adc
pin: GPIO32
name: "Water Level Poly Offset"
id: water_offset
unit_of_measurement: "mm"
update_interval: 120s
attenuation: auto
accuracy_decimals: 3
filters:
- calibrate_polynomial:
degree: 3
datapoints:
- 2.050 -> 0
- 1.627 -> 10
- 1.626 -> 20
- 1.619 -> 30
- 1.554 -> 40
- 1.477 -> 50
- 1.466 -> 60
- 1.475 -> 70
- 1.389 -> 80
- 1.386 -> 90
- 1.389 -> 100
- 1.189 -> 120
- 1.187 -> 130
- 1.041 -> 140
- 1.038 -> 150
- 0.870 -> 160
- 0.868 -> 170
- 0.632 -> 180
- 0.630 -> 190