I was struggling with same problem in my shrimptank. And I found some simply workaround… just control the VCC of TDS meter by GPIO and turn it on for 200ms every half hour. This is causing small jump in pH readings, but since I’m using median template these “jumps” values are rejected.
Here is my code:
I’m using cd74hc4067 multiplexer to read analog values from pH meter and TDS meter with one esp. Esp has only one analog input A0, that’s why I had to use cd74hc4067 multiplexer which allows to read up to 16 analog sources. As mentioned above for correct TDS reading you also need temperature sensor. I’m using simplest DS18B20. TDS meter can’t be powered whole the time because it distorts pH readings.
Here is my pinout:
Multiplexer SIG to A0 on esp
Multiplexer S0 to D5 on esp
Multiplexer S1 to D6 on esp
Multiplexer S2 to D7 on esp
Multiplexer S3 to D8 on esp
pH meter signal to C0 on multiplexer (if your signal is 5V make sure to use voltage divider to 3.3V)
TDS meter signal to C1 on multiplexer
TDS VCC to D0 on esp
DS18B20 to D2 on esp
Here it as it works:
Signal from multiplexer (A0) is updated every 5 sec.
Every 10 sec multiplexer reads pH meter signal (C0)
Every half hour at 5th sec TDS is powered on by D0 pin of esp for 200 ms and multiplexer reads TDS raw signal (C1)
Could you please tell me which pH meter you have ?
Can I use the 3.3v of the ESP to connect the pH meter ? If not do you have any link to buy voltage divider ?
I will buy both of Multiplexer, pH meter and voltage divider
Thanks for the detailed instruction! I built it but I’m struggling that my PH sensor measure constant 1V. I recabled, changed the USB cable and the power supply, tried with 5V with 3.3V converter, with 3.3V, still the same. 1V. Anyway the TDS/EC working fine and get the correct value. I created a config without the multiplexer and in this case the PH sensor measuring the correct values so I’m totally lost.
since I don’t have a temperature sensor connected to my wemos, i’ve swapped any temperature bits with “25”. While testing the sensor by dumping it in a bottle of lemonade-syrup, i’ve reached a ppm of 15. I then put the sensor in my hydro bucket where it started around 3.39 without adding any nutrients. The readings have been swinging a little bit, rising ever so slightly. Then today I put in fresh water and i’m reading 2.44 ppm. I’m guessing I’m going wrong somewhere in the formula calculation.
My code is below, mind giving it a look and telling me where i’m being stupid?
I know i should up the update_interval because it has no reason to be at 5 seconds, but this was mostly for testing purposes. i’ve already put them back to 120seconds to give the esp a lil break now and again.
Sorry for my late response, I’m not visiting this forum so often…
Finally I had to get rid of TDS meter, because even if was powered by esp every half hour, pH meter readings were constantly distorted. I removed multiplexer and TDS meter and now pH readings looks much constant. There are still big differences between max and min readings, but after using median it looks good and credibly:
I have a CQRobot CQRADS1115 TDS sensor. Trying to get it integrated into Home Assistant. Will this code work for that? I also have dallas temp sensors already configured and working for temp comp.
I know this is an older thread, however I am trying to do something similar here to monitor the TDS in an RODI filter. With that I will not be using a temperature probe and understand the significance of requiring temperature compensation.
I am new to ESPHome so am unsure how to essentially set the temperature compensation to 25.0 as a pre-defined value rather than one calculated by a probe.
I also have 3 TDS sensors and noticed above someone mentioned they have 4, so would love for someone to shed some light.
This is what I have so far but it wont compile because I am obviously using the wrong syntax/code
Hi I have an issue with the TDS using ESP32 and ADS1115 and the code used above. I get an error on compiling that there is no state member meaning it fails to call the ADS channel raw value. I just don’t get that. Any help appreciated.
sensor:
platform: dallas_temp #address:
name: “Mixing tank water temperature”
id: mixing_tank_temperature