## Saturday, November 30, 2013

### GPSLogger for Android

Check for the latest release

This is a follow up article of this post. Now I proceed with a description of Android GPS logger developed and shared by Graziano Capelli. This application have been conceived for OpenStreetMap nevertheless it is also handy as GPS altimeter.

P25.1 Application screen-shot

The application is compatible with Android V2.2 and higher. The Software have been tested mainly on Google IDEOS, Android 2.2, and Samsumg Galaxy with Android 4.1.2.

The power consumption ratio between the background run condition and the regular running mode is about one to two, the main power drain is from the screen back-light.

Installation is straightforward, you may find detailed information here.

At a glance, the installation consist in two steps. Download the source package here and/or copy the GPSLogger.apk file on your cellphone SD card. Alternatively you can use the QR CODE here below. Source code have been developed using Intellij IDEA 11.1.2 under Fedora 19.

Referring to figure 25.3, at the bottom you have two buttons. Toggle button on the left switches GeoPoint collecting state between recording and pause, and the right button saves the path collected. If path save is selected two files are generated, one in GPX format the other in KML format. Position is updated every second, and every twenty collected samples the application save to memory card the recorded positions.

In the preference screen (on recent android versions accessible by holding the home key) you can change the collecting density (the minimum distance between adjoining collected GeoPoints) and you can add an offset (in meters) for manual altitude correction.

P25.3 Application running
P25.3b Settings screen

After some logging is possible to connect to a PC and download the log files.

GPX is the format used by OpenStreetMap, hence you can directly upload this files to OpenStreetMap.
On the below figure you can appreciate the output get after uploading a GPX file to OpenStreetMap platform, the new logged road path is indicated in pink color.
P25.4 OpenStret output after GPX upload

P25.5 Two paths loaded into GE

Main code is included into the source package folder \src\com, is writen in Java and it's commented by the author, if any doubt arise just ask.

The presented application is simple but useful in many DIY surveying tasks, is ideal to support some basic calibration procedures for air data instruments.

## Tuesday, November 26, 2013

### Contributors

I'm proud to announce that today we added some notable members to our team.

Current contributors to BasicAirData.

Greece

George Zogopoulos Papaliakos

Italy

Graziano Capelli, GC
Josè Larragueta Jr, JLJ

Thank for all!

## Friday, November 22, 2013

### GPS altitude application

A previous post have introduced some math about altitude measurement with GPS, within this post I will show a Venus GPS receiver at work. At the same time I will introduce a GPS logger application for Android cell phones, this DIY application was developed and intended as free solution for OpenStreetMap   mapping support.
I give a lot of credit to GC that developed and shared the Android logger system, him is also a main Airboom project contributor.
Figure 20.1 GPS logged path visualized into google earth
Have been chosen off the shelf components so assembly work is minimized.
The chosen receiver is a Venus638FLPx GPS, neatly packed by Sparkfun , the antenna is a 26db Gain unit suited to be magnetically fixed; the GPS and antenna connectors are matched, a four pin right angle header must be soldered to GPS unit serial interface.

The GPS receiver must be then connected to a PC by mean of a TTL serial to usb adaptor. You can see the general arrangement in the next figure.

Figure P20.2 GPS receiver and antenna ready to be connected to a PC

TTL serial usb adapter should be connected with four F/F wires to the GPS receiver, just follow the labels on both units. At a glance, wire the boards in the following way (GND; GND) ,(+3,3V;+3,3V), (TX,RX) and (RX,TX).

Preloaded firmware instructs the GPS receiver to continuosly send GPS strings to serial port , the communication is set to 9600 Baud 8N1. To read the ouput you need to run a serial/modem terminal software on your PC, for the purpose I used Minicom under Linux and Teraterm under Windows.

Once powered up you will get an infinite series of messages like those here below

<<
$GPGGA,134327.141,4509.9767,N,01000.4718,E,1,11,0.8,40.2,M,42.3,M,,0000*6F$GPGSA,A,3,19,01,06,11,14,03,22,27,32,28,20,,1.7,0.8,1.5*3D
$GPGSV,3,1,12,19,72,174,48,11,63,297,49,32,45,219,50,03,42,168,49*77$GPGSV,3,2,12,01,41,289,45,14,38,093,46,27,37,154,48,22,31,055,46*76
$GPGSV,3,3,12,06,26,154,47,28,20,313,48,20,12,232,43,18,00,052,*75$GPRMC,134327.141,A,4509.9767,N,01000.4718,E,000.0,286.2,271013,,,A*6E
\$GPVTG,286.2,T,,M,000.0,N,000.0,K,A*03
>>

Table P20.1 Venus GPS serial output
The first line provide latitude 4509.9767 N longitude 01000.471 E, 40.2 MSL altitude and geoid altitude correction 42.3 m.
Figure P20.3, Ready to operate antenna  on the car roof, magnetic link.
At the same time, and location, Android GPS logger provide an altitude of 82,3m.
Figure 20.4 Output of Android GPS logger, steady measurement

So GPS receiver provide 82,5 m=40,2m+42,3m of altitude and Android cellular phone 82,3m; hence data from the two different sources are in agreement.

Provided altitudes are referenced to WGS-84 geoid, to express this measurement as MSL is possible to use, for example, EGM96 model information . This model provide at current coordinates a geoid height of 39,613m, hence GPS receiver is reading 82,5-39,613=42.9 MSL and cell phone 82,3-39,613=42,7 MSL.

As per programming manual, Venus GPS receiver can be configurated using binary commands through a serial terminal, for a soft approach I advise to use GPSViewer for Windows. This free software reports real time GPS data and permit to setup some features, as communication port settings and GPS refresh rate ; our GPS receiver refresh rate can be setup up to 20Hz.

Android GPS logger can save a path in .kml format, the Google Earth default format.
Figure 20.5 Output of Android GPS logger, path record
Using as example a Venus GPS the basic procedures to manage a GPS stand alone receiver have been provided.

Also with the geoid altitude correction the altitude MSL is not the real altitude, GPS accuracy impact is high as per precedent article. To proof this the easiest way is to go to a location, or landmark, with a known altitude as your city airport or main square; probably your reading will be wrong of around ten meters.
Android GPS logger will be descrived in more detail into another dedicated post, the software is open hence also the source code will be provided.

## Monday, November 18, 2013

### Pitot cover done

There is not so much to say this time, the pitot cover looks good and is highly visible.
When the 3D pieces arrived I've just tied the "remove before flight" ribbon and that's all.

P24.1 Pitot cover on the pitot tube.
P24.1 Pitot cover on the mounted pitot tube
As usual after some test I will put online the free 3D model on the main site.

## Friday, November 15, 2013

### Pitot cover

In this post a couple of candidates 8 mm pitot covers are considerate.

A pitot cover is a simple device that have the finality of protect the pitot unit at rest or during the storage. Entrapped moisture and condensate can lead to wrong measurements and to premature sensor failure. A good cover must ensure that rain and dust cannot enter the pressure lines nor yet allow the insects to go live inside the unit. The pitot cover must also be highly visible because if it is not removed the airspeed indicator will not work once in flight. Visibility is assured by the so called “remove before flight” ribbon. This ribbon is becoming a quite common gadget for RC electronic devices. Effectiveness is warranted by a strict pre-flight checklist, indeed for RC planes it's sufficient to count the ribbons that have been collected before the flight, if they are the number expected then is safe to proceed.

Figure P22.1 Remove before flight ribbon on a Concorde plane

There are many pitot cover producers, pitot tip dimensions are quite standardized so it is easy to find a pitot cover for full size airplanes neither cost is a problem. Commonly used pitots have a separated static port located on the fuselage, so only the pitot total pressure port should be protected by the pitot cover, on the static port there is a pin. There are three main available cover typologies. The first is a hinged pitot protector that opens automatically during take off, the mechanism is composed by a target aerodynamic surface linked to a spring as per following figure.

The higher complexity of this device is justified by the fact that closing is not operator dependent.

Second type is composed by a rigid cap that fits on the tube and a before flight ribbon.

Third type is composed by a cloth that is slided over the tube

First type of cover have been excluded because in our pitot static ports are integrated on the tube and this kind of arrangement impact too much on the aerodynamic behavior.
The fabric type cover require sewing skills, instead 3D print construction is chosen.
Is easy to conceive a cap that cover static and total port, have a look to the following figure for the first virtual prototype.

Figure P22.5 Pitot cover with ribbon virtual prototype

After modifying some shapes I reach to the following solution

Figure P22.6 Pitot cover, ribbon will be attached on the left side

I chosen the second solution and now is en route to the 3D printers. As soon as I've tested the cover I will let you know how it works.

The next post will come with photos and 3D model of completed pitot cover, so you can print your own piece.

## Friday, November 8, 2013

### Barometric altimeter application

A precedent article introduced some math about atmospheric models, within this post I will show an Arduino based implementation.
Used absolute pressure sensor is a SCP1000, you can download the datasheet here , this sensor have a digital SPI interface and a range of 30 kPa-120 kPa
This sensor can be incorporated in a ground station, it have an embedded temperature sensor that, accuracy apart, can be useful to experiment with compensation procedures.

This BarometerPDEr2.ino sketch file for Arduino IDE contains all the software needed for altimeter operation.

Hardware is composed by an 3,3 V Arduino Pro running at 8 Mhz and an 3,3V SCP1000 breakout board.
Wiring is straightforward, refer to the next figures.

Figure P21.1 BreadBoard Fritzing file here
Figure P21.1b Wiring Scheme
Figure P21.2 Direct wiring, with serial ftdi interface at 3,3V

The barometer altimeter measures the geopotential altitude, our objective is to measure the geometric altitude. The two values are strictly correlated, denoted $$H$$ as Geometric altitude, $$h$$ as geopotential altitude and $$RE$$ as the local radius of earth hence, according to Warren F.PHILLIPS, 2009, Mechanics of Flight Second edition, Chap 1.2,
$$h= \frac{REH}{RE+H}$$
hence
$$H=\frac{hRE}{RE-h}$$
Of course for low altitudes the values are numerically very close, many people neglect this conversion.
Another aspect to consider is the calculation of altitude from barometric altitude formula,
the structure of the formula is
$$P=P_0 e^ {-Kh}$$
hence for exact equation solution it is necessary to calculate
$$ln(P/P_{0})=-Kh$$
It's not possible to calculate directly a natural logarithm with Arduino, hence a closed form solution based on power calculation is used. The “correctedaltitude” function in BarometerPDEr2.ino  shows two implementations, one to be used with imperial units and the other with SI.
Supplied sketch will continuously output three different altitude readings in a pleonastic verbose format through the comport. The first kind of reading is the altitude calculated using the standard day conditions of 15° and 101325 Pa at sea level. Second altitude is calculated using sea level pressure from an external source, as weather service, Metar or AWOS, likely in DIY application you can get this information from a ground station at the airfield; this altitude can be referred as compensated for local sea level pressure deviations; in the source code the sea level pressure is stored in “base_pascal” variable. The last altitude type  relies on the fact that the airfield elevation and air temperature are known, an initial calibration routine calculates the value of sea level pressure for best altitude fit; in the source code the current airfield altitude is stored in “FIELD_ALTITUDE” constant.

After the initialization phase the sketch will report the calculated temperature, the calculated pressure at sea level and the sea pressure level value copied, for example, from the weather service. Look the following table for an example output.

<<
Initialization sea level Temperature C 16,2
Initialization sea level pressure Pa 99802
Sea level pressure from weather service Pa 99700
>>
Table P20.1 Arduino sketch output during initialization
This two values are quite similar if you have a good weather report and goods pressure measurements. Pressure information is available through METAR,a network used also by full size planes, here you find a short explanation. For Italy you can consult this site.

During normal operation you will get the following output, in my case fieldaltitude=53 m.
Output recording after some minute of operation.
<<
Raw pressure Pa 99188
Filtered pressure Pa 99185
Temperature C 15
Barometric altitude according, ISA m 185.1039733886
Barometric altitude corrected for pressure at sea level, m 43.8402595520
Barometric altitude corrected, current altitude and temperature known m 53.0040588378
Raw pressure Pa 99181
Filtered pressure Pa 99182
Temperature C 15
Barometric altitude according, ISA m 185.3742523193
Barometric altitude corrected for pressure at sea level, m 44.0986099243
Barometric altitude corrected, current altitude and temperature known m 53.2686004638
Raw pressure Pa 99185
Filtered pressure Pa 99183
>>
Table P21.1 Continuous sampling loop output

For each iteration you get the last reading, the data output from the moving average filter and the three different altitudes.

By inspection of the above table you can appreciate how are different the reported altitudes. It makes no sense to log data without compensation. If you don't dispose of a local landmark you can check your calibration against a geodetic network referral point.

The Arduino based circuit can be conveniently boxed for a better usability, as per the following figure, do non forget to drill slots to allow correct ventilation.
Figure P21.3 Arduino altimeter ready to be connected to a ground station PC
In the case you want to minimize overall dimensions and weight then you can use an Arduino pro mini directly soldered to your sensor, look to the below figure for a size comparison.
Figure P21.4 Arduino pro mini vs SCP1000 breakboard dimensions
Atmospheric model assumptions are strong and it's not easy to check for deviations from the model itself, nevertheless it's possible to evaluate how the sensor uncertainty will impact on the calculated altitude. The SCP1000 is setup to run in the high speed mode, a 15 bit resolution is expected;this resolution corrresponds to 2.1Pa. Let's pretend our error probability function is rectangular symmetric(uniform)  then, using the resolution value as optimistic error bound, is possible to calculate the deviation  $$\sigma_{P}=\frac{3,6}{\sqrt{3}}=2,1 Pa$$.  For a detailed description have a look to this document page 13 example 1.
Using the uncertainty propagation formula
$$\sigma_{h}=\sqrt{(\frac{dh}{dP})^2\sigma_{P}^2}$$
$$\frac{dh}{dP}=-0,190255P^{-1,190255}101325^{0,190255}(T_{0}+273,15)/0,0065$$
With a pressure reading of 100000Pa and in standard day conditions then
$$\sigma_{h}=0,17m k=1$$
Widening the coverage $$\sigma_h=0,51m k=3$$.
A complete tools suite for altitude measurement has been introduced, some compensation methods have been tested. This introduction evidentiates how a good instrument initialization can impact on measure
Let me know if you have some problem with your own altimeter.