Basejumper.com - archive

BASE Technical

Shortcut
Sample altimeter C# code for Android and Wear devices with barometer
I've created two sample Visual Studio projects (in C#) that turn your Android or Wear device equipped with a pressure sensor into a simple altimeter showing current altitude above mean sea level in feet. I hope some jumpers with at least basic understanding of software development might find this interesting and poke around the code, customize it to their likes, and maybe even develop their own ideas. It's a very simple app - all the code, including the barometric formula, is in MainActivity.cs.

We now have quite a few smart devices equipped with a pressure sensor, some of them are even very affordable, for example, Moto 360 Sport was available a year or two ago at Walmart and Target for ridiculous closeout price of $50; it has an excellent transflective screen which is very readable in direct sun; GPS, barometer (with 25 measurements per second!), accelerometer, etc. ZTE Quartz, I believe, is about 80 bucks. LG G Watch R (barometer at 90Hz) can be found used for about same price. Nixon Mission is the absolute king of sensors: a mind-boggling pressure sensor at 167Hz (!!!), accelerometer, gyro, magnetometer, thermometer and humidity sensors, all in this mean-looking mens watch. ($300-450, though)

I've been using Android Wear smartwatches (LG G Watch R initially, then Moto 360 Sport and Nixon Mission) on every skydive since late 2015, and they've been performing wonderfully (running my own simple, but very precise altimeter app, Smart Altimeter). I also use them on wingsuit BASE jumps for exit altitude measurements, as a quick performance gauge by checking the altitude right after opening, for rockdrop measurements (using my Rockdrop Pro app), and for specialized lift-to-drag ratio measurements (using my L/D Vario app, see https://www.youtube.com/watch?v=9Oj8SXvs4GU).

Some Android phones (mostly high-end) also have a barometer, but the sample rate is usually not that high as in smartwatches (go figure). The highest (30Hz) numbers were reported for Google Nexus 4 and Samsung Galaxy S8.

I hope this sample code will spur interest in developing awesome apps for smart devices using their sensors and computing power. The amazing, affordable multi-purpose hardware is here; round pucks the size of an Oreo with incredible array of sensors and high level software development (very similar to desktops, unlike the low level embedded programming). It's the specialized software for jumpers that is almost nonexistent.

Steps to creating an altimeter app for your Android/Wear device:

1. Install Visual Studio Community 2017: https://visualstudio.microsoft.com/vs/
(available for both Windows and Mac)

2. When installing, make sure you select options for mobile app development.

3. Open the solution - Altimeter_Android.sln, or Altimeter_Wear.sln.

4. Make sure Packages in solution are up-to-date. Also, update Tools/SDK Manager.

5. Build the project.

6. On your device, click 7 times on system build number (System->About), you will get Developer Options, turn on USB debugging (Android) or ADB debugging (Wear).

7. Connect your device to computer, confirm debugging permission in a dialog, and choose your device in VS on top in the list of devices.

8. Click on project and in the Run menu select Upload to Device.

9. That's it! On your device, a new app "Altimeter" will appear, now you can experiment with code!

Good luck! Please share how you're using your smart device for skydiving or BASE jumping with your own app or other apps.
Altimeter_Android.zip
Altimeter_Wear.zip
Shortcut
Re: [yuri_base] Sample altimeter C# code for Android and Wear devices with barometer
Hi Yuri,

I've tried to integrate a barometer into my homemade GPS logger.
With the airspeed we got during freefall or wingsuiting it is hard to find a good position for the barometer where it is not affected by the burbles or relative winds.
Also I got very "noisy" data from it and filtering it was not easy.
At the end the filtering is creating not enough accurate data because it's too filtered.
Finally I switched to a more expensive GPS chip/antenna that provides a very good accuracy without the "noise" problem.
Shortcut
Re: [AntoineLaporte] Sample altimeter C# code for Android and Wear devices with barometer
AntoineLaporte wrote:
Hi Yuri,

I've tried to integrate a barometer into my homemade GPS logger.
With the airspeed we got during freefall or wingsuiting it is hard to find a good position for the barometer where it is not affected by the burbles or relative winds.
Also I got very "noisy" data from it and filtering it was not easy.
At the end the filtering is creating not enough accurate data because it's too filtered.
Finally I switched to a more expensive GPS chip/antenna that provides a very good accuracy without the "noise" problem.

Hi Antoine,

Yes, the problem with accurate pressure measurements is a serious one, and I firmly believe that the only solution is to mount the device (or wireless pressure sensor) on a vane in clean airflow, like I did with L/D Magic (running on iphone) and L/D Vario (running on any phone or Wear smartwatch) apps:

https://vimeo.com/132279770
https://vimeo.com/108326309
https://vimeo.com/108428363
https://www.youtube.com/watch?v=u_iPSSV-5qY

The only solution, period. Any other location for the barometer won't give accurate and consistent, burble-noise-free readings. (This also means it's futile to install a pressure sensor inside wingsuit wings to measure dynamic pressure; the static pressure still needs to be measured on a vane, otherwise the difference between the two won't be accurate for use in Bernoulli equation to calculate airspeed.)

From my experiments, 0.5m from the body is an absolute minimum to escape the boundary layer effect. It can also be mounted on the helmet, but the stick needs to be long like this (this is my analog L/D meter back from 2009, the ruler is in inches):



(I personally feel that mounting on a belly platform (with detachable pole) is safer during deployment than a long pole on the helmet where it can get inside linetwists or entangle with toggles.)

Once you do this, the data will be much much cleaner, and much less aggressive filtering would be required, so more real data detail will be available.

By the way, L/D Vario app now also uses barometer (if it's available) in addition to accelerometer, to calculate not only L/D, but also polar speeds and current speeds, and altitude, of course.

There's also one GPS that also has a barometer, and it logs data at 10Hz, it's "Bad Elf GPS Pro+". I have the older model (Pro), and it also logs (and sends realtime data to iphone) at 10Hz (L/D Magic works with it), but it doesn't have a barometer. What GPS do you use now?

Using just GPS alone won't allow you to precisely measure the flight characteristics because of wind messing up the horizontal speed, as well as because of temporary dynamic effects such as slow/subconscious flare that make G.R. not equal to true aerodynamic finesse, L/D.
IMG_2956s.jpg
Shortcut
Re: [yuri_base] Sample altimeter C# code for Android and Wear devices with barometer
I'm using a uBlox Neo-M8 with a 5cmx5cm antenna.
It's connected to an Arduino main board.
I had a barometer board connected to it for test.
I was thinking of integrating a pitot with it to have the real airspeed but it has to face the wind almost perfectly to give good data and I would have to jump with a long belly mount like yours and wires everywhere.
GPS is enough for me now with the very good data it gives me.
Shortcut
Re: [AntoineLaporte] Sample altimeter C# code for Android and Wear devices with barometer
AntoineLaporte wrote:
I'm using a uBlox Neo-M8 with a 5cmx5cm antenna.
It's connected to an Arduino main board.
I had a barometer board connected to it for test.
I was thinking of integrating a pitot with it to have the real airspeed but it has to face the wind almost perfectly to give good data and I would have to jump with a long belly mount like yours and wires everywhere.
GPS is enough for me now with the very good data it gives me.

Yes, for Pitot tube to get accurate pressure measurements, it must be mounted on a vane far enough from the body. I made this Frankenstein Pitot tube device (with separate dynamic and static tubes) with hoses and wires running from a triangular vane to the logging device on the belly platform (it was a data logger for model airplanes), back in 2007.





It was then that I discovered that at 20-25cm from the body, the airspeed is already reduced by about 30% of actual airspeed! (and the angle of airflow is also significantly more flat than that of the relative wind coming from infinity - the airflow is already bending around the body.) Later, with L/D Magic and a longer pole, I found results consistent with other data and concluded that 50cm is a reasonable compromise, but no less than 50cm.
Z-Device.jpg
Z-Device2.jpg
Z-Device3.jpg
Shortcut
Re: [AntoineLaporte] Sample altimeter C# code for Android and Wear devices with barometer
Antoine, what L/D are you getting for your big wingsuit?
Shortcut
Re: [yuri_base] Sample altimeter C# code for Android and Wear devices with barometer
With my 3rd I got by best GR around 3 a constant speed. I was flying very slow like 120 km/h, but still able to flare a bit.
Shortcut
Re: [yuri_base] Sample altimeter C# code for Android and Wear devices with barometer
A few more bits of info that might be useful.

For those not familiar with Android development, here are the files you can start making changes to:

/Resources/layout/Main.axml
(for Wear, there will be two: Round and Square, for different form factors)

- open it and you will see the visual designer of the main screen; you can drag&drop controls from the Toolbox pane on the top right, change their properties in the Properties pane on the bottom right

/Resources/xxxxxxdpi/Icon.png

- these are your app icons for various screen resolutions

/Properties/AndroidManifest.xml

- specifies what minimum version of Android your app supports, package name (must be unique for the app), etc.

/MainActivity.cs

- this is where the main code is. Also, specifies the app name as it appears on the device (Label = "Altimeter"). The formula for altitude AMSL is exact from the US Standard Atmospere 1976, you can trust it.

For Android dev't guides, see https://developer.android.com/guide/
For Wear OS, https://developer.android.com/...ning/wearables/apps/
For sample code for multi-platform dev't in Visual Studio, see https://developer.xamarin.com/samples-all/

For list of smartphones with barometer, see (it's in Russian, but phone names are English) https://market.yandex.ru/...rst=0&how=aprice

For list of Wear OS devices, including which sensors they have, see https://docs.google.com/...9dAQf_sfc/view#gid=0

Since a new batch of Wear OS smartwatches with the new Snapdragon 3100 SoC is expected soon, I would not recommend buying a previous generation 2100 watches now, only used ones for cheap. As a starter, a used Moto 360 Sport can be found on ebay and such for about $50. It has a transflective screen that's easily visible in direct sun:



It works great as an altimeter (especially on cheststrap or mudflap, where its power button cannot be accidentally pushed), and I use it on every skydive (although I do have Viso for a backup).

Besides desirable high sample rate of barometer, it's important to be aware that some devices have water resistance and so the breathing hole for barometer/microphone can be covered by a membrane that will introduce lag to fast changes in pressure. For example, on my LG G Watch R I had to puncture this membrane with a needle. Moto 360 Sport has an excellent membrane or grille that doesn't delay pressure changes. Nixon Mission has a unique feature - a mic lock/door - that when open, allows free air access to inside.

Known to me high sample rate barometric devices currently are:

Nixon Mission - 167Hz
LG G Watch R - 90Hz
Moto 360 Sport - 25Hz
Huawei Watch - 20Hz
Google Nexus 4 - 30Hz
Samsung Galaxy S8 - 30Hz

iphone is no good - 1Hz. (and probably murdered by aggressive filtering)

Any questions are welcome!
Moto.jpg