App Inventor Extensions: Barometer | Pura Vida Apps

App Inventor Extensions


Barometer Sensor Extension

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension or bug reports please start a new thread in the App Inventor community. Thank you.

For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

Jan 19th, 2016: Version 1 of the Barometer Sensor Extension released for App Inventor version ai2extensions6 and Companion version 235.cdk2.

May 11th, 2016: Version 2 released: property SeaLevelPressure added.

Aug 11th, 2016: Version 2a: avoid DX execution failed error: build each extension separately

Description

Barometer Sensor component.
Minimum Android version to be able to use that sensor is Android 2.3 (API Level 9).
Required permissions: none
Thank you George for being the sponsor of this extension.

Properties


Returns whether sensor is available.


Returns whether sensor is enabled.


Specifies whether sensor is enabled.


Returns the current pressure in hPa (millibar). To return meaningful values the sensor must be enabled.


Computes the Altitude in meters from the atmospheric pressure and the pressure at sea level. To return meaningful values the sensor must be enabled. This is an approximation, because for the pressure at sea level per default an average sea-level pressure in hPa (millibar) will be used.
You can set the pressure at sea level in the seaLevelPressure property.


Returns reference sea level pressure.


Specifies reference sea level pressure.

Events


Event indicating that a pressure change occurred.
Also calculates the Altitude in meters from the atmospheric pressure and the pressure at sea level. This is an approximation, because for the pressure at sea level per default an average sea-level pressure in hPa (millibar) will be used.

You can set the pressure at sea level in the seaLevelPressure property.

The question is: what to use as the reference pressure? This will change with the weather and will drift over time. Typically you would do some sort of calibration to set this value and possibly update it. It depends on your use case what the right solution is.

If properly calibrated, pressure based altitude is considerably more accurate then gps based altitude especially if you are interested in altitude differences rather than absolute altitudes.

Example App: Barometer

Test

Tested successfully on Nexus 5 running Android 6.0.1 and Samsung Galaxy Tab 10.1N running Android 4.0.4 (no barometer sensor available).

For questions about App Inventor,
please ask in the App Inventor community.Thank you.

Terms and Conditions

Download


Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Bitcoin

Thank you! Taifun
 

Download TaifunBarometer extension (aix file)
Download Barometer Test (aia file)
Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.


Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact