Using a pressure sensor in combination with ESP D1 mini /ads1115/level converter

I’m setting up my first esp home project with a pressure sensor and esp d1 mini.

The pressure sensor is a 100psi 0-4,5volt sensor with a vdd of 5V. As I want to use the full range of the sensor and want to have a good accuracy I choose to use a ads1115 and instead of a voltage divider a logic level converter board. I connected everything according to the scheme below.

But instead of changing the voltage the level converter is only topping of the voltage at 3.3. This means it start with 0,5V (0 psi) and goes to 3,3volt ( ~60PSI) and every above stays at 3.3 volt.
I would expect that 100 psi would be ~3volt and the whole scale should change. As this is my first project I’m probably making a rookie mistake while thinking. Does anyone now how I should connect the level converter board?

according this post: Building an ESP8266 with multiple pressure sensors (using ADS1115 and ESPHome) - #2 by tom_l

IT should be possible to set the logic level converter between the ads1115 and esp d1, however if I do that (between the scl en sda pins), the d1 won’t boot.

1 Like

Power your ADS1115 and pressure sensor from 5V.

Connect the pressure sensor output directly to the ADS1115 (A0 input).

Connect the level converter on the I2C lines from the ADS1115 (SDA and SCL) to convert them from 5V logic to 3.3V logic that the D1 Mini can handle.

3 Likes

Thanks, that setup did the trick!

curious, why is a 3.3V connection needed from the level converter to the ESP D1 (LV to 3.3)? good setup by the way - I’m in the middle of building this setup.

My experience says that this setup does not work. I tried this without success, in case any component is faulty, I replaced all the components - some up to five times, each time the result was

[20:05:30][C][i2c.arduino:062]:   Recovery: failed, SCL is held low on the bus
[20:05:30][I][i2c.arduino:069]: Results from i2c bus scan:
[20:05:30][I][i2c.arduino:071]: Found no i2c devices!
[20:05:30][C][ads1115:073]: Setting up ADS1115...
[20:05:30][C][ads1115:074]:   Address: 0x48
[20:05:30][E][ads1115:076]: Communication with ADS1115 failed!

Then you have likely connected something incorrectly as it worked for avd88.

EDIT: and Lary.

Sorry, missed this question. The 3.3v supply is used to generate the logic 1 level for the low voltage side of the level converter.

1 Like

Your post worked perfectly. Thanks!

1 Like

worked for me very fine as well!

thanks for the smart wiring-instructions to @tom_l - defining the logic 1 level for the low voltage side of the level-converter is the caveat. now that you mentioned it’s so obvious why all of my former approaches had to fail. thanks for the lesson :pray:

I bumped on this while searching for solution to read out a pressure sensor with ESPhome.
My knowledge of electronics is limited but I understand the diagrams a little bit.

Does @tom_l his solution make it possible to convert the whole 4,5V from the pressure sensor to be ‘detected/translated’ (don’t know any other words) or does it ‘cut off’ at 3,3V so there is no difference between the 3,3V and 4,5V output from the pressure sensor?

I found the ADS1115 in the electronics shop that I have ordered some ESP devices before.
What is that component on the far left-bottom in the diagram that tom made?

Is all this powered by the micro USB from the D1 mini?

Yes you get a 0-5V input range. You may see less noise if using the 4.5V output from the sensor.

The component bottom left is a logic level shifter. Converts the 5V logic of the ADS1115 SDA and SCL lines to 3.3V for the ESP.

It can be powered from the micro USB connector or the 5V pin of the ESP board.

1 Like

I found this: “SPI-I2C-UART Bi-Directional Logic Level Converter 4 channel” which seems to match based on the picture: is that the exact same part?

So just by powering the D1 mini, everything is powered?
Just out of curiosity: what does the yellow 3V3 between the ESP board & logic level shifter do?

It supplies 3.3V for the low volts side of the logic level conversion.

Any logic level converter board will do.

1 Like

So I ordered the exact same parts as used in the diagram.
Got the yesterday and a friend who is better in soldering then me (mine are very basic) has put it together based on the correction that @tom_l made.
So far so good!

I was able to add the device in ESPhome and got some reading.
The thing is, the value doesn’t change when putting pressure on the sensor.
I also tried different pin settings since I was not sure about that.

From Analog To Digital Sensor — ESPHome it says that for an ESP8266 (which the D1 mini seems to be), pin A0 (GPIO17) should be used in the configuration.
First I had a reading of 2,99v and now it’s 0,01v (after adding the multiply filter.

All connections are double & triple checked, everything seems to be OK

This is the config used:

esphome:
  name: pressuresensor
  friendly_name: pressuresensor

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "key"

ota:
  password: "password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ssid"
    password: "password"

captive_portal:

sensor:
  - platform: adc
    filters:
      - multiply: 3.3  
    pin: GPIO17
    name: "Living Room Brightness"
    update_interval: 1s
    
  # Uptime sensor.
  - platform: uptime
    name: Uptime

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: WiFi Signal
    update_interval: 60s        
    
text_sensor:
  - platform: version
    name: "ESPHome Version"
#    hide_timestamp: true
  - platform: wifi_info
    ip_address:
      name: "IP"
    ssid:
      name: "SSID"
    bssid:
      name: "BSSID"
     

Sorry if this obvious (but not to me): is it to be expected that I only measure a variable reading on the green lead?

Change

To

esp8266:
  board: d1_mini

Also try this as the pin

sensor:
  - platform: adc
    filters:
      - multiply: 3.3  
    pin: A0
    name: "Living Room Brightness"
    update_interval: 1s
1 Like

Thanks Tom for your swift response! :bowing_man:
I made those changes but still get a reading of 0,01 - 0,02v, with or without air pressure.

EDIT: does it matter that the board is sold as “D1 Mini - ESP8266-12F”

Nope. That’s just a newer optimised version of the ESP8266-12E the original D1 Mini used. The pinout of the dev board is identical.

Owkay… any idea what else to look for/what might be wrong?

What about this? (I meant the green lead as showing in the diagram that you corrected)

The colours mean nothing. Your sensor will have a ground, a power pin and a signal pin. The signal pin is the one that changes with pressure (assuming you have the power and ground hooked up correctly as well).

No I have no further ideas. Sorry.

I’m aware that the colors don’t mean anything.
I was referring to that green line from the diagram because there’s only 1 green that is connected to the signal pin.

Is it possible to measure anything (ie the changing voltage level) before or after (so on the HV or LV pins) of the logic level shifter as a way to troubleshoot?