I’m using ESPhome to monitor the TDS level of my Reverse Osmosis (RO) water system. It generally works pretty well, but for random periods of time, sometimes 1 hour and sometimes 12 hours, the data spikes.
The lower line is around 12 TDS, I’ve used a separate TDS tester to determine that is accurate. The spikes range from 45-55 TDS and have a lot of variability. There isn’t any rhyme or reason to it. The spikes happen both when we are at home using the water and when we are out of town and only our ice maker might be drawing small amounts.
I had a look through the reviews, there are a lot of bad ones. This one caught my eye:
I originally connected these sensors to the analog-to-digital (ADC) on an ESP32 microcontroller, testing it in both the Arduino IDE and ESPHome. The voltage was all over the place and produced garbage readings. I ended up using instead an ADS1115 (16-Bit, 4 channel ADC) and connected it to the ESP32 via the I2C interface. This eliminated most of the problems of repeatability and I was finally getting consistent readings. HOWEVER, there was still a lot of variation in readings from one probe to the next. I had to individually calibrate each sensor to correct this.
But if I was you I would experiment little bit more.
Your sensor gives 0-2.3V for 0-1000ppm. If it’s linear 12ppm would be 0.027V. Can Esp read it or is your 12ppm output actually zero?
What you get if you place the sensor in glass of distilled water? Does it jump periodically even there?
Analog sensors are sensible for interferences. How is your wiring?
You could output the previous value for cosmetic reasons.
Totally agree!
Anyway, maybe that 12ppm is actually zero with some temp compensation or whatever on conversion formula.
If one used Esp32 to read linear sensor 0-2.3V / 0-1000ppm, the lowest readable value would be above 50ppm. Esp8266 ADC is better though.
The solution is likely different for each of those cases. Given the data you have shown, and the reviews others have pointed out, I 1 is the real issue.
from the data sheet
Attenuation
Measurable input voltage range
ADC_ATTEN_DB_0
100 mV ~ 950 mV
ADC_ATTEN_DB_2_5
100 mV ~ 1250 mV
ADC_ATTEN_DB_6
150 mV ~ 1750 mV
ADC_ATTEN_DB_11
150 mV ~ 2450 mV
You are interested in data that is well outside the measurable range for most attenuation levels.
There are ways to make it work, but it is probably easier to get a better ADC.