ESPHome water level sensor

Hi @aherbjornsen with your setup using esp32, ina219 and TL-136 sensor do you see an drift in the TL-136 values based on ambient temperature?

I am using a TL-136 with an ESP8266 and analog current to voltage converter but the output voltage drifts with ambient temperature making the readings unusable.

@rybackisback I don’t really have much data with variable ambient temperature. I see from old graphs that I had it outdooors for a single day when the temperature varied between 14 and 28 degrees without seeing that reflect on my readings.

Thanks @aherbjornsen. Are you please able to share your wiring diagram. Ive never used an INA219 before.

Sorry. Don’t have a diagram. I just used examples I found on the net.
It is extremely simple, you connect the INA219 to your ESP32, And then you you hook up the TL-136 to the other side of the INA219.
I used a 24V PSU to drive both the TL-136 and a USB-charger that powered the ESP32.

1 Like

Did you connect ground from the ESP32 to the Vin+ or Vin- on the INA219 with or without a pull up resistor?

EDIT
Disregard the above. Grounding the ESP to the INA219 across Vin causes a short. I might need a pullup resistor across the SCA and SCL if needed. I’ll be testing the TL-136 in my water tank this weekend to see what I get for current measurements and water height. I shared my wiring diagram in a post below.

Here is how I have it wired up:

I am using a M5 Atom Lite which is an ESP32 Pico which is different than the ESP in the diagram above (I haven’t found a Atom Lite item for fritzing yet) but gives you the same idea on how to wire it.:

1 Like

Hi @kimocal thanks for that. I managed to figure out the wiring myelf. So I changed my setup to now include ADS1115 (analog to digital converter) to combat the fluctuations of the sensor reading with temperature since my setup is setup outdoors in an ip67 enclosure. But I am still getting sensor readings drift with ambient temperature with no water being added or removed from the tank. Do you see that with an INA219 setup?

Not sure yet as I don’t have enough data to compare against. Do you have a pullup resistor on the I2C lines to get rid of the float?

Hi @kimocal I have the following ADS1115 from dfrobot Gravity I2C ADS1115 16-Bit ADC Module Arduino %26 Raspberry Pi Compatible SKU DFR0553. Gravity__I2C_ADS1115_16-Bit_ADC_Module_Arduino_&_Raspberry_Pi_Compatible__SKU__DFR0553-DFRobot

I believe these have resistors built in possibly? The documentation for it does not talk about having to install resistors.

No idea. I’m still green with all the electronics stuff and learning as I go with my projects. Maybe try to see if it helps?

Hi @kimocal do you have any guide on the wiring diagram or the value of the pull up resistors to be used.

Thanks @kimocal. I will give this a shot. Once you have sufficient data could you please share your observation on any data drift with a INA219? Is your installation outdoors? Do you have a pull up resistor installed in your setup since INA 219 uses I2C bus?

This is how I wired it as well.
I used a 24V->5V USB buck converter for the ESP, that was powered from the 24V supply. That way I had common ground for both circuits.

I was finally able to get the system up and in my water tank yesterday.

Here’s a 12 hour window of the current measurements:

Here’s a zoomed in view of the busy area:

Yes the installation is outdoors but I do not have a cover on it at the moment. No I do not have any pullup resistors in my setup.

Hi @kimocal thanks for posting the data trend. The data seems much more steady compared to the voltage readings that I take.

Does the change in current correspond with water going in and out of the tank and is not affected by any external factors? Are you happy with the accuracy of the readings with respect to the water level?

So far so good. I didn’t calibrate the sensor initially. As I am monitoring the water tank level with a yard stick I am also entering the current value in a spread sheet to better tune my current to water height formula. Maybe this weekend I’ll calibrate them with a wider spread of data points to tune it more. For now it’s working though.

The only external factor I can think of would be the air tube that the TL316 uses and making sure it doesn’t have wind blowing on it to affect the relative pressure compensation.

My sensor termination and all the electronics ie. power supply, nodemcu etc are located in an ip67 enclosure. That is where I have my temp probe.

My voltage readings fluctuates with the temp. I have a spare ina219 I will wire that up this weekend to see if the readings are affected.

I installed a system over the weekend using the method in the other thread, sonic sensor, so far working pretty well.

Definitely a few spikes there that I would assume are from condensation which appears to be the big issue with the sonic sensors.

This thread really seems to be about using pressure sensors. I see that people are adding additional voltage or current sensor hardware, one of the pressure sensors linked above looks to output RS485, curious why no one has gone that route? Looks like you’d need something like a MAX485 to read it in an ESP / Arduino device anyway, but feels like reading digital data might be easier?

So I connected up my INA219 breakout board to my throw in level sensor and I have noticed the fluctuation with temperature is almost non existent but the downside is with INA219 the accuracy is approx 2% (for me that’s ~100L) compared with the ADS1115 of 0.15%. Is there any way of increasing the accuracy of the INA219, replace the shunt resistor possibly?

WL lovelace