smartuni / riot-saul-coap

1 stars 6 forks source link

The air pressure value for the height measurement #16

Closed AlexFuhr closed 4 years ago

AlexFuhr commented 4 years ago

Work in progress, will add more information next week.

Problem:

The Saul-based communication between 2 stations transmits the atmospheric pressure in a 16-bit format and can thus have a value in the positive range up to 32767 and in the negative up to 32768.

Implementation by Saul: this line

Line_145

False Code Implementation by Saul (drivers/bmx280/bmx280_saul.c):

Soul_Fehler_1001

Examle Output by Saul:

2019-11-04 14:13:25,410 #  saul read 2
2019-11-04 14:13:25,411 # Reading from #2 (bme280|SENSE_PRESS)
2019-11-04 14:13:25,412 # Data:         983 hPa

And that's exactly where the problem is. The sensor can read the data in Pascal, which are in a range over 1000000. The accuracy of the sensor goes beyond about two-tenths of the decimal of pascal value.

Example only sensor BME280 value:

2019-11-11 13:24:09,929 # +-------------------------------------+
2019-11-11 13:24:10,483 # Temperature [°C]: 21.8
2019-11-11 13:24:10,484 # Pressure [Pa]: 1002037

This means that the value no longer fits into the PhyDat 16-bit variable or is automatically truncated. This means that the printing value becomes inaccurate. In order to be able to measure the pressure exactly with the sensor in order to calculate the height, we need the pressure value as accurately as possible. Because the resolution for the height measurement is 0.2 pa per 1.7 cm.

RMS_Noise BME_280_Datasheet (Line 18)

This means that if the pressure value is only treated in hPa, the accuracy is reduced to 42 meters solely by setting the decimal places of the Pascal values.

Error Example

-Readed Value:           1010444 dpa (deci Pacsal) 
-Saul Readed Value:       1010 hPa

the value of 44,4 pascals is lost (44,4 Pa / 0.2 Pa * 1,7 cm) = 374 cm = 3,47 m

For the control of the air balloon the deviation of 3,47 meters is completely useless.

## Solutuions ##

  1. Difference to mean atmospheric pressure at sea level (101 325 Pa, defined at DIN 1343 )

Saul Interface has a 3 dimension 16 bit variable. So you need 2 dimensions for printing. One dimension is for the differential value of normal pressure and the second dimension is for the positive or negative sign.

One of the 16-bit variable allows the pressure of 685.57 hPa up to 1340.92 hPa (101325 +/- 32767 ).

The change in pressure per 1000 meters is 122.05 hPa, resulting in a measurable difference in height of about 2680 meters, both in the negative range and in the positive range.

From the historical weather data of the maximum deviations on the ground, there is a maximum of a positive deviation of 7155 Pa (1060.8 hPa on January 23, 1907 in Greifswald) and a negative deviation of 5885 Pa (954.4 hPa on November 27, 1983 in Emden).

Examle view PaD

  1. Split the pressure value in 2 dimensions

    -First dimension: kilo pascal value -Second dimension: decimal pascal value -Third dimension: zero

Example view

3_Dimension_Example

Advantageous in this method, there is no limitation of the height measurement, The division into kilopascals and the remaining decimal places are logically followable values ​​and can be easily understood by the user without documentation.

image

image

image

image

rosetree commented 4 years ago

I like the first solution with the relative pressure; great idea! As we discussed: please notify me, if your changes are ready to being used as submodule in this project.

rosetree commented 4 years ago

I’m closing this issue now, as we’re using your modified fork of RIOT (#24) and respond with all the pressure values in CBOR (#19, #23). Feel free to reopen or add another issue, if there are more changes required, @AlexFuhr.