Shop OBEX P1 Docs P2 Docs Learn Events
Intersema MS5534 pressure sensor — Parallax Forums

Intersema MS5534 pressure sensor

CMcGCMcG Posts: 17
edited 2007-12-19 22:59 in BASIC Stamp
Hi all,

Does anyone have any experience working with ths pressure sensor device? In particular I am looking for some help with the Shiftout and Shiftin instructions. I plan to use a BS2IC to talk with the MS5534. I am using an external 32kHz oscillator for the MS5534's ADC.

Thanks
Carl

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-12-19 03:31
    The MS5534 needs to work at 3 volts power supply. The Stamp inputs can work fine at 3 volts, but you need a level translator from 5 to 3 to go from the Stamp to the Barometer. In my setup, I used a CD4049 hex inverting buffer/level translator.

    Here is some shift code. It is set up to use three pins from the stamp, bpin for the shift clock, bpin+1 for shiftin data and bpin+2 for shiftout data.

    getdata:
      PAUSE 110
      SHIFTOUT bpin0+2,bpin0, LSBFIRST,[noparse][[/noparse]~$555\16]             ' reset interface
      PAUSE 5
      SHIFTOUT bpin0+2,bpin0, LSBFIRST,[noparse][[/noparse]~$2f\12]              ' command to convert pressure
      GOSUB delay
      SHIFTIN bpin0+1,bpin0,MSBPOST,[noparse][[/noparse]rawpres\16]              ' bring back pressure data
       rawpres=~rawpres                                                   ' invert to compensate for hardware invert
    'DEBUG HEX4 rawpres
      SHIFTOUT bpin0+2,bpin0, LSBFIRST,[noparse][[/noparse]~$4f\12]              ' command to convert temperature 
      GOSUB delay
      SHIFTIN bpin0+1,bpin0,MSBPOST,[noparse][[/noparse]rawtemp\16]              'bring back temperature data
      rawtemp=~rawtemp
    'DEBUG TAB,HEX4 rawtemp,TAB
    RETURN
    
    delay:   ' delay for flow control, with timeout
      wx=0    ' timeout variable
    delay1:
      wx=wx-1
      IF 1-IN0(bpin0+1)&wx.BIT7 THEN delay1
    RETURN
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • CMcGCMcG Posts: 17
    edited 2007-12-19 09:00
    Thank you very much Tracy.
    I have been using 3k3 / 4k7 potential divider resistors to drop the stamp outputs down to 3V and a 220R / 330R divider with 5V to give me the 3V Vdd for the MS5543. I like the idea of the 4049. Perhaps I could use a spare inverter for my 32kHz crystal oscillator. I'll look into it.

    It took me a while to twig why you were using the ~ compliment instruction (e.g. ~$555). I figure it is because of the 4049 inverters that you are using?

    I read in the datasheets that the reset sequence needed 21 bits. I see you use just 16 bits. I will try your values over the weekend and hopefully I can get them to work for me.

    I really appreciate your help.

    Happy Christmas
    Carl
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-12-19 18:01
    I use a 3 volt regulator. I'm suspicious of the voltage divider you suggested with 220/330 Ohms. The conversion scheme inside the MS5534 is ratiometric, so the 3 volt power supply would have to be steady for the duration of the conversion and well bypassed even if the power supply current fluctuates. I'm not saying it won't work. I'm just skeptical.

    The idea of using the CD4049 is a good one--That's what I did! Schematic attached. You're right, the complement (~$555) is to allow for the inversion. Of course, those values could be written as True and named as CONstants.

    I'm puzzled by the reset sequence, 16 vs 21 bits. That program was written several years ago when the chip first came out, and maybe there was something different then. Maybe. The data sheet clearly specifies 21 bits, in which case it could be:

    SHIFTOUT bpin0+2,bpin0, MSBFIRST,[noparse][[/noparse]$AAAA\16,0\5]             ' reset interface, note msbfirst here
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
    424 x 153 - 2K
  • CMcGCMcG Posts: 17
    edited 2007-12-19 22:59
    Hello Tracy,

    I am still experimenting with my circuit and code so may well end up with a 3V regulator yet. At the moment I have 100uF across the 220R/330R potential divider.·The DC·looks okay on the scope but I will have to see what it is like long term.

    This is the reset sequence that I use ...

    SHIFTOUT Dout,SCK,MSBFIRST,[noparse][[/noparse]$15,$55,$40]····· ' Send reset.

    Your 16 bit··· [noparse][[/noparse] $555\16] works equally well. I have tested it.

    I am hoping to end up with a reasonably accurate altimeter. Right now, I am having fun (yeah right) with the mathsfreaked.gif .
    I have changed from a BS2IC to a BS2eIC with scratchpad RAM. I just didn't seem to have enough variable/RAM space for all those 16bit WORDs needed for the calculations with a standard BS2IC.

    Back to the number crunching.

    All the best
    Carl
Sign In or Register to comment.