Hi All - I’m building a pool controller with temperature and pressure using a Esp32 DevC board. I have the temperature working just fine. On the pressure sensor i’m getting a lot of inconsistent readings of voltage. Its a basic transducer powered by 5Vs and reads between 0 and 150psi. Since my pool would never go above 50psi i simply connected the output to GPIO35 pin. The specs are 0psi=0.5V, 50psi=2.5v, 150psi=4.5V. I know normally i would need to shift the voltage down to 0-3.3V but in theory this should never go above 2.5V.
Below is the ESPHome code and its pretty simple. Problem is i’m getting inconsistent readings and they are no way close to what my analog gauge is reading so i assume this is a hardware problem. Can anyone see anything wrong with my setup here?
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.
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…
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!
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.
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!
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.
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.
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.
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 )