Barometric Pressure sensor BMP085 wrong readings

orjanjan

New Member
Hi

I’m struggling to make any sense of the Barometric Pressure sensor BMP085. I am able to communicate with it, so I think the wiring is correct.
The calculations are done in excel, but are not making any sense. I read the calibration data as sad in the manual. But I'm certainly doing something wrong.

I use Picaxe 28x2


- Reads the calibration data from chip as the manual says:

Code:
hi2csetup i2cmaster, %11101110, i2cslow_8, i2cbyte  ; set up bmp085 i2c device
pause 2000

#terminal 9600
hi2cin $AA,(b3,b2) : sertxd("AA=",#w1,cr,lf)
hi2cin $AC,(b3,b2) : sertxd("AC=",#w1,cr,lf)
hi2cin $AE,(b3,b2) : sertxd("AE=",#w1,cr,lf)
hi2cin $B0,(b3,b2) : sertxd("B0=",#w1,cr,lf)
hi2cin $B2,(b3,b2) : sertxd("B2=",#w1,cr,lf)
hi2cin $B4,(b3,b2) : sertxd("B4=",#w1,cr,lf)
hi2cin $B6,(b3,b2) : sertxd("B6=",#w1,cr,lf)
hi2cin $B8,(b3,b2) : sertxd("B8=",#w1,cr,lf)
hi2cin $BA,(b3,b2) : sertxd("BA=",#w1,cr,lf)
hi2cin $BC,(b3,b2) : sertxd("BC=",#w1,cr,lf)
hi2cin $BE,(b3,b2) : sertxd("BE=",#w1,cr,lf)

pause 1000

readtemperature:
hi2cout $F4,($2E)
hi2cin $F6,(b3,b2)
sertxd("UT=",#w1,cr,lf)
pause 1000
end
CALIBRATION DATA:
ac1 9012
ac2 64499
ac3 51028
ac4 34195
ac5 24444
ac6 22856
b1 5498
b2 53
mb 32768
mc 54461
md 2432

UT=31534


CALCULATIONS IN EXECEL:
I use the formula in the manual.
x1=(UT-AC6)*AC5/2^15
x2=MC*2^11/(x1+MD)
b5=x1+x2
T=(B5+8)/2^4

This gives me a temperature of 1188deg???
I have not tried the pressure formula yet, since the temperature is wrong.


- Do I read the calibration data wrong?
- Can I use the reading UT direct into the formula? I don’t really understand the UT=MSB<<8 + LSB in the manual.
- I see that the manual uses some negative values on the calibration data. How do I get negative numbers? The Picaxe is unable to show minus.
- Does it have something to do with the oversampling?

Thanks

Ørjan
 

ThierryP

New Member
Ørjan

1. Please note that the Calibration data are of type 16 bit signed short, which means highest bit is sign, except for AC4, AC5, AC6, which are of type 16 bit unsigned short, see Datasheet.
So where you have taken AC2 = 64499, in fact this should be read as AC2 = -1037. Similarly for AC3 and MC. If I apply your BMP085 values, I get a result of 245 (if you wish I can forward the excel file, but yours works OK, I can reproduce your result of 1187)
2. The results provided by the formula in the datasheet for T are in 0.1 degrees Celcius, so above value reads as 24.5 C. Looks OK to me (maybe a bit too hot for indoors Picaxe hobbying, perhaps opening a window is a good idea :cool:

For Picaxe Basic I must confess I find it complex and confusing to perform the 16 and 32 bits integer maths and 2-complements as required for the calculus in the datasheet.

Have a look here for alternative fractional math calculus in Picaxe basic.
Results achieved with a BMP085+20X2 and fractional math and oversampling:
  • 7 stable readings per minute
  • Temperature: 256x oversampling and resolution 0.01 C
  • Pressure: 2048x oversampling and resolution 0.01 hPa
Rgds

Thierry
 
Top