I wish to record the output of an analog pressure sensor. The website says that it has a 12 bit resolution. I'm using an arduino uno. I believe it uses a 10 bit ADC. How do implement the conversion in the code? should i use
Operating voltage( max) = 5 V ( range 0-5)
Does the conversion per bit = 5 /1023 ( for 10 bits) or 5/4095 ( for 12 bits)
What I get from data sheet, you have a 5 volt sensor with analog output from 5% to 85% of supply voltage, so 0 PSI would be 0.25 volts or ADC value of 51 and 5 PSI 4.25 volts ADC value 870.
According to the device data sheet, the output voltage range for the analog version of the sensor is from 0.1 to 0.9 of the supply voltage, so you get only about 800 bits of resolution. The digital version would be much better.
.
0.8 x Vsupply
Output (V) = ---------------- x (Pressureapplied – Pmin.) + 0.10 x Vsupply
Pmax. – Pmin.
jremington:
According to the device data sheet, the output voltage range for the analog version of the sensor is from 0.1 to 0.9 of the supply voltage, so you get only about 800 bits of resolution. The digital version would be much better.
How do i implement that formula in the code?
My method
I used analogread() to get the output bit value added 0.5 to it for error correction. Then multiplied that by 5/1024 ( since supply = 5V and arduino has a 10 bit ADC from 0-1023). From the data sheet, the sensor values are from 5-85% of the output voltage. ( 85% of 5V = 4.25 V and 5% of 5V = 0.25V).
voltage = (analogread() +0.5)*(5/1024)
Therefore,
float pressure = voltage * (5 psi/ 4.25 V); (where 5 psi output corresponds to 4.25 V).
But I do not get the same values as the formula in the data sheet.