Following from the Datasheet (pages 4 and 5) I got:
0–150 PSI (0–10.3 bar)
5Vsupply, Vout is 10% to 90% of Vsupply, so 0.5V to 4.5V.
At minimum pressure (0 bar) the sensor should output 0.5V.
At atmospheric pressure (about 1.01 bar) the sensor should output around 0.9V.
At maximum pressure (10.3 bar) the sensor should output around 4.5V.
What I measure with a digital multimeter is completely different:
Vout at atmospheric pressure: 490 mV
When I increase the pressure (relative to atmospheric pressure of 1.01 bar), the Vout rises to around 536 mV. Here it stalls. Means it stays on 536mV even when I further increase the pressure. I am applying surely less than 10 bar (Pmax). Anyway the sensor shouldn't stall at 536mV?
When I decrease the pressure (relative to atmospheric pressure), the Vout drops to around 300mV. A bigger vacuum I can not create with the hand pump I'm using. But again: the sensor shouldn't output that low voltage according to the datasheet?
The measurings are the same with both (new) sensors. And they are the same when I measure the Vout of the sensor with my arduino nano every over the analogRead-Function (and then calculate the Vout of the sensor according to 1023 bits = approx. 5V).
I checked my power supply too: it measures how it should and outputs 4.95V. So the sensors get their 5 Vsupply. Also the same when I power them directly over the arduino nano every.
My conclusion: The sensors are defect or the seller truly sent me different sensors?
I can't get rid of the feeling that I am missing something, because I'm new to electronics. I would be very thankful if someone could check my line of thoughts!
According to the analogRead() Reference the nano is 10Bit and maps Input Voltage from 0V to 5V in 1024 Units.
When I use the arduino nano every analogRead to test the sensors, I get values from 98 to 103 at atmospheric pressure. That means:
5000 / 1024 x 98 = 478mV or
5000 / 1024 x 103 = 502mV
This corresponds to what I measure with the Multimeter.
Like I wrote in my original post: external power supply measures 4.95V (depending, sometimes 4.94V).
Like I wrote in my original post too: Same results even when powered directly from the arduino nano (instead of the external power supply).
To sum up: two different power sources; two different measurement-methods. All tested with both two new sensors. Always the same results (as described in original post). I guess the seller sent me sensors with other specs than advertised.
Can you double check it is ...5 as opposed to the ..3, the 3.3V supply version? I.e it not been marked or packed incorrectly.
Have you tried the device with nothing electrically conected except a clean power supply and DMM and maybe a 'scope. I.e. no arduino - just getting back to the very basics?
Is the power supply filtered, figure 4 on the data sheet shows a 0.1uF cap. I would try adding a small series impedance, say 10 or 100 ohms and a larger capacitance, say 10uF as well as the 100nF. (0.1uF).
These are guesses, as you have found to date, everything you are doing seems fine.
I checked, because I had that guess too. When supplied with 3.3V the Vout was something around 2/3 of the Vout when supplied with 5V. But again: When applied pressure, stall after few mV.
When I measured with the DMM, only the power supply was connected, nothing else. What do you mean with a "clean" power supply? One that has no capacitors on it? I use this one: Spannungsregler AMS1117 Mikro 3,3V/5V/12V LDO Step Down Power for Arduino modul | eBay (there are capacitors on it, but I can't identify them at the moment).
Unfortunately I don't own a scope.
I tried capacitors, but not exactly as showed in figure 4. I've added a 0.47uF between Vsup and Ground (figure 4 says 0.1uF) and I've added a 0.22uF between Vout and Ground (figure 4 says 0.001uF). That were the two smallest capacitors I had at hand and this was my original setup. The results were similar (stall after few analogRead-Units), thats why I started to go back to basics with DMM.
What I didn't try yet are resistors. I have to first read up on impedance, this topic is new for me. I will definitely try tomorrow – thanks for the hint!
Thank you for your reply! I saw your edit with the gage/gauge type. That is a stupid knowledge gap of mine. So am I correct with this:
Output of 0.5 Vout means 0 bar difference to atmospheric pressure (so far the sensors would output a correct Vout)
Output of 0.9 Vout would/should equal to "1 bar + atmospheric pressure" (2 bar absolute pressure).
In this case, the operating range of 0–150 PSI means: atmospheric pressure up to "atmospheric pressure + 10.3 bar"?
What I still don't understand:
Why do the sensors "stall" after few mV when applied pressure (they should rise at least to 0.9 Vout when applied 1 bar pressure)?
Why does the Vout drop when I start to generate a vacuum? When the range is 0–150 PSI, the sensors shouldn't be able to map negative pressure (compared to atmospheric pressure)?
I don't know if my power supply is electrically noisy. Am I right that I would need a spectrum analyzer to measure this? But since the same behaviour happens with the external power supply and the arduino nano too, I guess that the power supply is not the problem?
Maybe we should check your setup (picture) and code first.
Forget about "voltage" with ratiometric sensors.
This sketch should work (untested).
Replace the psi lines with the commented bar lines if you want to display in bar.
Leo..
const byte sensorPin = A0;
float sensorRating = 150.0; // 150psi sensor
// float sensorRating = 10.3; // 10.3 bar sensor
int offset = 102; // 10% zero calibrate
int fullScale = 922; // 90% max calibrate
float pressure; // final
void setup() {
Serial.begin(9600);
}
void loop() {
pressure = (analogRead(sensorPin) - offset) * sensorRating / (fullScale - offset);
Serial.print("Pressure: ");
Serial.print(pressure, 1); // one decimal place is all you get
Serial.println(" psi");
// Serial.print(pressure);
// Serial.println (" bar");
delay(500); // dirty delay
}
Do this step by step. Power it with 5V and measure the analog output. Don't connect the Arduino board yet. Show us a photo how you have wired it.
You might have the wrong pin numbers.
The NC pins should not connect to something. They might have been used during manufacturing. Often one or more of the NC pins connect to the internal circuit. If you connect one of them to GND, then the sensor probably stops working.
Perhaps you have powered it to the wrong pins or with reverse voltage and the sensor is broken.
When applying negative pressure, the output voltage drops below 10% ? I don't see a problem. To be accurate around 0 bar, it should have a little extra.
If display drops below zero on a rainy day, and you don't like that,
then you can always use constrain() or min() or max() to clamp readout to 0.0 and/or 150.0 or10.30.
Leo..
[quote="esaporadix, post:7, topic:998920, full:true"]
Hi stevemj, thanks for your reply!
I checked, because I had that guess too. When supplied with 3.3V the Vout was something around 2/3 of the Vout when supplied with 5V. But again: When applied pressure, stall after few mV.
Sorry Esaporadix,
I am stumped
It seems that you have reduced the sensor to nothng more than a powered sensor and a measured output, so that nothing else can affect the measurement and it is still giving unexpected readings.
Please let us know what the problem is when resolved Good luck.
What do you mean with "forget about 'voltage' with ratiometric sensors"? That there is no point in measuring the Vout with the DMM?
The sketch reads the A0 Pin and calculates PSI. With atmospheric pressure I get around 0 PSI. But when I apply pressure to the sensor, it rises maximum to 2.2 PSI (even when applied more pressure). That's what I mean with "stall". So this is the same result as yesterday (described in mV-Output in my original post).
To apply the pressure or vacuum to the sensor and see the changes of Vout, I use a small hand pump.
The sensor returns a ratio of it's own supply.
With zero pressure, sensor output is 500mV if... the supply is 5.00volt.
If supply dips to 4.95volt, without a pressure change, output dips to 495mV.
So output voltage depends on pressure and supply.
A ratiometric A/D (Uno's default) has the same but opposite behaviour.
When supply drops, sensitivity (mV per A/D step) goes up.
Auto-macical error compensation.
Why go from A/D value to voltage to pressure.
Just go directly from A/D value to pressure.
Leo..
Thanks, now I know what you mean
That's not what I intended originally. The voltage-check was just because I wanted to go back to basics without any arduino connected.