Anyone used the Bosch BMP085 I2C baro sensor yet ?


Closed Thread
Results 1 to 40 of 52

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    Thanks Brian, I had not seen that sensor before. Nice catch.

    Martin,

    Don't know if you saw it already, but sparkfun has some C sample code here:
    http://www.sparkfun.com/commerce/pro...oducts_id=9694

    Sometimes it helps me to look at, even though I don't know C very well.

    I ordered their board, but they are out of stock right now.

    Walter
    Thanks Walter and Brian.

    Brian I'm already committed to the Bosch sensor, and I have one on the way to me. Bare sensors are $8.95US at Sparkfun which is hard to beat.
    I'd like to use it in this project as it has a good track record for use in altimeter devices. The soldering of this device shouldn't be too hard if you have some SMD experience (lots in my case). Or tip it upside down like another guy has and solder wires on top.

    Walter I didn't C the C code at Sparkfun but I did find some in another website here
    http://www.pixelproc.net/varios.html
    I downloaded the C code, but it's all double dutch to me unfortunately. Maybe it will help you.
    Walter maybe we can share some code when we have the devices.

    Martin

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mr.sneezy View Post
    Bare sensors are $8.95US at Sparkfun which is hard to beat.
    Check this sensors out.

    http://futurlec.com/Pressure_Sensors.shtml

    Robert

  3. #3


    Did you find this post helpful? Yes | No

    Default Watch out for light effects

    The FuturLec prices are excellent but I fear the HP03D will give highly variable results depending on incident light intensity. All silicon strain gauges are light sensitive. The HP01 and HP02 ones, coated in black, will be OK. The Intersema MS554x are light dependent even though they have opaque white 'silicone snot' covering the strain gauge element to reduce, but not eliminate, this effect.

    Another trap with all these sensors is that distorting the ceramic substrate will bring out very large pressure and temperature offsets. In my experience, proper SMD reflow oven soldering does not stress the subsrtate anywhere like as much as hand soldering where the thermal stresses build up as each pin is soldered individually. I have found mounting the chip upside down and hand soldering fine 0.010 inch or 0.25 mm wire wrap wires keeps a batch tracking very well. You will not see the stress effects if you only make one or two units but if you build a batch of 100+ the difference unit to unit can be very frustrating.

    The Hope HP03 has a cute feature of an on-board oscillator. I use the CCP registers of a PIC to provide the 32768 Hz MClk to the Intersema snsor but sometimes I would rather use a watch crystal direct on the pressure sensor instead of tying up a CCPWM port.

    Lastly, most of the pressure sensor application notes specify a large tantalum cap across the supply. 47 uF in the case of the Intersema. The leakage current of this cap exceeds the sleep current of the sensor so don't forget that when you calculate your battery life.

    HTH

    BrianT

  4. #4
    Join Date
    Nov 2008
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    Thanks Brian.

    Yes this is a one off project not a big batch, although hopefully many other RC model enthusiasts will build themselves one as it's part of an open source telemetry project using 2.4Ghz.

    The sensor is actually available mounted on a small PCB for about $10 more. That may be the safest option.

    I think the datasheet says only light through the small air hole is a problem on this sensor, so that should be easy to cover with something like carbon foam (antistatic chip foam).

    Looks like I'm pioneering this sensor with PBP, hopefully you guys can help me cross the hard stuff when I get there in a week or so.
    Martin

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Sparkfun has more of their BMP085 boards in stock now, if anyone is interested. Makes it nice to breadboard with. With the board, the cost is about the same as the Intersema. Still waiting on mine.

    Name:  bmp085.jpg
Views: 5122
Size:  46.6 KB
    Last edited by ScaleRobotics; - 24th April 2010 at 02:33.

  6. #6
    Join Date
    Nov 2008
    Posts
    96


    Did you find this post helpful? Yes | No

    Default Restart i2c ?

    I've got my BMP085 now, and I'm using a serial LCD and a PIC12F683 to try converse with the sensor initially. I have a problem with i2c comms, and reading the datasheet it mentions 'Restart condition' between starting a conversion (temperature in this case for simplicity to see it changing) and reading the result.
    Now I've not come across the 'restart condition' before with i2c chips (just EEPROMS thus far).

    Is it done in the PBP i2c statements or does it need to be bit-banged ? Or am I up the whole wrong tree here altogether ?

    Cheers all,
    MArtin

  7. #7


    Did you find this post helpful? Yes | No

    Default I2C start conditions.

    PBP gives you four choices for ShiftIn and ShiftOut to set the clock idle high/low and whether the shift is MSB or LSB first. This should cover your needs with the exception that PBP does NOT give you much control over the timing of the clock and data lines. There is a DEFINE SHIFT_PAUSEUS nn command but this only delays the clock/data transition at the start of the bit and there is no control over timing at the end of the bit.

    Cable length, cloick & data slew speed and any ringing on the clock and data lines can give bulk grief that takes days to find. Been there done that.

    I found with the intersems sensors that the potted PBP ShiftIn/Out routines would only drive about 300 mm of ribbon cable but my hand written bit bang method let me run over a metre of cable.

    Intersema is not the same as the Bosch interface. DIn, DOut and SClk vs SDA and SCL but otherwise the chips are very similar so the same sort of code structure ought to work.

    Here is how I do it.

    Code:
    OutShift:
       for fa = 1 to clockbits  
          'Don't forget OutShift adds an extra clock bit at the end. 
          din = (1 & iword)   'select lowest bit via AND mask 
          pauseus 4   'want minimum - about 4 uS or so
          sclk = 4 : pauseus 4 : sclk = 0
          iword = iword >> 1    'get next LSB, clock out zeros after 16 bits
       next fa
          sclk = 1 : pauseus 4 : sclk = 0 
          'this is the extra clock per DA5541B_00513 datasheet page 13
    return
    
    ResetIntersema:      ' resets ALL pressure sensors
    '   shiftout din, sclk, 0, [85, 85, 0\5]  ' Sense of Din is IN to 5541
       output din  : output sclk
       clockbits = 20 : iword = %0101010101010101     '16 bit data word
       gosub outshift
    return
    
    ConvertDelay:        ' specific to each sensor
       if tank = 0 then
          While dout0 = 1 
          wend   
       endif      
       if tank = 1 then
          While dout1 = 1 
          wend
       endif   
       if tank = 2 then
          While dout2 = 1 
          wend
       endif
    return
    
    FetchWord: ' read specific channel reply.  Different pins for DOut0,1,2
       input dout0 : input dout1 : input dout2 : output sclk : iword = 0     
       if tank = 0 then
          for fa = 15 to 0 step -1   'need 17 clock bits so add one at end
             sclk = 1 : pauseus 4    'wait for Intersema to present next bit
             iword.0[fa] = dout0     'read the bit on selected channel
             sclk = 0                'drop clock
          next fa                    'do it 16 times
       endif
       if tank = 1 then
          for fa = 15 to 0 step -1   'need 17 clock bits so add one at end
             sclk = 1 : pauseus 1    'wait for Intersema to present next bit
             iword.0[fa] = dout1     'read the bit
             sclk = 0                'drop clock
          next fa                     'do it 16 times
       endif
       if tank = 2 then
          for fa = 15 to 0 step -1   'need 17 clock bits so add one at end
             sclk = 1 : pauseus 1    'wait for Intersema to present next bit
             iword.0[fa] = dout2     'read the bit
             sclk = 0                'drop clock
          next fa                    'do it 16 times
       endif
          sclk = 1 : pauseus 1 : sclk = 0  ' 17th clock bit 
          ii = iword.byte0 : ij = iword.byte1
    return
    
    ReadFactoryCal:   
          ' This unpacks the factory calibration coefficients from the just
          ' read W1 ~ W4.
          ' These bitmaps are unpacked into the 6 working coefficients
          ' C1 to C6 which are then stored in EEROM for later use.  
    'W1
       gosub resetintersema
    '   shiftout din, sclk, 0, [87, 1\5]    ' Send W1 pattern to all sensors
       clockbits = 12 : iword = %000101010111  'request W1 pattern
       gosub outshift
       gosub fetchword                     ' recall selected Tank reply
       W1.byte0 = ii
       W1.byte1 = ij
       if (w1 = 0) or (w1 = 65535) then 
          debug "W1 error", 13, 10
          goto readfactorycal
       endif
    
    'W2    
       gosub resetintersema
    '   shiftout din, sclk, 0, [215, 0\5]       ' Send W2 pattern 
       clockbits = 12 : iword = %000011010111
       gosub outshift
       gosub fetchword
       W2.byte0 = ii
       W2.byte1 = ij
       if (w2 = 0) or (w2 = 65535) then 
          debug "W2 error", 13, 10
          goto readfactorycal
       endif
    
    'W3
       gosub resetintersema
    '   shiftout din, sclk, 0, [55, 1\5]       ' Send W3 pattern
       clockbits = 12 : iword = %000100110111
       gosub outshift   
       gosub fetchword
       W3.byte0 = ii
       W3.byte1 = ij
       if (w3 = 0) or (w3 = 65535) then 
          debug "W3 error", 13, 10
          goto readfactorycal
       endif
    
    'W4    
       gosub resetintersema
    '   shiftout din, sclk, 0, [183, 0\5]       ' Send W4 pattern 
       clockbits = 12 : iword = %000010110111
       gosub outshift
       gosub fetchword
       W4.byte0 = ii
       W4.byte1 = ij
       if (w4 = 0) or (w4 = 65535) then 
          debug "W4 error", 13, 10
          goto readfactorycal
       endif
    
    CalcCoefficients:     ' this serves all three sensors.
    'C1
        C1 = W1 >> 3                      'unpack coefficient
        read (108 + tank*20), z.byte0   'store
        read (109 + tank*20), z.byte1
        if z<>c1 then
          write (108 + tank*20), c1.byte0   'store
          write (109 + tank*20), c1.byte1
        endif
    'C2
        C2 = ((W1 & %0000000000000111) << 10) + (W2 >> 6)
        read (110 + tank*20), z.byte0
        read (111 + tank*20), z.byte1
        if z<>c2 then
          write (110 + tank*20), c2.byte0
          write (111 + tank*20), c2.byte1
        endif
    'C3
        C3 = W3 >> 6
        read (112 + tank*20), z.byte0
        read (113 + tank*20), z.byte1
        if z<>c3 then
          write (112 + tank*20), c3.byte0
          write (113 + tank*20), c3.byte1
        endif
    'C4    
        C4 = W4 >> 7
        read (114 + tank*20), z.byte0
        read (115 + tank*20), z.byte1
        if z<>c4 then
          write (114 + tank*20), c4.byte0
          write (115 + tank*20), c4.byte1
        endif
    'C5
        C5 = ((W2 & %0000000000111111) << 6) + (W3 & %0000000000111111)
        read (116 + tank*20), z.byte0
        read (116 + tank*20), z.byte0
        if z<>c5 then
          write (117 + tank*20), c5.byte1
          write (117 + tank*20), c5.byte1
        endif
    'C6
        C6 = W4 & %0000000001111111
        read (118 + tank*20), z
        if z<>c6 then
          write (118 + tank*20), c6
        endif
    
    Show5541Coefficients:   'only used during diagnostics
    '   high txd : pause 1
    '   debug 13, 10, "Tank #", #tank, ", W1 = ", #w1, ",  W2 = ",_
    '    #w2, ",  W3 = ", #w3, ",  W4 =  ", #w4, 13, 10
    '   debug "Derived coeffs C1 = ", #C1, ", C2 = ", #C2, ", C3 = ",_
    '    #C3, ", C4 = ", #c4, ", C5 = ", #C5, ", C6 = ", #C6, 13, 10
    
    return
    HTH

    BrianT

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts