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. Install OpenTX version with LUA scripts enabled.
3. A Lua script to create variables that describe the aircrafts position relative to the boundaries..
4. Some logical switches to create triggers at the boundaries..
5. Some special functions that play audio files when the triggers become active.
6. Some audio files that describe each boundary event.
7. Use switch SE to enable and disable the audio files.
8. Some more audio files that describe when the boundary announcements are enabled and disabled.
Install OpenTX Version with LUA Enabled
To use LUA scripts, a version of OpenTX with the lua option selected must be transferred to the Taranis radio.
Download OpenTX with LUA Enabled
To do this, first open Companion, select ‘Settings’ and tick the ‘lua’ box, as shown here and then close this window.
Install Downloaded Firmware in the Taranis
To transfer the new version of firmware to the Taranis, first turn on the Taranis in BootLoader mode. Connect the USB cable from the Taranis to the PC. In Companion, select ‘Read/Write’ then ‘Write Firmware To Radio’. Choose the saved file then click ‘Write to TX’.
The progress is shown with a bar graph. This only takes a couple of seconds. When finished, the Taranis is ready for the next step.
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.
(vbdry7 is out of order because this was a very useful afterthought.)
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!
The standard FrSky GPS sends position coordinates to the Taranis at a relatively slow rate. This means that there is a significant delay of several seconds between the time the aircraft crosses a boundary and when the Taranis announces it. For fast moving aircraft, this translates to big distances over the boundaries. The GPS module can be modified to update faster.
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.