ESPHome with Pressure Transducer

Would love to know this too

I’m not familiar with ESPHome as I don’t use it, but it is likely not an ESPHome issue.

Analog readings are not straightforward in general, subject to noise and jitter. Pressure sensors respond to vibrations typically by bouncing.

Use shielded cable to connect the pressure sensor to the ESP32 board. Ground the shield at the ESP32 end.

Connect a low value capacitor (0.1 - 1uF) between the sensor output line and ground.

However this is done in ESPHome, configure the ESP32 to take a bunch of readings (say, 25 - 50) then discard any readings above your expected value, below 0 PSI, then average the good readings and send that to Home Assistant.

You also need a well filtered DC supply to the ESP32, and keep the sensor wires away from the WiFi end of the board.

ESPHome likely has some “rolling average” filters as well as high and low pass that would work.

Yes, looks like they do:

Yep - this is a hardware issue and not an ESPHome thing - but figured this group would have experience with sensors with the ESP module’s ADC pins. Your suggestions are super helpful and i will try those.

I’m currently using the “median” filter but not sure if that takes out the outliers that i’m getting. I may have to put a scope on this to see what the noise is. When the pool filter is off and there is zero pressure i’d expect 0.5V output - but its all over the place. So i must have an electrical source of noise somewhere.

@aaronCake - sorry to ask a basic question - but should the negative side of the Capacitor be on the ground side or the signal side? I’m using a 1uF electrolytic cap because thats what i have in stock in my spare parts…

What type of pressure sensor.
Have you seen this thread. Maybe it can give some information.

Seems that his sensor was very sensitive to noise and the power supply was important.

/Mattias

So today I swapped out the sensor for another one and voila - it works just fine and all day i have pretty consistent values. From time to time i do see some random values that the median filter takes care of. But its a pretty simple setup - power the sensor with 3.3 from the ESP and then plug the output of the sensor into an ADC pin. ESPHome does the rest!

What you’ve described is definitely a project I want to undertake soon. Do you have details on your build for a newbie?

yep - got it all built nicely and worked flawlessly for the entire season. was pretty easy but you need to be comfortable with the esp hardware. Feel free to ping me and i’d be happy to share what i did.

pool

1 Like

Would love to see the settings you used to address jitter ?

Would love to see some pictures of the setup and the equipment list.
This is exactly what I’m looking to do too!

Dave,

Is this still working well for you? Would you mind sending a link to the pressure transducer you ended up with? I am also curious to see how you attached the probe to your pool equipment. Thanks!

Id love to see how you got this all setup , been trying to get this working for days

hi. mind sharing your config?

Hi - happy to share everything i got…not sure what would be helpful.

I’ve got an ESP home device setup to talk to the ESP controller. Here is the configuration code for that. Let me know if i can share any thing more on the HA config side or the hardware.

esphome:

  name: pool-temperature

  platform: ESP32

  board: esp32dev

 

wifi:

  ssid: "Kirk Farm"

  password: "rosner9698"

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "Pool-Temperature"

    password: "i3VCy9MBygLX"

captive_portal:

# Enable logging

logger:

# Enable Home Assistant API

api:

ota:

# sensors:

sensor:

  - platform: ntc

    sensor: resistance_sensor

    calibration:

      b_constant: 5350

      reference_temperature: 25°C

      reference_resistance: 10kOhm

    name: Pool Temperature

    filters:

      - sliding_window_moving_average:

            window_size: 15

            send_every: 15

    # Thermometer

  - platform: resistance

    id: resistance_sensor

    sensor: temp_sensor

    configuration: DOWNSTREAM

    resistor: 10.0kOhm

    name: Pool Temperature Sensor

  - platform: adc

    id: temp_sensor

    pin: GPIO36

    attenuation: 11db

   # pin GPIO36 == ADC1_CH0 pin 3

    update_interval: never

   

  - platform: adc

    name: "Filter Pressure"

    pin: GPIO35

    id: pressure

    update_interval: 10s

    unit_of_measurement: "PSI"

    accuracy_decimals: 2

    attenuation: 11db

    #on_raw_value:

     # if:

      #  condition:

       #     sensor.in_range:

        #        id: pressure

         #       below: 0.5

        #then:

#        - component.update: temp_sensor

    filters:

      - calibrate_linear:

        - 0.5 -> 0.0

        - 3.3 -> 30.0

      - median:

            window_size: 50

            send_every: 5

   

switch:

  - platform: gpio

    pin: GPIO25

    # pin GPIO25 == pin 9

    id: ntc_vcc

interval:

  - interval: 30s

    then:

      - switch.turn_on: ntc_vcc

      - component.update: temp_sensor

      - switch.turn_off: ntc_vcc
1 Like

i got a cheap one off Amazon…i think i got one that was a replacement for a spa. They are all pretty much the same and you want one that can be outdoors so get one for a spa or a replacement for a Haywood or one of the pool equipment companies. You’ll need to calibrate it to your ESP but lots of info on how to do that on the interwebs - i forget exactly how i did that.

1 Like

dang it… can’t get my ADC sensor to compile and load. ESP32… nothing special…

How did you end up with - 3.3 -> 30.0 if 50psi=2.5v.

Also not sure if it’s because it’s a cheap sensor but I don’t get 0.5V by default, more lik 0.58V, which skews the 0 PSI marking. I added a 0.1uF capacitor but it doesn’t seem to help.

I ended up buying a quality pressure transducer from transducers direct. Probably paid 100 bucks for it vs 15 on Amazon but it’s bullet proof. Now my cheap temp probe isn’t working so I’m going to find an industrial version of that.

Fine tuning the parameters for the temp probe I beleive is a necessary step that takes some experimentation.

1 Like

I’d love to do what you’re doing. Right now my approach is somewhat medieval. :wink:

(The water flow value in the screenshot is in one skimmer, from the Waterguru Sense 2, not total for the whole system)

As opposed to medieval I would say this is very advanced and cool! I took a look at raspipool at some point but couldn’t gather the courage to get into it. I read that chemical sensors calibration is kind of a pain.
(creative way to solve the pressure sensor issue though :grinning:)