7

I have a relatively cheap 0-15psi pressure transducer. It has 3 pins - ground 5V and signal. The signal outputs a voltage of 0.5V to 4.5V based on pressure from 0psi to 15psi. I can verify it does respond to significant pressure increases so it works at least to a point.

The issue is that the reading from arduino can differ by over 50% when at ambient atmospheric pressure (resting on a table). It should be significantly more accurate if the sensor data are to be trusted. The code is basic:

void setup(){
  Serial.begin(9600);
}

void measurePressure(){
  int rawReading = analogRead(A0);   // Range : 0..1024
  //float rawVoltage = (rawReading * (4.5 / 1023.0)) + 0.5;

  Serial.print("Raw reading: ");
  Serial.println(rawReading);

}

void loop() {
  measurePressure();
  delay(1000);
}

The output variations are not entirely random, it seems that the reading goes down and up in intervals of roughly 5-15 seconds. Below is a sample output:

Raw reading: 61
Raw reading: 67
Raw reading: 70
Raw reading: 73
Raw reading: 74
Raw reading: 78
Raw reading: 75
Raw reading: 82
Raw reading: 85
Raw reading: 90
Raw reading: 89
Raw reading: 97
Raw reading: 103
Raw reading: 119
Raw reading: 146
Raw reading: 165
Raw reading: 171
Raw reading: 168
Raw reading: 163
Raw reading: 150
Raw reading: 143
Raw reading: 118
Raw reading: 88
Raw reading: 70
Raw reading: 62
Raw reading: 64
Raw reading: 72
Raw reading: 78
Raw reading: 80
Raw reading: 82
Raw reading: 88
Raw reading: 92
Raw reading: 102
Raw reading: 134
Raw reading: 160
Raw reading: 170
Raw reading: 172
Raw reading: 166
Raw reading: 158
Raw reading: 149
Raw reading: 132
Raw reading: 100
Raw reading: 73
Raw reading: 63
Raw reading: 61
Raw reading: 71
Raw reading: 77
Raw reading: 79
Raw reading: 84
Raw reading: 90
Raw reading: 90
Raw reading: 99
Raw reading: 134
Raw reading: 161
Raw reading: 170
Raw reading: 166
Raw reading: 161
Raw reading: 151
Raw reading: 133
Raw reading: 103
Raw reading: 81
Raw reading: 68
Raw reading: 63
Raw reading: 63
Raw reading: 71
Raw reading: 73
Raw reading: 81
Raw reading: 83
Raw reading: 85
Raw reading: 89
Raw reading: 98
Raw reading: 128
Raw reading: 161
Raw reading: 171
Raw reading: 166
Raw reading: 159
Raw reading: 145
Raw reading: 120
Raw reading: 85
Raw reading: 67
Raw reading: 57
Raw reading: 63
Raw reading: 72
Raw reading: 75
Raw reading: 83
Raw reading: 85
Raw reading: 89
Raw reading: 97
Raw reading: 130
Raw reading: 164
Raw reading: 172
Raw reading: 163
Raw reading: 155
Raw reading: 135
Raw reading: 101
Raw reading: 69
Raw reading: 60
Raw reading: 62
Raw reading: 72
Raw reading: 78

I tried adding 4.7k pull down resistor with no change but that was just a blind try. I have a multimeter connected as well and the reading seems to be more stable ranging from about 0.495V to 0.535V (variations do not seem to match arduino output).

What could be causing the issue?

asheeshr
  • 3,837
  • 3
  • 25
  • 61
DominicM
  • 597
  • 3
  • 7
  • 13
  • Do you seem the same variation with a voltage divider that produces ~0.5V connected? – Cybergibbons Mar 22 '14 at 21:19
  • I didn't have a voltage divider connected, voltage is in range of arduino voltage so not sure why I would need a voltage divider..? – DominicM Mar 22 '14 at 21:35
  • No, just a voltage divider, absolutely nothing else. i.e. with a constant 0.5V input, do you see the same behaviour. – Cybergibbons Mar 22 '14 at 21:42
  • Didn't try that. With nothing connected I see more random variations but only up to a few hundred as opposed to 0-1023 full range. Does that tell you anything or should I still build the voltage divider and test? I also tried another pin with same result. I am using Arduino Pro Micro btw. – DominicM Mar 22 '14 at 21:55
  • A floating input will drift. What you need to work out is if it is the Arduino, your meter, or the sensor causing this. The voltage divider will isolate the sensor. – Cybergibbons Mar 22 '14 at 22:22
  • I connected 33k and 3.3k resulting in 0.45V (0.417 multimeter reading). Got similar results but then I removed multimeter cables and it was stable at 91 with occasional 90. Connected the sensor and nothing else but got same issue. What can I try next? – DominicM Mar 22 '14 at 23:02
  • I don't think you can trust your meter then - it's input impedance should be several orders of magnitude higher than the voltage divider. Does the sensor show the problem without the meter? – Cybergibbons Mar 22 '14 at 23:44
  • Yes, the sensor has the same problem. As for the meter it's a cheapo so no surprises there. – DominicM Mar 23 '14 at 00:20
  • Your code is fundamentally correct. If a resistive voltage divider is providing consistent readings then the issue is with the sensor and the meter. Without a working meter, it would be hard to work out what is going wrong. – Cybergibbons Mar 23 '14 at 12:13
  • Well the meter is working, it just adds some interference when connected together with arduino. The reading itself seems correct. – DominicM Mar 23 '14 at 14:44
  • A multimeter that disturbs the device under test to that extent isn't working correctly. If you connect it to the sensor and Arduino, is it the meter or the sensor or both causing a problem? – Cybergibbons Mar 23 '14 at 17:02
  • I tried same setup with arduino uno and the problem is gone. It also works on micro as long as gnd and 5v pin is connected to uno. Uno measured voltage is 4.88V and micro 4.60V could a voltage difference this small cause this? What else could this be? – DominicM Mar 23 '14 at 20:49
  • Ok, so I have a new multimeter (extech 505). Still getting variations with arduino reading despite a tiny variation in voltage. Multimeter does not disturb the signal any more. What else could I try? – DominicM Mar 31 '14 at 13:00
  • What make and model of pressure transducer is it? – gwideman Apr 08 '14 at 12:00
  • Also, the 5V supply input for the transducer, are you attaching that to Arduino's 5V supply? – gwideman Apr 08 '14 at 12:01
  • @gwideman It's and unbranded chineese sensor. Yes I am attaching it to 5V of arduino (4.6V measured). – DominicM Apr 08 '14 at 13:35
  • Can you point to any eBay or other link for this sensor? – gwideman Apr 11 '14 at 21:42

1 Answers1

2

I tried same setup with arduino uno and the problem is gone. It also works on micro as long as gnd and 5v pin is connected to uno. Uno measured voltage is 4.88V and micro 4.60V could a voltage difference this small cause this? What else could this be?

Reinstatement of incorrect edits by Annonomus Person (AP: Please do not edit answers in such a way that you entirely change their meaning. In the current discussion "the board" is meaningless. We are trying to distinguish between symptoms seen in two different 'boards', an Arduino Uno, and an Arduino Micro.)

Looks to me like the problem is with the Arduino Micro's 5V supply then.

If you are powering the Micro from an external supply (not USB), then 4.6V on the Micro's "5V" output would indicate that the 5V regulator is not operating within its expected range.

If you are powering from USB, then the regulator is not in play. The 4.6V would indicate a problem with the USB's 5V supply.

Likely possibilities:, either the upstream supply is inadequate, or the micros and whatever is attached to it is drawing too much current.

I suspect that the transducer output is fluctuating in a way that's too rapid to be seen by your meter, but which is sampled by the Arduino Micro, giving your varying result numbers.

Either the "4.6V" is inadequate to run the transducer, causing erratic transducer output, or the 4.6V itself is fluctuating, with similar results at the trans output.

And you might also check the ground between micro and transducer -- are you sure that's wired correctly?

gwideman
  • 338
  • 1
  • 7
  • Will test it with a different arduino mini, will need to wait for my soldering iron to arrive though, will update then. – DominicM Apr 09 '14 at 00:50
  • For the setup that produces the fluctuating numbers, please confirm that you have the transducer connected to the Arduino Micro's +5V output, and tell whether you are powering the Micro from USB, or from an external supply, and if the latter, what kind of supply? – gwideman Apr 09 '14 at 01:05
  • If you are powering from external power, such as batteries, please be aware that the specs for the Micro show that the 5V regulator is not reliable below 7V input. – gwideman Apr 09 '14 at 01:06
  • Both the Uno and Mini are powered from usb port so it's not the issue especially since I also tried a different port. Transducer should work with 4.5 to 5.5V but you never know with cheap stuff. Will do some more testing when I receive my soldering iron... – DominicM Apr 11 '14 at 18:34
  • @DominicM Note that I listed several possible issues, not just a single 'it'. A voltage of 4.6V DC may be fine for the transducer. But: (1) a meter measurement showing 4.6V can also result from a voltage fluctuating around 4.6V which will cause erratic transduce. Or (2) 4.6V is below USB 2.0 minimum spec of 4.75V, which in itself suggests something wrong with the supply or the path from USB to transducer. (4.6V is apparently legit for 3.0 though.). And again, it's worth checking the ground path between Micro and transducer. – gwideman Apr 11 '14 at 21:40
  • And if you test the Uno and the Micro powered from the same USB port, should get the same Gnd to +5V voltage reading from their "5V" outputs. 4.88V vs 4.6V is enough of a difference to suggest there's something going on with the power. – gwideman Apr 11 '14 at 21:53