Pressure sensor woes - stuck at 5V but only when connected to analog input

I have reviewed many articles on the subject of connecting water/air/fuel pressure sensors to an Arduino. I have a 3-wire sensor: red, black, yellow. Most guides simply connect red/black to +5V/GND, then yellow to an analog pin. FWIW, it seems most people have no trouble getting a signal voltage, but get stuck on converting the voltage to pressure... this is not my problem.

Here's what I've done:

  • build a simple circuit, read values and dump them to Serial: the Arduino and my multimeter agree that I get ~5V with slight wobble
  • disconnect the signal wire from the analog pin: I see 0V on the signal wire, according to my multimeter, which is what I would expect with no pressure on it
  • try other analog pins (A0-5): the Arduino and multimeter see 5V
  • connect a simple variable resistor/pot with +5V/GND in and a 'signal' out to any analog pin: I get 0 to 5V depending on the position of the pot
  • try another sensor, in case the first one is bad: the Arduino and multimeter see 5V

From the above, I conclude:

  • the sensor(s) seem to be working when the signal wire is not connected to the Arduino
  • the analog pin seems to be working when the input is from a simple pot
  • something bad happens when the input is from the pressure sensor

I am aware of INPUT_PULLUP, but I think pinMode(Ax,INPUT) overwrites that.

I would very much appreciate the community's input on what could be going wrong.

My (trivial) code:

void setup() {
  
  Serial.begin(9600);
 
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);

  delay(1000); 
}

void loop() {

  int sanityCheck=analogRead(A0);
  int sensorVal=analogRead(A1);
  float voltage = (sensorVal*5)/1024.0;

  Serial.print("Pressure sensor: Raw:");
  Serial.print(sensorVal);
  Serial.print(" Pressure: ");
  Serial.print(pressure_kPa);
  Serial.print(“kPa, Sanity:”);
  Serial.print(sanityCheck);
  Serial.println("pot ");

  delay(1000);
}

One of the sensors I've tried (the other is 20kPa), both are 0-5V with 0.5V padding on either side.

This is a picture of the circuit, except that mine is an Arduino UNO, and the sensor is the one above, not the one in the picture...

Thank you in advance.

Please post a link to the exact sensor you are using.

You don’t need these lines, and it is best to remove them. Do NOT use INPUT_PULLUP on an analog pin; it will severely distort the readings.

  pinMode(A0, INPUT);
  pinMode(A1, INPUT);

Why are you reading two different inputs? That can cause cross talk. After switching between analog inputs, read the new input twice and throw the first reading away.

I don't have a manufacturer's link for that sensor, but here's the Amazon link:

The pressure sensor on Amazon

A search reveals (for the 1.2MPa version, the above is the 30kPa version):

  • Specifications:
  • Working Voltage: 5VDC
  • Output Voltage: 0.5-4.5 VDC
  • Sensor material: Carbon steel alloy
  • Working Current: ≤10 mA
  • Working Pressure Range: 0-1.2 MPa
  • The Biggest Pressure: 2.4 MPa
  • Cable length: 19cm
  • Destroy Pressure: 3.0 MPa
  • Working TEMP. Range: 0-85℃
  • Storage Temperature Range: 0-100℃
  • Measuring Error: ±1.5 %FSO
  • Temperature Range Error: ±3.5 %FSO
  • Response Time: ≤2.0 ms
  • Cycle Life: 500,000 pcs
  • The transducer come with the pigtail

This is the closest I have to a "data sheet". It confirms the 0-5V nominal range, with 0.5-4.5 actual operating range. I left it out earlier because I am failing one step before the conversion: I am not getting a reliable voltage and will worry about converting that to kPA later.

The purpose of the two inputs was the "sanity check", which I will remove. That was intended to show that the Arduino analog pin will correctly report voltage from 0-5V.

With the two pinMode() lines removed, the potentiometer circuit taken out, the reading on the analog input pin is ~5V. It wobbles around 4.75-5V. I tried it on A0, A1 and A5... same result in all cases.

I don't see a variable named "pressure_kPa" in your code. What is your ADC value at 0 pressure, (should be about 102)?

Just out of curiousity but did you try to power the device on the yellow wire and try the red as signal?

From your OP:

  • disconnect the signal wire from the analog pin: I see 0V on the signal wire, according to my multimeter, which is what I would expect with no pressure on it

Which isn't correct, it should show you something in the range of 0.5V or so according to the datasheet.

Maybe yellow is ground and black is signal?

JCA34F:
I don't see a variable named "pressure_kPa" in your code. What is your ADC value at 0 pressure, (should be about 102)?

Yes, sorry. I edited the code to pretty it up, and missed that. I will deal with the units later. The Arduino reports 5v when the sensor is connected to analog input, and shows 0v to a multimeter when the yellow wire is not connected.

Between which 2 points are you measuring?

If you connect the signal wire to the volt meter and the other lead to the GND. Power the sensor, what do you measure on the yellow wire? It should read ambient pressure at about 0.8V I think, according to specs.

If it doesn't read anything, 0 as you put it, it's either broken or wrongly connected as it should output anything between 0.5V and 4.5VDC.

I'd connect the black wire to the analog pin and use yellow as ground, see if that works.

You don't need an Arduino to verify that the pressure sensor is working, just your multimeter.

If powered properly with 5V, the output should read 0.5V with respect to ground, and the reading should go up if you apply pressure. If it doesn't something is wrong.

Connecting the pressure sensor to the power supply incorrectly could destroy it. Best to ask the seller before trying any connections other than red = 5V, black = GND, yellow = output (as most people would expect).

jremington:
You don't need an Arduino to verify that the pressure sensor is working, just your multimeter.

If powered properly with 5V, the output should read 0.5V with respect to ground, and the reading should go up if you apply pressure. If it doesn't something is wrong.

Connecting the pressure sensor to the power supply incorrectly could destroy it. Best to ask the seller before trying any connections other than red = 5V, black = GND, yellow = output (as most people would expect).

One of my troubleshooting steps was exactly that. I thought I had proved that the sensor produced a low voltage when the signal wire was not connected to the Arduino, but will verify that today. A comment above made me doubt my recollection of what I saw, so I will repeat that.

I have asked the seller, they promised to have a technical person contact me, but so far no cookie.

Thank you very much to everyone who offered their advice. You forced me to think through the circuit step by step, and I found that there was /drum roll a bad wire. The wire that I was using to ground the pressure sensor had some sort of physical break in it, and replacing that wire solved the problem.

As soon as I have something like a final circuit, I will solder the whole mess into place. This has been maddening.

Glad you got it sorted!