Hi all,

I have been trying to work with a differential pressure sensor (MPXV7002DP) that outputs 0-5V. I have connected the sensor to a Node mcu V3 board. The pressure sensor has 3 pins: Pin1 goes to the Nodemcu 3.3v, Pin2 goes to Nodemcu Ground, and Pin3 goes to Nodemcu A0. When powering the sensor, I did a quick check and hooked a voltimeter to the sensor output, and I could see the ranges going from 0.300 mv to 5.18V (0 to 5V).

In my ESP Home (in Home Assistant), I configure my sensor with the following code:

``````sensor:

pin: A0

name: Pitot Tube

accuracy_decimals: 3

update_interval: 0.5s

filters:

- multiply: 1

``````

I put the filter as “1” because I wanted to see what Nodemcu was seeing, and it sees 0.87 Volts. When I measure the voltage with a voltmeter, I get a reading of 2.7v. Since my expected voltage is 5v, then I put the filter as “5”, but then the ESPHome reads, 4.7.

I then tried multiplying by 5, but adding an offset of -1.8, however, the maximum value measured by the Nodemcu was 3.2v.

I am unsure what to do to just read the raw voltages of 2.7v at no pressure, then 5v for the value when maximum pressure is reached.

I’m not 100%, but I think you may need a voltage divider to step the 5v down to the maximum voltage that the esp ADC can read. Which might be 3.3V.

Have a read of this. Differs for ESP32s.

something like this post?

DC Voltage divider - Let’s Control It (letscontrolit.com)

In the case of the Nodemcu, which has ain internal voltage divider, I would need to add two external resistors to step the voltage down from 5v to 3.3v.

so that inside the HomeAssistant values, 0-3.3v is actually 0-5v.

Interesting… Any help on the values for R1 and R2?

1 Like

I’m still learning myself so I probably shouldn’t advise.

I put some stuff here which may help.

I’ve started using 2 X 300k resistors. Keeps it simple.

As stated on the post, I believe adding a 180Kohm resistor between A0 and the Voltage source will reduce the 5v an output voltage of 1v.

I will try it and let you know!!

2 Likes