I'm new on Arduino world. I'm from Portugal and I work on TI Systems.
It is one amazing microprocessor!
One of my hobbies is my car, at this moment I will do some turbo changes, and I need one pressure sensor to control intake pressure.
I bought one MPX4250AP pressure sensor, and Arduino UNO, with help of some forums and other projects I created the code.
At this moment I can read the pressure, but there is some problem. The pressure it is not constant, exists some break down.
Example print from serial port.
1.02
1.15
1.38
1.39 1.10 1.10 1.11
1.39
1.38
On bold there is the low readings from the sensor. But at this time the intake pressure it is about '1.38'.
MPX4250AP Connection to Arduino:
Vs - 5V
VOut - Analog 5
GND - GND
I use one 10nF capacitor between Analog5 and Ground.
My code.
I added the capacitors as MPX4250AP technical data says, I test but same problem.
int SensorPort = 5; // Set MAP sensor input on Analog port 5
double SensorValue = 0; //Save Sensor input Voltage
float ResultkPa = 0; // Save Result in kPa
float ResultBar = 0; // Save Result in Bar
void setup()
{
Serial.begin(115200); // Open serial port
Serial.println("Powered By sSantos - v0.1");
delay(2000);
}
void loop()
{
SensorValue = analogRead(SensorPort);
ResultkPa = (SensorValue*(.00488)/(.022)+20);
ResultBar = (ResultkPa * 0.01) - 1.0172; //multiply (1 kPa x 0.01 bar) and deduct atmospheric pressure
Serial.println(ResultBar);
ResultkPa = 0;
ResultBar = 0;
SensorValue = 0;
delay(300);
}
Lavan:
There will be some fluctuation on the analogRead.
...
...
is this a characteristic of the sensor itself, or the Arduino reading (ADC ?)
i've also had very jumpy analogRead() from a MMA7361 and smoothed it out with a moving average.
the numbers given by the OP look like a big drop out though, if there were a much bigger sample, say 100+ readings, then it would be easier to tell if it's an anomaly or not.
i just copy & paste the Serial.println() output to a spreadsheet and plot a quick chart to see the volatility.