Hey @SpikeyGG, first of all, thank you so much for the post, after reading about 10 times I think I am close to producing something similar to what you have here in this project. While my project is similar, it is not exactly the same. Since I only need one sensor, I elected to go with the ESP8266 for my setup. Basically, I am trying to read the pressure in my water well so I can trigger my irrigation system to stop irrigating when the pressure reaches a certain level. I have ESPHome up and running and have the ESP8266 connected to my WiFi network. I am powering my pressure transducer as you pictured above. My question is, how hard would it be to edit your posted ESPHome file to work with the 8266 instead of the ads115, or does it even matter? Quite frankly I’m still a noob at HA, and definitely my first time fooling around with the 8266. Thank you in advance or any and all assistance you are willing to provide.
Hey @cmerritt82, it’s not hard. The biggest pain point is dialing in the value to reality because you have to either calculate the equation or collect and use empirical data to define the mapping. You just need to use the ADC sensor in ESPHome. It’ll look something like this:
sensor:
- platform: adc
pin: A0
name: "Water Pressure"
You’ll need to define a filter
to get the accuracy and if you collect empirical data you can do the same thing I did to match it up to reality.
By the way, it’s been about seven months since I installed my filter setup and this morning my wife took a bath and complained that the pressure seemed low. I checked the stats and we had over an 8psi drop across the filter elements! I haven’t touched the filters since February 2020 so I decided when she’s done with the bath I’ll swap them out. I just got done and took some empirical data on fresh filters and I have a maximum drop of ~4psi when the tub, sink, and toilets are running now!
Here’s the pre-data and post-data if you care:
The first stage filter was digusting!
Anyway, good luck!
oh man!!! that is a lot of cleaning to do! Thanks so much, just found your other post and am working on the code now. I have to say, I’m on this mission because my wife complains about no water pressure when the sprinklers are running. moral of the story… happy wife = happy life and we get to learn some cool new technical stuff along the way, will give this a try, thanks!!!
Did you end up going with the approach of measuring the weight of the salt tank? If so, how has it worked out? If not what did you end up using?
Hey @EricE, yeah, been using the scale salt measurement the whole time. After I got it stood up, I was able to wait until the tank was nearly empty and learned that the minimum weight was: ~40lbs. Then I filled it all the way up so I could get the max value: ~140lbs. Now I have a very accurate measure of how much I have and I know that the bags you buy from the store are 40lbs each so I can add a bag whenever I have room for 40+ lbs.
Here’s what it looks like tonight:
ok, so maybe a bit more advice. Attached are photos of what I currently have (I know it is not pretty yet, but want to get it working first).
Also, here is a screen shot of my current ESPHome file uploaded to my ESP8266 with no config errors being reported.
The sensor I purchases is: https://www.amazon.com/gp/product/B00NIK9E10/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1
This is a 5V input sensor and why I used the calculation (as a starting point from the other post). I have it wired as shown in the picture (making sure green was NOT ground which did throw me at first). The ESP8266 only supplies 3.3v on its pins, but the VIN pin (when I metered it) seemed to be throwing off approx 4.5v, so I used this pin to power my sensor (using USB as primary power source for both the 8266 and the sensor).
My question is, why can’t I get anything to show up in Home Assistant like your pretty graphs above? I’m kind of at a stopping point and need a fresh set of eyes to review and give me some thoughts. I feel I am very close, but maybe not. As always, any and all thoughts/comments are greatly appreciated.
As a note, I do see the ESP8266 showing up in Home Assistant, just not the ADC… I fooled around with lovelace (another first for me), but can’t even seem to see anything there or within decives.
thanks again!
btw, this is next on my list once I get the water pressure sensor working, I have a salt bin for softening and this will be great so I don’t have to go check the thing once a week to be sure we have enough salt…
It sounds like you’ve got the device hooked into Home Assistant you just need to verify that the sensor is showing up. I can think of two way to check that.
- Try going into ESPHome and pulling up the log for the device. You should set the
logger:
toDEBUG
first though because that will tell you when the ESPHome devices sends data to Home Assistant. This is the best way in my mind to verify that the data is getting sent correctly from ESPHome.
logger:
level: DEBUG
- Secondly you can check the ESPHome device in Home Assistant and verify that all the sensors coming from it are the ones you’d expect.
Configuration>Integrations
then click on the ESPHome device you’re interested in. It will show you how manydevices
and how manyentities
it has. The entities should cover yourWater Pressure
value, if they don’t try removing and re-adding the device.
Then when I click on entities it brings this up:
That’s what mine looks like.
-Greg
ok, update for the night. After a lot of flashing and setting a static ip on the 8266, I was able to get the sensor to show up in HA, progress! However, the readings are not correct, in fact it seems like whether using the lambda or polynomial formulas, I’m getting 0V reading. After further reviewing the transducer I bought, there is conflicting information on whether the sensor is a 12V input or 5V input. This is after checking my wiring and crimping. I just ordered another 100PSI sensor which states it works with 5V (several use it with rasperry pi). That will be here on Thursday and will report back then. Either way I consider it progress, thanks again for all your assistance @SpikeyGG
ok, so happy to report back, I just had a bad wire connection and was able to get the sensor working tonight, eurka!
Still tweaking on the forumla as it seems to be a lot of trial and error to get it dialed in just right, however, I can’t say thank you enough for your help, next up, will try the salt bin weight thing going.
Thanks again @SpikeyGG!!
Hey @cmerritt82 and @SpikeyGG!
I recently bought two pressure sensors with the goal of monitoring before / after PSI drops through water filtration. They’re both plumbed in and now I get to wire them into my utility-room esp32. Have either of you made any updates to your pressure-sensor esphome configs?
@carpenike, I had created this thread to understand better how to get two readings at the same time from a single trigger and I’ve implemented it and been using it for a long time. It works very well and that way I am comparing pressure sensor values that are much closer to being measured at the same time. It’s a bit confusing but if you look at how the update_interval
, on_raw_value
, and on_value
keys look you can figure out how it’s working:
sensor:
- platform: ads1115
multiplexer: 'A0_GND'
gain: 6.144
id: incoming_water_pressure_raw
update_interval: never
accuracy_decimals: 1
internal: True
filters:
- calibrate_polynomial:
degree: 4
datapoints:
- 0.455 -> 0.0
- 0.722 -> 10.0
- 0.824 -> 15.0
- 0.948 -> 20.0
- 1.061 -> 25.0
- 1.178 -> 30.0
- 1.280 -> 35.0
- 1.398 -> 40.0
- 1.501 -> 45.0
- 1.622 -> 50.0
- 1.738 -> 55.0
- 1.859 -> 60.0
- 1.977 -> 65.0
- 2.097 -> 70.0
- 2.209 -> 75.0
- platform: ads1115
multiplexer: 'A1_GND'
gain: 6.144
id: outgoing_water_pressure_raw
update_interval: 1s
accuracy_decimals: 1
internal: True
on_value:
then:
- component.update: incoming_water_pressure_raw
- component.update: delta_water_pressure
filters:
- calibrate_polynomial:
degree: 4
datapoints:
- 0.539 -> 0.0
- 0.775 -> 10.0
- 0.854 -> 15.0
- 0.963 -> 20.0
- 1.051 -> 25.0
- 1.148 -> 30.0
- 1.232 -> 35.0
- 1.348 -> 40.0
- 1.432 -> 45.0
- 1.530 -> 50.0
- 1.637 -> 55.0
- 1.743 -> 60.0
- 1.854 -> 65.0
- 1.971 -> 70.0
- 2.078 -> 75.0
- platform: template
name: "Delta Water Pressure"
id: delta_water_pressure
update_interval: never
unit_of_measurement: "psi"
icon: "mdi:kettle-alert"
accuracy_decimals: 1
lambda: |-
return (id(incoming_water_pressure_raw).state - id(outgoing_water_pressure_raw).state);
on_raw_value:
if:
condition:
sensor.in_range:
id: delta_water_pressure
above: 1.0
then:
- lambda: |-
id(delta_water_pressure).publish_state(x);
on_value:
then:
- component.update: incoming_water_pressure
- component.update: outgoing_water_pressure
filters:
- throttle: 10s
- or:
- heartbeat: 300s
- delta: 0.5
- platform: template
name: "Incoming Water Pressure"
id: incoming_water_pressure
update_interval: never
unit_of_measurement: "psi"
icon: "mdi:gauge"
accuracy_decimals: 1
lambda: |-
return id(incoming_water_pressure_raw).state;
- platform: template
name: "Outgoing Water Pressure"
id: outgoing_water_pressure
update_interval: never
unit_of_measurement: "psi"
icon: "mdi:gauge-low"
accuracy_decimals: 1
lambda: |-
return id(outgoing_water_pressure_raw).state;
- platform: hx711
dout_pin: D0
clk_pin: D1
gain: 128
name: "Salt Bin Weight"
update_interval: 10s
unit_of_measurement: lbs
icon: "mdi:shaker"
accuracy_decimals: 1
filters:
- median:
window_size: 61
send_every: 60
send_first_at: 6
- lambda: return x * -0.0000911 + 23.3;
Every second the internal outgoing “raw” sensor is measured and that triggers an update of the internal incoming “raw” and delta sensor values. The delta sensor in turn updates the published outgoing and internal values that make their way to home assistant.
I have been toying with a couple of ideas that I haven’t acted on but may in the future:
- Installing a flow meter so I can use it to trigger updates and get water throughput. I haven’t done this yet because I’m worried about impacting the total throughput of the system and many of the flow meters are designed for non-potable water systems.
- Installing a pressure regulator after the filter system and post pressure sensor and installing a third pressure sensor after the pressure regulator. My water pressure fluctuates quite a bit on the supply 50-75psi, so I’m tempted to try to level it out but again I don’t really want to impact the throughput and I don’t know how much it would be impacted by installing a pressure regulator.
If I do eventually do one or both of these things, it’ll likely be mostly for the data collection aspects.
Very nice!
I’ve got a whole home meter that I installed awhile back. Works really nicely with a pulse sensor: Amazon.com: DAE MJ-100 1" NSF61 Lead Free Potable Water Meter, Pulse Output + Couplings: Garden & Outdoor
Also had purchased a third transducer to put after my water softener to get a good indication on how the overall filtration impact water throughout the flow. My water comes from a well so I have a pump on the well tank that keeps things between 40-60 PSI.
If you’ve got this already, that’s awesome! My plan was to use ESPHome filters to fall back to a heartbeat when the flow rate is effectively zero (like a measurement every 10 minutes) and amp up the sample rate when it’s non-zero (like every 250ms or something). That way you get good resolution to pressure drops when there’s in-house usage and you get a low resolution read at all other times (static pressure state). Thinking of the softener… it’d be really cool if we could somehow measure the softness of the water because I can tell mine fluctuates weekly-ish. I wonder if there’s a sensor for that.
Thank you for your project and for the photos. I’m using wemos D1 mini, ads1115 and pressure transductor up to 170psi. Are you connecting also some resistors in your schema? It’s not very clear by the photo for me. Thank you
@malesci, you should read my response or some of the thread. The details you seek are well documented at this point.
Hello, forgive me if I insist. I have read the whole thread. But from the photos I couldn’t figure out if you also used resistors. I understand that ads1115 has 5v, gnd and pins 0 to 4 for the analog signal. But from your photo there is a tangle of wires and resistors and I did not understand the connection diagram.
Here I’m referring for the connection between ads1115 and wemos d1 mini.
In your message (always thank fro your help), it is described the connection between sensor and wemos, it’s right?
Sorry, it should look just like this: