Get height in meters from pressure sensor on android with weather API

105 views Asked by At

I am trying to get as close height in meters as possible from atmospheric pressure sensor on android device. I am using https://openweathermap.org to get current pressure at sea level on my location and also temperature. Its much closer if i am not using standard pressure and sea level and temperature 15 but not the best. I am getting pressure from that api without decimals which affects the result quite a bit. Now I am off by like +-10 meters. What can I do to get closer numbers?

My ideas are:

  • Set starting point at my house to calibrate height
  • Find closer Api client
  • Calibrate using GPS height (average of values)
  • Find better formula
  • Get more sensors

Here is the formula I am using:

    double p0p = apiPressure / currentPressure;
    double mocnina = 1/5.257;
    p0p = Math.pow(p0p, mocnina);
    p0p = p0p - 1;
    double citatel = p0p*(apiTemp + 273.15);
    double result = citatel / 0.0065;
0

There are 0 answers