I'm trying to build a pressure data logger using an Arduino and Mindman MP47P-03-F1 (https://www.mindman.com.tw/proimages/pdf/E_MP47_S.pdf) pressure sensor, the sensor is connected to an outer 12-24 VDC power source. I've connected the analog wire to the the Arduino's A0 and connected the DC- (blue wire) of the sensor and the DC- of the power supply to the GND on the board. i get a voltage reading even when the pressure is 0 and the reading is unstable so the pressure i get is fluctuating and noisy. Any suggestions on how to fix this?
This is the code:
An unstable voltage reading is usually indicates a "floating" input, or loose connection. Did you solder the connections to the sensor? Did you connect the sensor GND and Arduino GND?
Please post a close up, focused photo showing the board and all the connections.
unfortunately, i dont have a scope. from the voltage reading i get from the arduino, it fluctuates around 1V with +-0.2V. this fluctuation is translated into ~1kPa of pressure.
the fluctuations are random, i dont see any pattern of repetition.
do i also need to normalize the pressure so that 1V is 0 MPa?
You have the power supply negative routed through through the Arduino ground (GND). Don't do that!
Connect the power supply white wire directly to the MP47 blue wire
thanks for the code Wawa, but why did you use the offset as 123? it doesn't zero the pressure. i changed it to 201 and it works good.
the thing is a keep getting spikes in the pressure without actually putting pressure in:
|202||1.2165|
|201||0.0000|
|202||1.2165|
|201||1.2165|
|201||-1.2165|
|200||3.6496|
|202||0.0000|
|202||1.2165|
|201||0.0000|
|201||-2.4331|
|201||0.0000|
|201||0.0000|
the left side is the analogRead values and the right is the pressure. for the same analogRead values i get different pressures.
The datasheet of the sensor says that it outputs 0.6volt at zero pressure.
With a 5volt processor and 10-bit A/D I get 0.6 / 5 * 1024 = 122.88 (123).
If you're not getting 0.6volt (123) from the sensor without pressure, then there could be something wrong with the sensor or sensor supply.
I see four decimal places in your readout (I did cut off the decimal places).
Wishful thinking. With a 10-bit A/D you get about 900 steps, which is not even enough to display 1000kPa without any decimal places. If you want decimal places, then display in Mpa or Bar.
`float sensorType = 10.0; // Bar
A jump of one A/D value from 201 is not that bad, and can be fixed with smoothing code.
Leo..
@jim-p i tried a different analog input but with no success.
@Wawa, from what i've calculated, the voltage at 0 MPa should be 1V (P=0.25V-0.25) and this is what i also get when measuring.
is there no other way to remove the ±1 fluctuations in the analog read? each of this jumps translates to ~1KPa of pressre.
I now see that the sensor has a 1-5volt range, so offset should indeed be set to about 200.
You have a 1000kPa sensor an A/D with 1024 - 202 = 822 steps that could jump one digit.
That makes it seemingly impossible to display with a 1kPa resolution.
I did mention smoothing code (oversampling) in post#18. That will give you a more stable readout and more A/D values to display in 1kPa.
Leo..