Looking for a water pressure device to sink in a water well

They have this one, with 1 km wireless range if WiFi is an issue.

I don’t know how they treat variations in atmospheric pressure, but they are very responsive, so just send them an email.
They can also provide you with a longer tube if the original one is too short.

Thanks.

The well is at 20m of the house, but the WiFi is not strong enough.

I will focus on my own system with sensor.
I have to find how on what I can connect the sensor ( https://www.aliexpress.com/item/32791153600.html for example) to take data. On a TH10 ?

Actually I have a TH10 in the house + DS18B20 in the well to monitor the temperature (with a 35m long Cat7 network cable between).

Your sensor has a 4…20mA output which is perfect for long cables that might encounter electronic disturbances and “higher” resistance due to long distances.
You could just use an ESP8266 [ESPHome] (f.ex. Weemod D1) with an 4…20mA to voltage converter (like this one) and the attached sensor to measure an anlogue value that you just need to calibrate.
The calibration can directly be stored in the ESPHome config. So you have a WLan sensor that directly gives you Water level in m. You can also directly add the Temp sensor to it so you have an all-in-one sensor set :slight_smile:

More perfect would be the RS485 option, but I did not see any documentation on this on the sensor seller. If you need to reverse engineer this one its likely not worthy. With good documentation it will likely directly give you pressure values.

1 Like

Thanks a lot !

I’m not sure to fully understand.
You wrote :
“Your sensor has a 4…20mA output which is perfect for long cables that might encounter electronic disturbances and “higher” resistance due to long distances.”
“output which is perfect for long cables” but after about resistance and disturbances.

So I can’t connect the sensor straight to a 35m long Cat 7 (with lot of shields) to a board inside the house ? (in the house because here in winter I can have -40°c and 2 meters of snow).

Where need I to install the voltage converter ? Near the sensor in the well ? (It’s ok, I can easily enclose/protect it from humidity/water - in the well the temp will be around +1, we have to warm it inside with a specific warmer).
Then after the convertor I put my 35 meters long cables, to the ESP8266 in the house.

Is it what you think?

You would connect your sensor to the cat 7 cable and then put the 4-20 ma to voltage convertor inside the house. You would however need to have a termination box near the top of the well so that the sensor vent tube could be vented to atmosphere. The wire connections could then be ‘potted’ to keep out moisture. you could also run the DS18B200 +/- and signal down the same cat 7 cable.
You mention 2 metre of snow so you would need your termination box vent tube to be above that level and covered but still open to air. If you vent the sensor into the small box and terminate the sensor wires in a small box near the well, then run a separate vent pipe from that box, say 2.5 metres high, you will have a good system. I would use two waterproof cable glands where the cat 7 and sensor cables enter the waterproof box. A plumbing gland can be used for the vent pipe so that it is sealed. That way the box is completely sealed with its inside at atmospheric pressure, therefore the sensor is also at atmospheric pressure.

Thanks Bob.

I’m ok to protect everything, it’s easy for me.

But not really with electronics.
If I put 35 meters of Cat 7 wires between the sensor and the current/voltage convertor, I’m not sure that is the good way.
Adding 35m of wire will increase the resistance, and it’s why I understood to put the current > voltage converter at the beginning near the sensor, because the voltage will not be worried by the long cable. Then inside the house I can connect to the board that will receive “data”/signal to send to Home Assistant.

No ?

Exactly the opposite way. If the sensor gives a voltage as an output signal, this voltage does not have a lot of current. So an external electric disturbance (say a running pump) could easily alter this voltage. Your CAT 7 cable is a good way to prevent that, still it is not perfect. In additition to that, every meter of your cable has an electric resistance that might not be constant (temperature, humidity…) Therefore you get a voltage drop that is not calculatable.

With the 4…20mA output, your signal is transferred via the current (f.ex. 0mA: broken cable …4mA lowest signal … 20mA highest signal).
Let’s say the sensor wants to set a constant current of 12mA because that’s your value. It increases the voltage, until 12mA are flowing. Do not get me wrong: The volatage in this scenario ist just a tool to adjust the current.
So if we have a loop of:
Sensor -> short cable -> current/voltage converter -> short cable -> sensor

the voltage the sensor might need to have 12mA flowing is f.ex. 3V
If we exchange the short cable with the long one, the voltage needs to be increased to again have the 12mA of current (f.ex. 4V).
If an electromagnetic disturturbance comes along, it not only needs to enter the cable but needs also a lot of energy to disturb the current flow, which would not be typical.

So long story short: If you connect the sensor directly to the current/voltage converter, you can directy use a voltage output sensor, with all the disatavantages mentioned. To make full advantaga of the current sensor, place the converter as close as possible to the ESP for most best performance.

Ok. Thanks a lot ! :slight_smile:

@CeeCee
Hey, I’ve read some of your responses. I have a 4-20ma sensor with a current-voltage converter on a node mcu. I can get voltage but am having trouble calculating water height from the reading. The calculation given by the manufacturer doesn’t seem to work.

I’ve got this sensor

There is a similar thread where I also linked to the code I’m using both in ESP home and Home Assistant.

Your elaborate code is very helpful for pointing you in the right direction ;-).
In general: always convert the voltage into mA and then start working with the formulas. And: the height the sensor is calculating is the height of water above the sensor, not the height from the top of the water to the bottom of the tank.

@CeeCee
So during testing I got a voltage of 0.63v or 5.16mA at about 20cm depth.
None of the formula I can find work to return a depth anywhere close to that
Any ideas?

Well,

the first step when using an ADC is always converting the Voltage into the unit the sensor is sending. You obviously did it, so this is good. Please also check with a mA Meter that your conversion from Volt to milliAmps is precise enough.

The next step is to convert the milliAmps into a pressure reading of your sensor. This should be doable with the datasheet of the manufacturer. Double check your formula for sanity.

These two steps could be skipped if you do not have any problems. But in your situation it should ged rid of uncertainties in the formulas.

Then you can apply the final step: calculating height from the pressure values. If it does not work out, check your equasions, compare the units that are at the beginning of your math to the units that are at the end of the math (“Einheitenvergleich”, if you speak German). Check that you did not make mistakes by getting rid of millis, kilos, etc without compensating these.
Make a short scetch that helps you understand what pressure at which level you are measuring.

This should lead to a good reading.

I think you might already have settled on a solution. But reading the (environmental) requirements of your application. might it not be better to take a full industrial solution?

A siemens LOGO PLC with AM2 analogue module will read that 4-20ma sensor quite easily and is able to send it through MQTT (https://github.com/sinty/Siemens-LOGO-smart-home)

Only problem with a full industrial solution is it’s full industrial price. Take a deep breath before looking at that.

The LOGO is aimed more towards the Home gamer though. But still not in a ESP range. If you want a frame of reference look at S7 1200 series ranges that’s Siemens actual “entry level”

How did you integrated this into HA?

I did not yet.
The sensor will be connect on a SONOFF TH10, then we will use MQTT. One friend will help for this, I don’t know yet how to do it.

The built in REST-api is a bit silly, so I had to resort to a command-line sensor.
I don’t remember the exact details now, but I believe it did not send properly formatted json or something. The sensor is currently offline for the winter, so I can’t check what it reported.

So I added two command_line sensors:

- platform: command_line
  name: Plant Water Raw Zero
  command: curl -s http://10.1.1.124/get_sensors | sed -e 's/\\//g' | sed -e 's/"\[//' | sed -e 's/\]"//' | jq '.local_s["z"]' 2>/dev/null
- platform: command_line
  name: Plant Water Raw Current
  command: curl -s http://10.1.1.124/get_sensors | sed -e 's/\\//g' | sed -e 's/"\[//' | sed -e 's/\]"//' | jq '.local_s["1"]' 2>/dev/null

And then I generate two template-sensors based on these values:

- platform: template
  sensors:
    plant_water_level:
      friendly_name: "Plant Water Level"
      unit_of_measurement: "%"
      value_template: >
        {% set zero = states('sensor.plant_water_raw_zero') | float%}
        {% set max = 100 %}
        {% set current =  states('sensor.plant_water_raw_current') | float %}
        {{ ((current - zero) / (max - zero) * 100) | round(0) }}
      icon_template: mdi:water-percent
    plant_water_level_dec:
      friendly_name: "Plant Water Level Dec"
      unit_of_measurement: "%"
      value_template: >
        {{ ((states('sensor.plant_water_level') | int / 10) | round(0)) * 10 }}
      icon_template: mdi:water-percent

The “_dec” sensor rounds the value to the nearest 10%, which I the use to display an image in a picute-glance:

              - cards:
                  - type: picture-glance
                    entity: sensor.plant_water_level_dec
                    entities:
                      - entity: sensor.plant_water_level
                        show_state: true
                        icon: 'mdi:water-percent'
                    name: Waterlevel
                    show_name: true
                    state_image:
                      '100': /local/icons/status/water-100.png
                      '90': /local/icons/status/water-90.png
                      '80': /local/icons/status/water-80.png
                      '70': /local/icons/status/water-70.png
                      '60': /local/icons/status/water-60.png
                      '50': /local/icons/status/water-50.png
                      '40': /local/icons/status/water-40.png
                      '30': /local/icons/status/water-30.png
                      '20': /local/icons/status/water-20.png
                      '10': /local/icons/status/water-10.png
                      '0': /local/icons/status/water-0.png

Thanks! I will try this one I received it

Hi,

I pasted this into my HA, it created the sensors but no data is being shown.

sensor:
  - platform: command_line
    name: Water Tank
    command: curl -s http://192.168.253.139/get_sensors | sed -e 's/\\//g' | sed -e 's/"\[//' | sed -e 's/\]"//' | jq '.local_s["z"]' 2>/dev/null
  - platform: command_line
    name: Water Tank
    command: curl -s http://192.168.253.139/get_sensors | sed -e 's/\\//g' | sed -e 's/"\[//' | sed -e 's/\]"//' | jq '.local_s["1"]' 2>/dev/null

  - platform: template
    sensors:
      tank_water_level:
        friendly_name: "Water Tank Level"
        unit_of_measurement: "%"
        value_template: >
          {% set zero = states('sensor.water_tank_zero') | float%}
            {% set max = 100 %}
              {% set current =  states('sensor.water_tank_current') | float %}
                {{ ((current - zero) / (max - zero) * 100) | round(0) }}
        icon_template: mdi:water-percent
      tank_water_level_dec:
        friendly_name: "Water Tank Level"
        unit_of_measurement: "%"
        value_template: >
          {{ ((states('sensor.tank_water_level') | int / 10) | round(0)) * 10 }}
        icon_template: mdi:water-percent

2 years later, I’m back in my own topic.

My friend finished the electronic part (that I can’t do).

The pressure sensor (4-20mA model) is in the water well since 3 years.
55m of Cat7 cable.
On the other side of the cable, in the house, the cable is connected to a converter (A to voltage).
The converter is connected on the TH10.
The TH10 send tha value to HA via MQTT. It’s working well.

The value is a voltage.
0v of 0cm of water.
0.9v for 200cm of water.

Olen, how can I use your code to read the MQTT value?

The TH10 is sending values, 1 pressure, and 2 temperature (from the bottom and top of the well).
During the first test on HA, I created a sensor for temperature with this in the configuration.yaml :

mqtt:
    sensor:
        - name: "Température Puits fond 2"
          unique_id: "73948462" 
          state_topic: "office/sensor1"
          device_class: "temperature"
          unit_of_measurement: "°C"
          state_class: "measurement"

How should I create the pressure sensor (the value is a voltage).
Which kind of sensor? With which options?

I will manage to draw images to display the water well.

thanks :slight_smile: