OpenTX - Application Note 28
airfield Boundary Warnings Using a GPS
Use a FrSky GPS sensor to create warnings when an aircraft is close to or breaching an airfield boundary. An announcement is also used to advise when the aircraft is clear of trees for landing.
The following components are required to create the announcements.
1. FrSky GPS module. Refer to Application Note 8 for more details.
2. A Lua script to create variables that describe the aircrafts position relative to the boundaries..
3. Some logical switches to create triggers at the boundaries..
4. Some special functions that play audio files when the triggers become active.
5. Some audio files that describe each boundary event.
6. Use switch SE to enable and disable the audio files.
7. Some more audio files that describe when the boundary announcements are enabled and disabled.
Lua Script to Detect Boundary Events
The lua program is called ‘varmsbdr.lua’. This is a model lua script, created using Microsoft Notepad and transferred to the Taranis SD card folder SCRIPTS/MIXES. To activate this program on the Taranis, first select the model that has the GPS module fitted, and display the Custom Scripts screen. Select LUA1, for this example, and press ENTER. The LUA1 screen is displayed. To select the required file, press ENTER to display a list of lua files. Select ‘varmsbdr’ and press ENTER. The LUA1 screen then displays the script name, the Inputs list on the left and the Outputs list on the right. There are no inputs to this program so the Inputs list is blank. The Ouptuts list shows the variable names that will be used to trigger the audio announcements. The lua program continuously reads the longitude and latitude data in the Taranis radio that is received from the GPS module in the aircraft and sets the value of these variables vbn1, vbn2, vbn3 and vbn4.
The variables can have the following values..
Download a copy of the lua file ‘varmsbdr.lua’ here.
For more information about Lua scripts on OpenTX, see
Logical Switches to Trigger Boundary Events
On the Taranis Logical Switches screen, the following logical switches are required. Note that the switches are only enabled by switch SE in the middle or down positions, not up.
Special Functions to Play Audio Files
The audio files required for each boundary event are as follows.
The audio files required to describe when boundary announcements are enabled and disabled are as follows.
To create audio files, refer to Application Note 4.
On the Taranis Special Functions screen, the following special functions are required to play the audio files.
Check That It Works
At the airfield, turn on the transmitter and the aircraft.
On the Taranis, display the ‘varmsbdr’ lua script screen. While waiting for the GPS to lock, vbn1, vbn2, vbn3 and vbn4 have values of -100.
When the GPS has locked, carry the aircraft and the transmitter to each of the boundaries and check the following.
vbn1 = 0 when south of line 1 and 100 when north of line 1.
vbn2 = 0 when south of line 2 and 100 when north of line 2.
vbn3 = 0 when south of line 3 and 100 when north of line 3.
vbn4 = 0 when west of line 4 and 100 when east of line 4.
With switch SE in the middle position, check that the correct message is announced when each boundary is crossed.
With switch SE in the up position, check that the messages are disabled when each boundary is crossed.
Now it is ready to fly!
There is a significant delay of several seconds between the time the aircraft crosses a boundary and when the Taranis announces it. I think most of this delay is in the GPS module calculating the longitudes and latitudes. For fast moving aircraft, this translates to big distances over the boundaries. This application, therefore, is best suited to slow moving aircraft, like gliders.
GPS Modification – Update 10 Times a Second
The FrSky GPS module software can be modified to update ten times per second. This makes this boundary alarm application work much much better. The boundary crossing messages happen almost immediately after crossing a boundary. This GPS software modification is well worth the effort. Details are here.
Thanks to Danny who found this site and updated my GPS for me.