Please note I’ve already tried this - it did not solve the problem.
I am trying to hook up a pressure sensor to my house water lines - there is a CPS (constant pressure system) that keeps the pipes at ~60psi.
I have tried 3 different transducers (2 of them 100psi, 1x 200psi).
After several hours of functionality, for an unknown reason I get extremely low pressure readings (negative). The crazy thing is, with the last transducer this happened even when I isolated the pipe it was on to ensure there was no pressure fluctuation!
Code is below, as is history readings.
What is driving me crazy is the transducer works absolutely fine for a few hour…and then bam, negative pressure, whacky readings. Can anyone help me start to figure out why? At first I thought it was the voltage issue - but switching to a 200 psi ensure that voltage to the GPIO pin us under 2.5v at all times (well, should be!)
Set the attenuation to 11 and see if the issue still occurs.
What I am thinking may be happening is that you get a bit of water hammer when a tap is shut off quickly giving a spike of pressure that exceeds the ADC input voltage (~2.5V) and maybe confuses the auto attenuation setting.
You could also limit these spikes with a 2.5V TVS or Zener diode and resistor to protect the ADC.
I will have to look into a TVS, unfamiliar with that so any more info would be appreciated.
What is concerning is if I caused permanent damage to the transducer now? As plugging it into a different pin doesn’t change anything - ADC still reads very low giving negative PSI.
Re-designing the circuit as you described to clamp the voltage so it can’t happen before sacrificing another esp32 would be a grand idea. Even momentary spikes could cause damage leading to odd behavior long term.
yeah sensor looks fine, industrial off-the-shelf but yes will output 4.5v and fry things eventually if not immediately. the 200 PSI was a good 2nd choice.
I used ADS1115 specifically because it can allow, if you use the correct power supply, a higher voltage to be read. In the end my pressure sensor failed; I discovered small debris in the pressure chamber.
Well, a quick update.
I tried the above diagram from and @bwooce took your advice contemplating the ADC was damaged, I used a whole new ESP32 board.
I used @tom_l’s diagram from above with only difference is the diode is 2.4v 500mW
Specifically:
The 2.4v from this pack
and the resistor from here.
Unfortunately, my readings now do not get above 0.51v … I am going to order a new pressure transducer in case the spikes/hammer actually did damage to it.
In addition, I am getting this hammer arrestor for testing, though I hope it’s not truly needed.
If you want to check/laugh at my soldering, I’ve attached the image for that as well
It’s hard to tell because the picture is out of focus but your diode appears to be back to front. Zeners and TVS diodes work in reverse bias. The black stripe on the diode body should be connected to the +Ve side, not ground. Like this:
The way you have it the diode will clamp everything to about 0.6v.
Thanks, @tom_l
The diode was backwards. However, correcting this now gives me readings of 0.3v which results in negative pressure when I know I should be around 60psi. (I’ve adjust the code for linearity accordingly for a 100psi transducer).
The graph shown in the first post is exactly what I saw when first using a Gravity SEN0257.
Putting a 15R resistor and zener diode on the sensor output will not help in the slightest to get it working. More likely damage the sensor.
Use the circuit posted by mulcmu in the link you found.
Check the 5V supply to the sensor is 5V (not 4.5V).
Check that the 0.01uF capacitor is connected across the sensor OUTPUT.
Not the sensor supply.
Well, something strange happened overnight without any intervention - my readings are jumping from 0.3v to 3.xx
[07:34:31][D][sensor:094]: 'voltage': Sending state 0.34800 v with 2 decimals of accuracy
[07:34:31][D][sensor:094]: 'House Pressure': Sending state 67.15000 PSI with 2 decimals of accuracy
[07:34:33][D][sensor:094]: 'voltage': Sending state 3.18600 v with 2 decimals of accuracy
[07:34:33][D][sensor:094]: 'House Pressure': Sending state 67.15000 PSI with 2 decimals of accuracy
[07:34:35][D][sensor:094]: 'voltage': Sending state 3.18600 v with 2 decimals of accuracy
[07:34:35][D][sensor:094]: 'House Pressure': Sending state 67.15000 PSI with 2 decimals of accuracy
[07:34:37][D][sensor:094]: 'voltage': Sending state 0.34600 v with 2 decimals of accuracy
[07:34:37][D][sensor:094]: 'House Pressure': Sending state -3.77500 PSI with 2 decimals of accuracy
[07:34:39][D][sensor:094]: 'voltage': Sending state 3.18600 v with 2 decimals of accuracy
[07:34:39][D][sensor:094]: 'House Pressure': Sending state 67.15000 PSI with 2 decimals of accuracy
[07:34:41][D][sensor:094]: 'voltage': Sending state 3.18600 v with 2 decimals of accuracy
Using a low value resistor and a zener is a type of fix used on a power supply to a device.
Not on a signal line.
Not least, the calibration will be all over the place.
Totally unnecessary.
Wrong. It is also a commonly used I/O protection method. Though usually with bidirectional TVS diodes a zener will do in this case.
My solution will clamp voltages that could damage the ADC and have little effect otherwise.
Under normal operating conditions (<2.5v) very little current flows due to the high input impedance of the ADC and the zener being below it’s breakdown voltage so the 15R resistor in series has next to no effect (very low current through low R = very low voltage drop). The minor effect it does have is linear and can be easily compensated for if required. In fact if you are worried about the load place on the sensor output for voltages over 2.5v you could increase the series résistance considerably without much effect on the normal operation calibration.
Your capacitive load solution is frequency dependant at all voltages and will cause non linear calibration issues dependant on the signal rise time - at best. It could even cause oscillation worst case.
I’ve worked as an electronics technician for 30 years, 15 of which were spent in the R&D department of a lightning protection company where signal line protection was a common task. I do know what I am talking about.
As you acknowledged, increasing the series resistance will limit ADC input current if it’s max input voltage is exceeded and is all that is needed.
As per the diagram posted by Mulcmu.
The sensor has the problem.
Test it independently.
Fit on a pipe. Connect 5V to it and monitor the output over a period of time.
If you have a 'scope, great.
The capacitor solution suggested here, was a grabbing at straws solution which could possibly work or maybe kill the sensor. It was not a logical solution at all. Strangely, it worked.
The sensor was a low cost device, at least quarter of the cost compared to Sick/ Honeywell etc, so the quality is suspect. Assuming you get what you pay for, try a radical solution, or replace the sensor.
Can’t strip it down and investigate.
In my experience, you don’t put a 15R resistor and a 2.5V zener on the signal output of a 5V transducer.
In the same way, you don’t put a capacitor directly on the output of any transducer.
But in this instance, it stopped it hooting.
(I too have spent many years (40+) in a variety of industrial electronics, including service, commissioning, with a couple in an R&D environment).