ESPHome water level sensor

Hi @kimocal , hi @jsuanet ,

Thanks both for your replies and your advice !
Indeed, when I try to enter the physical pin number (21/20), the yaml file tells me that these pin numbers are not supported for the 8266 platform. However, I tried both GPIO4 & GPIO5 / D1 & D2, but unfortunately without any luck.
Unfortunately, I don’t have another I2C device to test with :-/

Please find enclosed the requested pictures. The pictures with the usb cable attached is the Wemos D1 mini, the little one is the INA219
Connections on INA219:

  • yellow = VCC
  • orange = GND
  • red = SCL
  • blue = SDA

And… please don’t look at the mess of my desk :wink:

Kr,

Bart




If I look at the picture of the INA sensor I would suggest to resolder the SCL and SDA pins. The soldering of these pins looks not so good, try to cover the whole puch hole with solder.

1 Like

Hi @jsuanet, hi @kimocal ,

Resoldering the pins did the trick !!! you are hero’s !

[18:30:15][VV][scheduler:195]: Running interval 'update' with interval=10000 last_execution=17664 (now=27670)
[18:30:15][VV][i2c.arduino:126]: 0x40 TX 02
[18:30:15][VV][i2c.arduino:102]: 0x40 RX 07AA
[18:30:15][V][sensor:074]: 'INA219 Bus Voltage': Received new state 0.980000
[18:30:15][D][sensor:124]: 'INA219 Bus Voltage': Sending state 0.98000 V with 2 decimals of accuracy
[18:30:15][VV][i2c.arduino:126]: 0x40 TX 01
[18:30:15][VV][i2c.arduino:102]: 0x40 RX 0000
[18:30:15][V][sensor:074]: 'INA219 Shunt Voltage': Received new state 0.000000
[18:30:15][D][sensor:124]: 'INA219 Shunt Voltage': Sending state 0.00000 V with 5 decimals of accuracy
[18:30:15][VV][i2c.arduino:126]: 0x40 TX 04
[18:30:15][VV][i2c.arduino:102]: 0x40 RX 0000
[18:30:15][V][sensor:074]: 'INA219 Current': Received new state 0.000000
[18:30:15][VV][sensor.filter:014]: Filter(0x3fff1ecc)::input(0.000000)
[18:30:15][VV][sensor.filter:021]: Filter(0x3fff1ecc)::output(0.000000) -> SENSOR
[18:30:15][D][sensor:124]: 'INA219 Current': Sending state 0.00000 mA with 5 decimals of accuracy
[18:30:15][VV][i2c.arduino:126]: 0x40 TX 03
[18:30:15][VV][i2c.arduino:102]: 0x40 RX 0000
[18:30:15][V][sensor:074]: 'INA219 Power': Received new state 0.000000
[18:30:15][D][sensor:124]: 'INA219 Power': Sending state 0.00000 W with 5 decimals of accuracy
[18:30:15][V][component:199]: Component ina219.sensor took a long time for an operation (0.11 s).
[18:30:15][V][component:200]: Components should block for at most 20-30ms.

The only thing is, I wired my sensor using the scheme in this thread by @kimocal , but my voltages (see this log & Watts) are very low. I drowned it in a bucket of water and there is no movement of the values.

My sensor is powerd by 12V only, is this enough or should be 24V ?

Could this be the reason ? Or is the bucket no reference ?

Thanks in advance !

Kr,

Bart

It depends on which sensor you bought. The supplied spec sheet for your sensor should tell you. Mine requires 24V and the depth range is 0 - 2 meters.

That’s the point, it varies apparantly :slight_smile:

Longzhuo TL-136 Vloeistofniveau-meetomvormer, waterniveau-sensor detector 12-32 VDC 4-20 mA signaaluitgang voor precisiemeting (1/2/3/4/5 m) (0-2M)

So also 0-2M but with a 12-32 VDC :slight_smile:

So I presume that 12V should work, no :slight_smile:

i have TL-136 sensor in outdoor tank its value drift a lot based on temperature and time of the day . it completely not good in my opinion .

this the connection diagram i used , it was shared by some HA user .

446d76f69521e451b4b2bdecc2225aae6c40eb26_2_690x306

I have both current and voltage versions and see drift.

However, my understanding is that the ‘drift’ comes from atmospheric pressure changes. I’m moving towards detecting the level using a TOF sensor rather than pressure, for that reason.

that ‘some HA user’ is me :slight_smile:
I have two of these:
One is in my pond and has been rock solid so far.
One is in my rain water citern and has started drifting now and for the life of my I can’t figure out why :frowning:
I don’t think it’s atmospheric pressure changes as the pressure sensor includes a red air tube that is connected to the outside air so that it takes in the atmospheric pressure.

Hi , How are you , Hope you are doing fine …

i even kept the red air tube outside or even in ip68 box no luck it drift lot my water tank is outdoor .
i can across these two youtube videos recently using single shelly uni and less wiring try this if you have shelly uni

https://youtu.be/Ybj_bj2W1cs
https://youtu.be/-IEYP6vItec

Thanks! Doing fine indeed :slight_smile:
I had a look at your videos. It appears that they are using the voltage based version of the pressure sensor.
That didn’t work in my case as I am using wires that are ± 20 meters long. This would cause a significant voltage drop. Therefore I resorted to using the current based pressure sensor which does not suffer from a voltage drop.

Voltage based sensors have 3 wires and current based have 2 wires ? or its just the connection difference …

also within three months TL-136 is fully rusty

No the same amount of wires.
The difference is that the voltage version will change the voltage based on how much pressure there is while the current version will change the current based on how much pressure there is.

Mine have not rusted at all so far.

It should. Mine specifically calls out 24V.

Looking to buy parts to make a water level sensor and seems like people tackle the same problem a few different ways.

From what I read, pressure sensor is the way to go. I’ve already got ESP32s at home, so looking to get a drop in liquid level sensor (12 24VDC H2O Liquid level sensor integrate level transmitter input type water level sensor 4 20ma 0 5V 0 10V RS485 output|Pressure Transmitters| - AliExpress) but unsure if I should be getting a 4-20ma (current) or 0-10v (voltage) version.

Seems like if you go voltage version it interfaces with shelly uni easily, but current version needs a INA219.

If its easier, im not against buying a shelly uni

If you use a current based sensor you can use a voltage dropper circuit to create a voltage across a resistor which the ESP then reads (max 3.3V).

See the example here.

One benefit of 4-20 over 0-10 is that cable length is less of a factor with 4-20.

The other thing to bear in mind is that with a pressure sensor you may need to take changes in atmospheric pressure into account, depending on the accuracy you require.

Yep, there are sensors available that have an atmospheric sensing tube so they can automatically zero out the error.

Thanks mate, im not 100% across what this means, but I guess ill google it :slight_smile:

I’ll place the ESP32 nearby (but possible i’ll run the cable up the tank, then down into the water). Its a fairly hefty tank, 115,000L I think. 4-20ma might be a better option if i needed to extend the cable and place all electronics at the base of the tank outside wall.

As per what Ash said, 4-20mA is definitely better. That’s why it’s the industry standard for industrial instrumentation.

Just have a look at the example in the link I provided above, it’s super easy.

A sensor like this provides the atmospheric compensation tube, just be sure not to kink or block it. Also, choose a sensing range as close as possible to your requirement. ie: don’t use a 5m depth range if your tank is only 2m deep, however ensure it’s not too small a range either.

If that’s the case, I doubt that changes in atmospheric pressure will be a concern for you.

I have 12000 litres and need to control the level to within 1.5 cm so for me, the atmospheric pressure is critical.