Pages: [1]   Go Down
Author Topic: ms 5607 can't get correct altitude and pressure  (Read 716 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

  Hi everyone, I am currently using an Arduino Uno with a ms5607 breakout board to read altitude and pressure values, however, I can't figure out why the sensor sends me garbage data(I assume it is anyway). I tried some codes I found and they give me weird readings.

I connected my Arduino to my ms5607 like so:
  gnd to gnd
  vin to 5v
  ps to 5v
  scl to A5
  sda to A4

The code I am using:
Code:
#include <Wire.h>
#include "IntersemaBaro.h"

Intersema::BaroPressure_MS5607B baro(true);

void setup() {
    Serial.begin(9600);
    baro.init();
}

void loop() {
  int alt = baro.getHeightCentiMeters();
  Serial.print("Centimeters: ");
  Serial.print((float)(alt));
  Serial.print(", Feet: ");
  Serial.println((float)(alt) / 30.48);
  
  int temp = baro.getTemperature();
  Serial.print("Temperature: ");
  Serial.println(temp);
  delay(1000);
}

The IntersemaBaro.h is too big to post but here it is : http://code.google.com/p/marauders-map-gps/source/browse/trunk/arduino/trunk/IntersemaBaro.h?spec=svn24&r=24

The results:
Code:
Centimeters: -16656.00, Feet: -546.46
Temperature: 69
Centimeters: -16689.00, Feet: -547.54
Temperature: 69


I tried several variations of this same code and other programs altogether but this one sums up what I want(temperature is not necessary but is a nice +).
I know that the altitude is off since on : http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm I am on approx 120 feet higher than sea level.

I tried changing the int to long as suggested here : http://arduino.cc/forum/index.php?topic=104247.0 to no success.

Any help would be appreciated!

Link to ms5607Breakout board : http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/altimeter/List/0/SortField/4/ProductID/780/Default.aspx
Other info are found on the same link.
« Last Edit: April 12, 2013, 07:19:33 pm by JeanCoutu » Logged

Offline Offline
Edison Member
*
Karma: 28
Posts: 2036
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Generic steps:

Check your device is actually communicating using I2C.    Run the I2C scanner sketch and see if it responds.

Check your device is actually initialized properly.

I am not familiar with your particular device,  but all these barometric devices work similarly.   They return
some numbers from their actual measurement device,   which then get processed using some formulas and
some constants embedded in the device.   You need to check this process,  step by step.

I've had several similar devices fail,  and generate rubbish like what you have.  They don't seem to be
very reliable.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I checked and it is communicating using I2C, I ran both the I2C scanner(device on 0x76) and my sketch without the 5v and it shows different value which lead me to think it is not broken. Also, the results are different from day to day, today I get :
Code:
Centimeters: -15092.00, Feet: -495.14
Temperature: 65
Centimeters: -15125.00, Feet: -496.23
Temperature: 65
Centimeters: -15125.00, Feet: -496.23
Temperature: 65

I have no idea how to check if it initialized properly, but I don't get any errors messages.

Thanks for the reply.

Checking step by step right now.
« Last Edit: April 13, 2013, 10:06:14 am by JeanCoutu » Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 45
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello JeanCoutu,

this sensor require a voltage between 1,8 to 3,6 volts, not 5 Volt you have connectet!

Connect your MS 5607 to 3,3 volt and if you got good readings, then you have luck.

Read the datasheet bevor you work.

Jürgen


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From datasheet(breakout board not ms5607): Power requirements: 3.3 to 6.5 VDC

I did try to change 5V for the 3.3V but it gives the same results.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I just solved this 10 minutes ago on my end using the info here:

http://arduino.cc/forum/index.php?topic=104247.0
long alt = baro.getHeightCentiMeters();   // <<<<<< CHANGED

 I don't know if the results are accurate, I'm looking into that now. The links here http://www.parallax.com/tabid/768/productid/780/default.aspx have helped me tremendously.
Logged

Pages: [1]   Go Up
Jump to: