Shop OBEX P1 Docs P2 Docs Learn Events
Help with MS5607 corrections for low temperatures — Parallax Forums

Help with MS5607 corrections for low temperatures

aparis1983aparis1983 Posts: 22
edited 2014-06-26 16:23 in Accessories
Hi,
Hopefully I can get some last minute help. I'm launching a high altitude balloon tomorrow (Saturday May 24th) with the MS5607 altimeter on board on the Propeller BOE with an LCD readout as well data logging. My code does not have the two corrections needed for lower operational temperatures (below 20 celsius and below -15 celsius). Can anyone give me code suggestions as to how to incorporate these two corrections?
Much appreciated. Otherwise will have to launch as is and see what happens.

Andres
CON    
_clkmode = xtal1 + pll16x   
 _xinfreq = 5_000_000    
sd_DO = 22    
sd_CLK = 23   
sd_DI = 24   
sd_CS = 25    
TX_PIN = 2    
BAUD = 19_200    
START_ALT = 20              
OBJ    
sdfat : "fsrw"      
pst : "Parallax Serial Terminal"    
LCD : "FullDuplexSerial.spin"    
alt : "29124_altimeter" 
PUB start | a , t , mount   
LCD.start(TX_PIN, TX_PIN, 00, 19_200)                       
waitcnt(clkfreq / 100 + cnt)                                   
mount := \sdfat.mount_explicit (sd_DO, sd_CLK, sd_DI, sd_CS)   
LCD.tx(17)   
if mount < 0         
    lcd.str( string( 13, "Failed to mount", 13 ) )                 
    abort   lcd.str(string( 13, "SD card found & mounted", 13) )           
alt.start(alt#QUICKSTART, alt#BACKGROUND)                      
alt.set_resolution(alt#HIGHEST)                                
alt.set_altitude(alt.m_from_ft(START_ALT * 100))               
sdfat.popen( string("Data.csv"),"w")   
repeat     
    a := alt.altitude(alt.average_press)                             
    lcd.str(string("Alt:"))                                        
    lcd.str(alt.formatn(a, alt#TO_FEET,8))                             
    sdfat.popen( string("Data.csv"),"a")      
    sdfat.pputs(alt.formatn(a, alt#TO_FEET,8))     
    lcd.str(string("Temp:"))                                                          
    lcd.str(alt.formatn(t, alt#TO_DEGF,8))                         
    t := alt.current_temp     
    sdfat.pputs(alt.formatn(t, alt#TO_DEGF,8))     
    sdfat.pputs(string(" ",13,10))     
    sdfat.pclose         LCD.tx(13)     
    waitcnt(clkfreq * 5 + cnt)
»

Comments

  • c07Brian.Kesterc07Brian.Kester Posts: 36
    edited 2014-06-18 08:39
    Hey Aparis, I know this is too late, but I figured I would respond in case you want to try this again. I don't do SPIN programming, so you'll have to take this for what it's worth... though I did base my C program on the SPIN code. All that said, here goes... the code used in the demo code (there's a great html document in the zip file explaining each section in case you haven't looked at it) has the following section to calculate the pressure and temperature on the 5607:
    PRI _cur_temp_press_5607 | d1, d2, dt, offh, offl, sensh, sensl, ph, pl
    
      d1 := _read_adc(RSLT_D1)
      d2 := _read_adc(RSLT_D2)
      
      dt := d2 - c5 << 8
      cur_temp := 2000 + ((dt ** c6) << 9 + (dt * c6) >> 23)
    
      offh := c4 ** dt
      offl := (c4 * dt) >> 6 | offh << 26
      offh ~>= 6
      _dadd(@offh, c2 >> 15, c2 << 17)
    
      sensh := c3 ** dt
      sensl := (c3 * dt) >> 7 | sensh << 25
      sensh ~>= 7
      _dadd(@sensh, c1 >> 16, c1 << 16)
    
      _umult(@ph, d1, sensl)
      ph += d1 * sensh
      pl := pl >> 21 | ph << 11
      ph ~>= 21
      _dsub(@ph, offh, offl)
      cur_press := ph << 17 | pl >> 15
    

    After calculating cur_temp, you would have to do two if statements (one nested inside the first) to calculate a T2, OFF2, and SENS2 based off the equations in the datasheet. Ultimately, the best thing to do in your case until you can get the 2nd order compensation figured out on the board is just record the raw values and post-process in a program you're comfortable with such as excel or MATLAB.
  • PropGuy2PropGuy2 Posts: 358
    edited 2014-06-19 15:07
    First I would call the manufacturer of the IC, they may have already done the work for you when they originally designed the chip. Second try to find a company that has an environmental chamber (extended temperature and sometimes pressure) and plot everything for there.
  • FrannyFranny Posts: 127
    edited 2014-06-26 16:23
    Hi, Does anybody have SimpleIDE C code for the MS5607 Altimeter Module? I just need to be able to get a variable integer out of it that goes up and down accordingly.
Sign In or Register to comment.