High Altitude Balloon project

I don't know how to get pressure data from MS5607 sensor. I know how to get temperature data and altitude data. Can anyone tell me how to do it?

y_yeo:
Can anyone tell me how to do it?

The data sheet tells you:

Figure 2: Flow chart for pressure and temperature reading and software compensation.

The sequence of getting a pressure reading is:

  • read the sensors calibration data (perhaps only once during setup())
  • read the sensors raw pressure data and temperature data
  • calculate temperature
  • from raw pressure value and temperature ==> calculate temperature compensated pressure finally

To obtain best accuracy, the data sheet also describes a "SECOND ORDER TEMPERATURE COMPENSATION".

But in any case: You must have the temperature FIRST, then you can calculate the pressure.

You cannot get a temperature compensated pressure before you have a temperature!

The altitude then must be calculated by using

  • pressure at ground
  • pressure (temperature compensated) in high altitude
  • using an altitude-pressure formula

For altitudes up to 11 km I think you can use the "hypsometric equation" for altitude calculation.

The "mean temperature" for that formula must be calculated during the rising phase of the balloon.

Better NOT USE the NOAA "Pressure Altitude" as published here:
http://www.srh.noaa.gov/images/epz/wxcalc/pressureAltitude.pdf
This formula is only suitable for use in aircraft navigation and is based on a "standard atmoshpere" with assuming standard air conditions like 1013.25 hPa air pressure at sea level. So that formula doesn't calculate the actual height, but it calculates virtual altitude heights for usage in aircraft altimeters.

jurs:
The sequence of getting a pressure reading is:

  • read the sensors calibration data (perhaps only once during setup())
  • read the sensors raw pressure data and temperature data
  • calculate temperature
  • from raw pressure value and temperature ==> calculate temperature compensated pressure finally

I looked the datasheet again. But I saw that the sensor collect both pressure and temperature data. I'm not sure what you are talking about it.

If you are right, I understand what you are saying, but I still do not know what to put for getting the pressure value. My code is in the attachments. Can anyone check the library (below link) and my code to tell me what to put for getting the pressure value?

jurs:
The altitude then must be calculated by using

  • pressure at ground
  • pressure (temperature compensated) in high altitude
  • using an altitude-pressure formula

I'm not sure I need to write calculation in the code because I think it is already in the library. Also can anyone explain to me the concept of interrupt.

High_Balloon_project_cutdown_M.ino (2.58 KB)

y_yeo:
If you are right, I understand what you are saying, but I still do not know what to put for getting the pressure value. My code is in the attachments. Can anyone check the library (below link) and my code to tell me what to put for getting the pressure value?

Sorry, you first have to change the library a bit to get the pressure values into your sketch.

 pre_+=baro. // Do not know what to put

Not possible at the moment with the library code.
Currently the library hides the pressure readings and the BaroPressure class will not let you know the pressure.

At the moment, the library only returns an altitude in the AcquireAveragedSampleCm() function. Although this function reads the pressure and uses the pressure for altitude calculation, it offers currently no user-interface to read the pressure from a sketch. You will have to change the library if you want the pressure.

y_yeo:
I'm not sure I need to write calculation in the code because I think it is already in the library.

The library returns "altitude" (no pressure), which is calculated from pressure and assuming a "standard atmosphere". It is a bad altitude calculation: If the air pressure at start of your balloon is different from 1013.25 hPa, then you balloon will already show an altitude at the starting point: If the air pressure at start is less than 1013.25 hPa (corrected to sea level), your balloon starting point has an altitude that is higher than your starting point is actually located. And if the air pressure at start is higher than 1013.25 hPa (corrected to sea level), the library will show a lower altitude at start than your starting point is actually located.

And if your balloon should start at sea level on a sea shore and the actual air pressure is higher than 1013.25 hPa, then your libray will show an minus-altitude, which would be actually below sea level as if your balloon actually had an underwater launch. I'd better not rely too much on the altitudes provided by that library.

If your altitude balloon is not intended to do different actions at different altitudes, but only is logging data, I'd better change the library and do logging for temperature and pressure data. If you have raw data logged to file, you then can always do later calculations of altitude in Excel and use the altitude formula that you like best.

I'm sorry that because it is my first time using Arduino and doing computer program. Is it possible for you help me with fixing the library to find right altitude and pressure?

If you send me one (preferably on a breakout board) then I'll do it for you. I'm based in the USA.

Send me a private message.

y_yeo:
I'm sorry that because it is my first time using Arduino and doing computer program. Is it possible for you help me with fixing the library to find right altitude and pressure?

I can give it a try fixing the library to get the pressure reading from it.
But I cannot test the sensor as I have none.

These are my questions first before I start to change anything with the code:
1.) Do you get correct temperature readings from the sensor?
2.) Do you get correct altitude readings from the sensor?
Please send an example of altitude reading:

  • altitude reading of the sensor at your location?
  • actual altitude above sea level of your location?

It doesn't make much sense to change the code if it is not working at all for temperature and altitude at the moment.

The key function in the library seems to be AcquireAveragedSampleCm(). Elevate its visibility from "protected" to "public", and move the local variable "pressAvg" into the class declaration. so that you can read the value after calling the function.

jurs:
It doesn't make much sense to change the code if it is not working at all for temperature and altitude at the moment.

I will test the sensor as soon as possible because I currently do not have the sensor. I will send you the result as I test the sensor

DrDiettrich:
move the local variable "pressAvg" into the class declaration.

I'm not sure where to move the local variable 'pressAvg". Can you tell me where to put it?

In IntersemaBaro.h:

class BaroPressure
{
public:
  int32_t pressAvg; //move local declaration here, NOT const
virtual void init() = 0;
...

I fixed the library. Can you check if I did it in right way?

IntersemaBaro.h (8.75 KB)

You must remove the declaration from

virtual int32_t AcquireAveragedSampleCm(const uint8_t nSamples)
{
...
        //const int32_t pressAvg = pressAccum / nSamples;        
        pressAvg = pressAccum / nSamples;   //use public variable

DrDiettrich:
You must remove the declaration from

virtual int32_t AcquireAveragedSampleCm(const uint8_t nSamples)

{
...
        //const int32_t pressAvg = pressAccum / nSamples;       
        pressAvg = pressAccum / nSamples;  //use public variable

I'm not sure what you are saying. Can you show me how to fix the library?

y_yeo:
I'm not sure what you are saying. Can you show me the fixed library instead?

NO, not without payment.

You should perhaps start with a simple C++ tutorial to understand classes and the difference between private and public variables in classes.