I am trying to convert an analog pressure readings into bar values using Arduino Uno.
Reading the pressure with a digital gauge and DMM I found:
Pressure range: 0.00bar to 1.50bar
Voltage range: 0.70V to 1.40V
The voltage conversion result is correct while the bar result is not as you can see in the attached result.
Surely the conversion used to get the bar is not correct.
OP will answer to this question as he has clearly given the following two points responses of his sensor based on which the equation is derived by me and by @kolaha of post #6.
If your transducer is not a ratiometric device then you will get inaccuracy using the default ADC reference .
The map function will sort your y=mx+c
Beware maths ! You are using small portion of the ADC range ( default ref ) so your resolution will not be great and multiply/dividing by high resolution numbers is meaningless and. Can mislead you ( eg thinking you have 1.005bar when it’s somewhere between 0.9 and 1.1 from ADC Resolution )
Really you need to calibrate with known pressures and read the corresponding ADC numbers and use those numbers in map.
Work in integers , say in 1/10’bar to keep in whole numbers and correct at the output .