M5 Atom Lite with transducer - fluctuating voltages being reported

Hi All,

Kinda new to Home Assistant but very much enjoying tinkering away :slight_smile:

I’m trying to messure the pressure at the base of a water tank on a farm - this would be the first of 3 tanks to messure - all being so that i can get pre-warning that a tank is getting empty.

The setup I have is attached, 30,000 ltr tank - > ball valve - > 40mm Alkathene → 40mm “T” with 15mm and 6mm reducer to 150PSI pressure transducer, “T” also goes to pressure pump.

150PSI Pressure Transducer connects to M5 Atom Lite, G33 ADC for green wire from pressure sensor, black to ground and red to 5V (Image also attached)

I’ve added the ESPHome plugin and configured the M5 with the following:

substitutions:
  name: esphome-web-1583b4
  friendly_name: House_Water_Tank_Presssure

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
  - platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}
  manual_ip:
   # Set this to the IP of the ESP
   static_ip: 172.16.200.12
   # Set this to the IP address of the router. Often ends with .1
   gateway: 172.16.200.254
   # The subnet of the network. 255.255.255.0 works for most home networks.
   subnet: 255.255.255.0

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: 27
    num_leds: 1
    rgb_order: GRB
    id: status_led
    name: ${friendly_name} Light
    effects:
      - random:
      - flicker:
      - addressable_rainbow:
      
binary_sensor:
  - platform: gpio
    pin: 
        number: 39
        inverted: true
    name: ${friendly_name} Button
    on_press:
      then:
        - light.toggle: status_led

sensor:
  - platform: adc
    pin: GPIO33
    name: ${friendly_name}_Voltage
    unit_of_measurement: V
    update_interval: 5s
    icon: "mdi:water-percent"
    accuracy_decimals: 6
    attenuation: 12db
    filters:
    - median:
        window_size: 250
        send_every: 10
        send_first_at: 4   

The problem I’m seeing is that the voltage is fluctuating alot, seems staple for a day or so then jumps around.

I’ve tried another M5 and another pressure transducer and I’m getting similar results - I’ve also tried a one way valve before the “T”, unfortunately the pressure at the base of the tank isn’t enough to open the valve so had removed it (Maybe there is a better valve out there for this).

Any help on this would be awesome!

Chers,

Johnny

Output from M5

You made a fancy diagram of your setup which isnt of any use with your question and arguably the most important detail isnt mentioned. What sensor are you using? They make more than 1 pressure transducer and the answer to your problem is most likely in the sensors spec sheet.

Also, do these fluctuations happen to occur around the time the valve is being opened and closed?

Thanks Fallingaway24,

Diagram just shows some context - took all of 10 mins to create :).

The Pressure Transducer is a cheap one from Temu - I’ve struggled to find any datasheet for it - here is the link to the device (Hopefully it works)

The voltage fluctuation doesn’t have any correlation to the valve being opened and closed.

Thanks for taking time to look at the question.

Not necessarily your actual problem but your sensor (100psi) is to measure water column up to 70meters, and it you supply it 5V it outputs linear voltage change between 0.5 and 4.5V. So one meter difference of your water height translates to 0.05V at output. It’s not ideal sensor to measure pressure of 0-2m water column. You could filter out all readings above 0.7V.
For undocumented Temu sensor 10psi one would be better to start with.

Thanks Karosm, even though the sensor is too big for the job, surely the readings from it should be stable though?

It does seem like the pressure sensor is the problem here though, just wandering if the environment i had it in was causing the variable voltage output.

I’ll look into getting a 10PSI transducer - see if that solves it.

Ive never used pressure sensors and cant speak to how well they work but, I have used several IR water level sensors and they work very well.

I recently installed these to monitor the water level for my water feature I just built and im happy with them.

https://www.amazon.com/EPTTECH-Optical-Infrared-Sensibility-Controller/dp/B075R6SSHJ?ref_=ast_sto_dp

This place has a huge selection of water/liquid sensors and many of them can be found on Amazon but, not all of them.

Depending on how much details you need like, a sensor that calculates gallons like what you have now or a group of single sensors to detect 1/4, 1/2, 3/4, etc levels or a simpler floating sensor (float switch) that just tells you when the water level is full ot empy, you have a ton of options available. Id personally suggest keeping it simple though.

I think a simple double float switch that signals
only High/Low water level and then putting a flow meter on your output is good and simple. The meter can tell you how much water is being used and the water use history but, putting the 2 together you get many extra benefits.
Leak detection, current and historical water data, tank capacity, and not only are those float switches very dependable but they would also function as a way to check calibration of capacity level and you could set it up to automatically do it by checking the flow meter gal/liters used against whichever float sensor was On last.

There are high changes that spikes are from environment, but without specs of your sensor and wiring(length,shielding), I can’t even give a guess.
Try filtering out everything below 0.5 and above 0.7 in your yaml. Add some averaging and maybe you are fine without hardware upgrades.