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

yes, it is.

More than enough then.

Hi Spikey, Im Also trying to use a 5v Pressure Transducer with the ESPhome ADC, Do you mind supplying your config for the pressure transducer? Ive been having trouble trying to calibrate the sensor with the 3.3V of the node and the resolution. I had the sensor working with a 5v uno, but converting to esphome yaml and lambdas im struggling with and cant find much info on it. Any help would be great

Why don’t you show us what you have so far, and what problem you are seeing?

Hi nickrout. Well im having 2 issues, Firstly with using the 5V sensor im having trouble getting a correct reading i believe. i havent tested the switch under pressure yet. just at atmospheric pressure but my voltage reading seemed quite off. i think it was 0.8v or 0.08v. i will have to confirm but i dont have the sensor with me at this time, but also that may be a circuit issue as i was trying to use a 2k pot before the A0 pin.
So with using a Nodemcu would i need to drop the signal 0.5-4.5V to 0-3.3v? and if the pressure is very low do i need to drop the signal voltage to get a correct reading, or does this only affect if the the signal voltage and node if the pressure voltage exceeds 3.3v

This is the config i have been using to read the sensor, but now struggling to go further with how i take the analog reading for resolution

sensor:
  - platform: adc
    pin: A0
    name: "Water Pressure"
    id: 'WaterPressure'
    filters:
    - offset: 0.5
    - lambda: return x * 3.3 / 1024 #not sure if this should be the supply voltage of 5v or 3.3V
    update_interval: 1s

https://wiki.dfrobot.com/Gravity__Water_Pressure_Sensor_SKU__SEN0257#target_5

Thanks, i appreciate any help or if someone could point me in the right direction, unfortunately there is not much on using pressure sensors with esphome that i can find, and the esphome site i really struggle to understand sometimes

Hey @R3plic8, take a look at this solution: Water filter quality and water softener status there’s a code block in there that contains the calibration values for both sensors. I calculated them against my fixed hardware 175psi pressure gauge. I don’t know if they’re all that accurate but they are ABSOLUTELY precise!

If you’re going to use the sensor(s) with any precision I recommend you calibrated it/them against something else. I performed my calibration (pedantically) by pressurizing them all together and letting out a little water between each measurement. Took data on every 5psi of change and gathered 20-30 measurements from each sensor then averaged those and used a quadratic fit from ESPHome. The results are more precise than I could have hoped for.

Let me know if you have any questions.
-Greg

One thing you need to bear in mind is that an esp8266 will only read between 0-1v - see from the esphome adc page

This component prints the voltage as seen by the chip pin. On the ESP8266, this is always 0.0V to 1.0V Some development boards like the Wemos D1 mini include external voltage divider circuitry to scale down a 3.3V input signal to the chip-internal 1.0V. If your board has this circuitry, add a multiply filter to get correct values:

Hi spikey. Thanks alot for the info. I did come across your code in another thread as well from you earlier th is month. The sensor is actually in the system and the moment and running from arduino with solenoids and pumps. So I will have to test again later today when I can get the chance. I do also have a pressure Gauge in the system that I would be able to compare pressures with. Thanks again

Hi nick rout. I do understand the esp8266 chip will use 0-1 volt. But with the dev board having a 100 and 220 ohm resistor on a0 pin. Is it not capable of receiving 3.3v? Edit. Apologies I read that wrong. So I would still need to add the multiplier even though it’s supplying 3.3v but only reading 0-1 on the chip

It would probably be helpful if you told us exactly which esp board you are using, and a link to a schematic if possible?

Thanks i will do so, unfortunately my son has come 3 weeks early so things are upside down at the moment.

Hi Nickrout, Hopefully this would help.

The Nodemcu micro controller im using from what i can tell is the Lolin NodeMCU V3. Should be this one below.


Which should have the same specs as
https://docs.zerynth.com/latest/official/board.zerynth.nodemcu3/docs/index.html.
And here is simple schematic
https://imgur.com/a/hExQLjc
This is the pressure sensor
https://wiki.dfrobot.com/Gravity__Water_Pressure_Sensor_SKU__SEN0257.

So In theory im wanting to use the pressure transducer to send its 4.5V max output signal to the trimpot to adjust it for the 3.3v max signal of the Analog pin.
Then from there Use Esphome to adjust any offset and mulipliers for the to get the reading which in turn turns on the pump to pressurize and turn off when full pressure is reached. The solenoids will then be operated on a timer. Im not sure if my wiring would be correct though for the pressure transducer? or if i need another resistor with the trim pot. The A0 pin does seem to have a 10k and 220k resistor on the board between pin and esp8266 chip leading me to think this does the 0-3.3v to 0-1v conversion needed for the esp8226 chip? Thanks again . any help would be greatly appreciated. Im just having trouble getting the correct readings and want to make sure everything is wired correctly first. from there i can adjust trim and try again with the readings. The solenoids and timers i have working fine.

Are you sure they aren’t 100k and 220k? That would make sense to drop 3.3v to 1.0v.

To drop the 4.75v input to 3.3 you’ll need another 100k/220k combination.

In any event you need a voltage divider.

Hi, Yes im starting to understand that the chip will only provide 0-1V, the pin will provide 0-3.3v stepped down to 0-1V and the sensor will provide 0-4.5V stepped down to 0-3.3V.

Apologies , yes its 100k/220k on the A0 Pin.

Would the 2k trim pot not work as an alternate divider to drop from 4.5V to 3.3V.?
Is my thinking correct that the 2k trimpot can provide a 533.3 Ohm and 1466.575 Ohm resistances to drop the 4.5 to 3.3v
Thanks for all the help

@R3plic8 did you keep going with this and if so did you get a working solution or stuck / need some help?

Hi Daniel.

I did not get it working as i wanted it to, but i managed to get it working enough that it did what it needed to.

I got as far as receiving the pressure data in voltage and cross referencing that to a physical inline pressure gauge. from there i set the voltages(pressure) i wanted the relay to turn off an on at.

1 Like

Another option is what I did switch to an ESP32 it simplifies this alot!

 - platform: adc
    name: "Pressure"
    pin: GPIO35
    id: pressure
    update_interval: 60s
    unit_of_measurement: "PSI"
    accuracy_decimals: 2
    attenuation: 11db
    filters:
      - calibrate_linear:
        - 0.5 -> 0.0
        - 2.5 -> 30.0

This uses a level shifter 5V high side 3V3 low side and you have multiple Analog pins also

3 Likes

@DrJeff amazing!

Don’t know if it can be useful for anyone but I’ve build an esp32-based 5-port pressure and power socket controller with pressure sensors from aliexpress (exactly like that TS shown) and voltage dividers.

It shows current pressure on an LCD and manages two 220V power sockets (via two SSRs) depending on min\max pressure settings and max on / min off time, I’m using it to control my air compressor and lights (the last one TBD) in my air-atomized aeroponics farm.

Here is the code:

2 Likes