Hi Javier,
I'm well & I hope you are too. Thanks for your information.
Just for background:
Our HW engineer took an existing TDS sensor circuit that compares the signals between 2-prong probes & we have interfaced this to an ADC-capable port-pin of MKL28Z. 2 inputs to 1 analog voltage output which becomes input to the ADC module in MKL28Z. That's a SEPARATE interface I assigned to an ADC input pin of MKL28Z.
Another separate interface circuit for water level sensing has a simple PNP transistor circuit that is 3.3V supplied & bias resistor for transistor to turn on or off, close or open, when water is detected at the base. The output goes to a GPIO digital input of the MKL28Z that I assigned.
Although the 2 are completely separate circuits and going into 2 separate MCU pins, the TDS Electrical Conductivity (EC) or PPM analog voltage signal IN THE WATER sets the correct voltage level as input to the PNP transistor water level sensor circuit to turn it on so water is detected. One effects the other.
TDS polynomial is y = f(x), where y = TDS PPM & x = analog voltage & noting that Vana = Vdigi = same voltage whether analog or digital.
If there is no water, there is no TDS EC/PPM. Water level sensor PNP transistor remains off. No voltage or 0V at the GPIO input of the MCU so logic "0" or no water.
If there is water, depending on the TDS EC/PPM in the water (read from separate TDS circuit ADC), the water level sensor circuit PNP transistor will turn on at the right bias voltage to turn it on, to deliver a voltage signal at the GPIO pin & if that voltage is >= 2.31V, the MCU internal HW will detect that as a logic "1", water is there.
Our HW sensor ckts are set. We just need to tweak the bias resistors in both 2 sensors given the target TDS PPM @ 30 maximum, that will ensure the level sensor PNP transistor will turn on & deliver >=2.31V on its input pin connection to the MCU.
Your comments are welcome.
Thanks for all your help.
MI