Building an ESP8266 with multiple pressure sensors (using ADS1115 and ESPHome)

You solved it, but I went with ADS1115 partly because I ended up with a few analogue sensors and so I could ensure my ESP board was protected. But who cares. They are super cheap!

Awesome you figured it out! Glad it works

Hi, would you mind sharing your ESPHome config?
Trying to figure out how to set it up.
I also use a ADS1115 with an ESP32.

And i would love to measure in bar och kg, if someone have any idea how to do the calculations for that?

Thanks in advance :slight_smile:

@sabbath

ads1115:
  - address: 0x48

sensor:
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 4.096
    name: "Irrigation Pressure"
    id: IP
    internal: false
    unit_of_measurement: 'bar'
    accuracy_decimals: 1
    icon: "mdi:volts"
    update_interval: 2s
    filters:
      - median:
          window_size: 5
          send_every: 5
          send_first_at: 5
      - calibrate_linear:
          - 0.51 -> 0
          - 3.38775 -> 3.7
      - lambda: |-
          if (x <= 0){      
            return 0;
          } else {
            return x;}
  • calibrate_linear:
    converts voltage to bar.

First thing you need to do is to find out the numbers to put into calibrate_linear. That means you need an actual pressure dial that is in line with your pipework. I then set my pipe to full pressure (in my numbers 3.7bar) and then set the pressure to zero. In both cases, I measured the corresponding voltage from the dashboard logs of the ESP node. With that I could set up the calibrate_linear.

I have a second pressure sensor at the bottom of a deep tank; this with a lambda calculation allows me to know the depth and therefore the litres of the tank. Hope this helps and is clear. Good luck

1 Like

Got it working, thanks :slight_smile:

1 Like

Hello Everyone,
Im attempting something similar and wanted some assistance using the below components. Also would prefer to use ESPhome for this. This is for a home water pump and water tank system. Would like to know if this is possible to do using these components and ESPhome. Any diagram would also be appreciated. Thank you.

Controller: NodeMCU - I already have this.
Water Flow: GREDIA G3/4" - I already have this and would need only 1 of these.
Water PSI and Presence: Gravity: Analog Water Pressure Sensor - I dont have these and would need 2 of these.
Tank Water Level: Gravity: Photoelectric High Accuracy Liquid Level Sensor for Arduino - I dont have this and would need 1 of these.

How big is your tank and what type of tank is it?
Is your water pump pressure activated i.e is your pipe permanently pressurised?
Why do you need two psi pressure sensors?

I see that the psi pressure and flow sensors are 5v ADC and assume you will also need ADS115

The following is code for the ADS1115. GND needs to be same between the node and the ADS. And you will also need a good solid 5v supply for the flow, pressure sensors and ADS1115. The wiring diagrams are on the link you posted

Edit: I just saw my my code is above

Hello Julian,

The tank is a 200 gallon tank. The way the pump is being setup is with a standard mechanical pressure switch that comes with the pump. Those that are set to 20 psi min and 40 psi max. So when you turn a faucet on the pressure goes down, when it hits 20 psi the pump turns on and will stay on until it reaches 40 psi. Process repeats. Its a continuous system so the city water is always filling the tank and the house is always feed from the tank/pump.

The reason for the 2 psi and presence sensors is for monitoring the city water and the tank/pump water. So the first one will tell me if the city is providing water and the second one is to tell me if everything is ok with the system. For example, if there is water in the tank but no water or psi in the system then something is wrong.

With my limited knowledge this is what I drew up. Would this be correct? The pins on the headers might have the wrong order but I can correct the order when im putting it together.

Thanks.

Hi. I did also try your suggested setup but got from ESPHome error, Component ads1115 requires component i2c.

  • address: 72
    Have u any idea what I am doing wrong here?

@catdogmaus indeed that error message is completely correct. As the instructions state this platform communicates with ADS1115 using i2c. You must set i2c up first.

I post instructions for ADS1115 and you will see that there is a link on the page to the i2c page. Good luck

Hello @ErnieP sorry slow to get back. I think that looks good. I have never done a wiring diagram so looks very organised! I usually end up with a spreadsheet for all the pins. You are only using two. And the correct ones! I have just built a new board set up yesterday for my rain sensor. Good luck

Somehow this is not working for me, I simply get errors

[10:52:38][I][i2c.arduino:069]: Results from i2c bus scan:
[10:52:38][I][i2c.arduino:071]: Found no i2c devices!
[10:52:38][D][api.connection:1031]: Home Assistant 2023.7.3 (172.16.0.158): Connected successfully
[10:52:38][C][ads1115:073]: Setting up ADS1115…
[10:52:38][C][ads1115:074]: Address: 0x48
[10:52:38][E][ads1115:076]: Communication with ADS1115 failed!

Well done you have i2c set up and it is scanning for a device. It can not find a device.

Since you have not supplied any other information we are guessing but:

  1. You are using GPIO pins which are conflicted on the ESP
  2. You have specified the incorrect pins when setting up i2c
  1. The i2c wires could be switched around
  2. The wiring is broken
  3. The ADS1115 is broken OR
  4. The ADS1115 does not have correct power set up

I would get my multimeter out and quietly work through all the items. It is one of them! I can’t think of anything else.

Good luck again!

Not being a power user I did strike a similar issue.
With the esp8266 nodemcu you need to define the pins you are using to be acceptable to the i2c.
I can’t tell you how as I quickly moved on from 8266 devices to the more powerful and widely accepted esp32 devices.
Most of my deicsion to go this way was guided by the guy with swiss accent. check him out - bit of an esp guru

Since there is very little information for setting up this specific sensors, and I haven’t found any that includes both wiring and yaml setup, I used this solution here for wiring. Since the original user confirmed that it works for him, I have no particular reason to doubt it either, but if someone has experience, you can review it. Useing a pressure sensor in combination with ESP D1 mini /ads1115/level converter

my yaml which should be adapted to this wiring is here but obviously, something must be wrong

esp8266:
  board: d1_mini
i2c:
  sda: D2
  scl: D1
  scan: true
ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 4.096
    name: "pressure"
    id: IP
    internal: false
    unit_of_measurement: 'bar'
    accuracy_decimals: 1
    icon: "mdi:volts"
    update_interval: 2s
    filters:
      - median:
          window_size: 5
          send_every: 5
          send_first_at: 5
      - calibrate_linear:
          - 0.51 -> 0
          - 3.38775 -> 3.7
      - lambda: |-
          if (x <= 0){      
            return 0;
          } else {
            return x;}

Hello @catdogmaus I have ADS1115 set up with 8286 and all working fine. I would suggest check with multimeter you have correct supply to ADS1115 Vin. And switch around D1 and D2 wires after you have confirmed you have correct power. I have used different pins because I was short on pin space. Let me know how your error hunting goes.

@billyjack000 I’m looking to build a pressure sensor for my fermenter as well. Would you be willing to share you schematic and config?

The level shifters are digital (on or off). So they won’t work with a device that puts out an analog voltage based on pressure. A simple resistor network will step down the voltage without loss of resolution…

I was able to resolve it in this fall. It was a power issue. Just in case I wrote detailed instructions for anybody who might have same problems here:

Why do you use offset: -0.16895? I would think 0.169x3.3 is roughly the 0.5V the pressure sensor is supposed to give at 0 PSI ?