There was a long thread about this earlier this year but a failure of my commercial weather station prompted looking at it again.
The easiest sensor to use is the MPX4115 but this has the disadvantage that standard atmospheric pressures will create an output in the range 3.8-4.3 volts. This means that with a 10 bit ADC accuracy will be in the 2-4mb range.
Using the solver in excel I calculated that if the ADC could be fed a negative reference voltage of 3.848 volts then accuracy would be increased to better than 1 mb and also that the calculation of pressure would be trivial (1mb change = exactly 4 ADC counts)
Only the 18M2, 28X2, and 40X2 have this negative reference capability so an 18M2 was used.
Code is:
As has been previously discussed the output of the MPX4115 is noisy so it needs decoupling and the output filtering as per the datasheet.
Hope this is of use, I like the fact that using a specific reference voltage not only increases accuracy but makes the math trivial compared to the sensors standard calculation: Vout = Vdd * (0.009 * pressure in kPa -0.095). The 3.848V reference is just set using a 20 turn trimmer pot.
The easiest sensor to use is the MPX4115 but this has the disadvantage that standard atmospheric pressures will create an output in the range 3.8-4.3 volts. This means that with a 10 bit ADC accuracy will be in the 2-4mb range.
Using the solver in excel I calculated that if the ADC could be fed a negative reference voltage of 3.848 volts then accuracy would be increased to better than 1 mb and also that the calculation of pressure would be trivial (1mb change = exactly 4 ADC counts)
Only the 18M2, 28X2, and 40X2 have this negative reference capability so an 18M2 was used.
Code is:
Code:
#picaxe 18m2
' Measure pressure using a MPX4115
' Use a reference voltage of 3.848 volts on pin C.2 to give 4 ADC counts per millibar
symbol Heightadjust=33 'Pressure effect of local barometer height above sea level in MB*4
symbol ADCadjust = 3843 ' Equivalent pressure for 3.848 volts scaled by 4 (960.667mb)
symbol pressure=w0
adcconfig %100 ' Set C.2 as the negative reference for the ADC
do
pause 1000
readadc10 b.3,pressure
pressure=pressure+ADCadjust+Heightadjust
pressure=pressure/4
debug
loop
Hope this is of use, I like the fact that using a specific reference voltage not only increases accuracy but makes the math trivial compared to the sensors standard calculation: Vout = Vdd * (0.009 * pressure in kPa -0.095). The 3.848V reference is just set using a 20 turn trimmer pot.