How to Change PID and Betaflight Settings with Taranis LUA Script

by Oscar

You can change Betaflight settings from your Taranis TX using LUA script. Adjustable parameters including PID, rates, looptime, filters and VTX settings . In this tutorial I will show you how to set it up step by step.

Some of the links on this page are affiliate links. I receive a commission (at no extra cost to you) if you make a purchase after clicking on one of these affiliate links. This helps support the free content for the community on this website. Please read our Affiliate Link Policy for more information.


UPDATE (July 2021): There is now a new version of the script, and I made a new tutorial for it.


Table of Contents

Hardware Requirement

  • F3/F4 Flight Controller with Betaflight 3.2 or later installed
  • Frsky Taranis X9D-Plus or QX7 transmitter with OpenTX 2.2 or newer
  • X4R-SR, XSR or R-XSR receivers (Smart Port required)
  • A spare UART ports for SmartPort

First of all, set up SmartPort. Here is a tutorial on how to setup Smart Port in Betaflight. How do I know if SmartPort is working? Check if you get the value for VFAS (battery voltage on your quad).

For VTX control, SmartAudio port from TBS Unify Pro (or Telemetry port from Tramp) also needs to be connected to one of the spare UART TX. Here is a detailed tutorial on how to setup VTX Control. If you don’t need VTX control you can simply ignore it.

This following image is an example connection of the Betaflight F3 flight controller.


Betaflight Configurator Settings

Many settings in the LUA script only work properly in Betaflight 3.2 or newer firmware, so we recommend to update your FC to the latest version.

First of all, make sure SmartPort is setup properly:

  1. In Betaflight configurator, PORTS tab, find the UART where you have connected S.PORT to, then select SmartPort as the Telemetry Output
  2. Enable option TELEMETRY in Configuration tab

Extra Steps for VTX Control (Ignore if you don’t use VTX Control)

If you have TBS Unify Pro or ImmersionRC Tramp, go to PORTS tab, find the UART you connected the VTX to, and choose which VTX you have under Peripherals.

For example on my LUX V2 FC (screenshot below), I am using SmartPort in UART1, TBS SmartAudio in UART2, and SBUS in UART4.

Choice of VTX, and Blackbox logging under Peripherals.

Don’t forget to hit “Save and Reboot” when you finish.


Update Taranis OpenTX Firmware

Your Taranis TX has to be updated to the latest OpenTX firmware (we tested V2.2 RC14 successfully). The process is simple, and it’s covered here: https://oscarliang.com/flash-opentx-firmware-taranis/.

Access the SD card in Your Taranis

To gain access to the SD card inside the Taranis TX, you can use one of the following 2 methods:

  • Put Taranis in Bootloader mode, then plug in the USB cable
  • Or simply take the SD card out of the Taranis

I prefer the first way because I am lazy :) To put Taranis in Bootloader mode, simply push both of the Yaw and Roll trim buttons towards the centre, and power on the TX, the screen should now say it’s in bootloader mode.

Now if you connect the USB cable, an external drive should appear on your computer, that’s the SD card in the Taranis.

Download LUA Script for Betaflight

The latest LUA script for Betaflight can be downloaded here: https://github.com/betaflight/betaflight-tx-lua-scripts/releases

The zip file contains 2 folders: BF and SCRIPTS. Open the folder SCRIPTS.

Now you have two folders inside: BF and TELEMETRY:

  1. Copy bf.lua file in TELEMETRY folder to /SCRIPTS/TELEMETRY/ folder in your Taranis SD Card
  2. Copy the whole BF folder to /SCRIPTS/ folder in the SD card. These are the script interface files needed to make it work (there are scripts for different TX models, don’t worry just copy the whole folder, your Taranis will pick the correct script automatically)

Setting up LUA script on telemetry page

We are almost there!

Go to page 13, DISPLAY in your Taranis.

Here you can configure which telemetry screen to execute the LUA script we just copied over. In Screen 1, choose Script as the first parameter value, and then select the bf Lua script in the 2nd parameter value.

Now, you should be able to activate the BF LUA script by holding down the PAGE button.

Page 1 of the script is for PID settings.

2nd and 3rd pages are for rates, expo, TPA, Anti-Gravity gain, DTerm Set point etc…

4th page is for filters.

5th page is for PWM settings, ESC protocol and even Looptime!

6th page is for RX receiver settings.

And finally the last page is for VTX settings.

To save the changes, hold down the MENU button for 3 seconds, a dropdown list should appear, and you can select “Save Settings”.

That’s it!! I hope you find it useful. Have fun tuning PID and changing FC settings from your Taranis in the field! :)

FAQ

“Script Syntax Error”

Your OpenTX version is probably too old, try updating it to the latest OpenTX firmware.

Update History

  • 06 Apr 2017 – Tutorial created by guest writer Artur Banach.
  • 03 Dec 2017 – Updated instructions for Betaflight TX Lua Script V1.01

Leave a Comment

By using this form, you agree with the storage and handling of your data by this website. Note that all comments are held for moderation before appearing.

58 comments

David Drysdale 3rd April 2021 - 9:28 pm

Hello Oscar
This method doesn’t work any more !
Things seem to have changed a bit since Dec 2017 – I’m using a Taranis X9D plus with version 2.3.11

Reply
Oscar 3rd April 2021 - 11:53 pm

I have been using Betaflight OSD to change PID and rates since then :)
No need for Lua scripts anymore.

Reply
David D 28th January 2020 - 6:28 pm

Will this work on a Kakute F7 HDV flight controller?

Reply
Oscar 2nd February 2020 - 4:01 pm

Yes.

Reply
Viktor 19th October 2019 - 11:03 pm

I can see all values but i can’t change any of them, what could be the reason for this?

Reply
David 26th July 2019 - 4:48 pm

Hello Oscar
I have followed your guide, and successfully installed BF lua scripts.

At first, my PID / VTX settings showed up, but with No telemetry blinking below.
This was fixed by discovering new sensors on the taranis x-lite.

Now I get the PID values, VTX values and PWM but PID2/2, Rates, PID Adv and Filters shows no values.

I am using a F4 with built in SPI RX Frsky_X
(I find no information on how to update this rx, is it even possible?)

Does anyone know how to fix this?

Thank you so much in advance,
David

Reply
Oscar 28th July 2019 - 3:51 pm

You need to make sure your FC has latest firmware, as well as the LUA script is up to date.

Reply
Marc 2nd June 2019 - 6:36 pm

HI Oscar,

I decided to use Xfire nano Rx on my Beta75, I followed the LUA script instructions but only get the PID values, the rest of the pages for betaflight lua have no values. Is this just the Beta75x board or have i missed a step? Does bf.lua get dropped into both scripts and Telemetry folders?

Regards
Marc

Reply
Jason O. 1st October 2018 - 10:02 am

Hi Oscar,

I’m having a very perplexing issue when I try to set this up for my TBS Crossfire Micro module on the Taranis X9D plus, using a Nano receiver… Updated to OpenTx 2.2.2 and most recent update for the Micro Crossfire module as well.

Every time I transfer the files to my SD card following your instructions here, it corrupts my Crossfire and EEPROM folders on the SD card, which in turn keeps giving me syntax errors. I then have to have windows recover and fix any errors that have occurred on my SD card. It also caused on of my Quadcopters to unbind to the transmitter.

I would greatly appreciate any help you could offer, thank you!

Reply
Adrian Persson 9th July 2018 - 3:15 pm

Hello

I have a question, on my Taranis. I can change the Pids, but The info for the vtx doesnt show up. it just says “-”
Do you know what the problem can be?

Reply
Oscar 24th July 2018 - 6:04 pm

because didn’t setup VTX control properly?

Reply
Mike Renish 27th February 2018 - 3:08 am

Hi Oscar: Everything worked great. However, I’m getting a

Script syntax error
BF/ui.lua:335
not enough memory

Reply
dengor 6th April 2018 - 5:46 pm

Also getting the same error. Running latest Opentx.

Reply
Oscar 17th April 2018 - 6:38 pm

Flashwith 2.2.1 in TX and installed LUA script v1.0.1.
This should fix your problem.

Reply
Krotow 24th February 2018 - 4:23 pm

Betaflight scripts does support IRC/Tramp VTX control as well. Have Matek VTX-HV connected to Matek F405 AIO under Betaflight 3.2 (VTX TX to TX3, XSR with uninverted SmartPort wire to TX5) and same VTX to Holybro Kakute F4 V2 (VTX TX to TX6, SmartPort from RX S.port connector to SP pad) under Betaflight 3.3 RC2. Transmitter is Taranis QX7 with OpenTX 2.2.1 and BF script version 1.0.1. Both XSR RX flashed with 170619 firmware. Works like charm.

Reply
Chry sBurge 4th February 2018 - 1:23 am

I am currently on Open TX 2.2.0 and BF scripts V0.3.
BF scripts are running on (2) Naze F1 boards and (1) F3 RMRC Dodo board.
If I upgrade to the newest BF scripts, V1.0.1, do you think they will still work on these boards? More concered with the F1 boards.

Reply
Shpl00p 13th July 2018 - 11:52 pm

Did you ever find out more on the F1 support? Currently have a build with an F1 built into the frame.

Reply
Aaron Lavigne 22nd December 2017 - 4:52 am

Hello Oscar, maybe you can help me. I put LUA script on my taranis x9d and I’m receiving telemetry. Unfortunately, when I access the LUA script I don’t get any values on any of the pages. I don’t know if this is because I might have deleted or misplaced a file.

Reply
Oscar 3rd January 2018 - 1:22 pm

First, make sure your RX has the latest firmware.
And make sure your LUA script are properly installed on the TX.

Reply
Sean sepulveda 7th May 2018 - 10:02 pm

yea, I had the same issue.
What worked for me was, updating all my TX’s on all my quads and it finally worked just like Oscar wrote in this blog.
It worked for my Betaflight quads and also my Kiss quads. Thank you so much (Oscar) for taking the time out of your day to help people like me.
I’m not very computer smart and some of this stuff is super confusing. :)

Reply
Khrash Pad FPV 1st December 2017 - 10:34 pm

Can you update these instructions for the new (1.0) Lua scripts?
They are no longer accurate, there is just one zip now with different subs for the radios. Can you explain which directory to copy where?

Reply
Oscar 4th December 2017 - 4:27 pm

updated :)

Reply
Andrew 5th December 2017 - 4:49 am

Okay not using SmartAudio or tramp, but have iflight force vt5804 vtx with sbus input for use to control vtx from radios switches thru Channel 6 of rx. Only thing is iflights maanual is use might as well be in Chinese no explanation of the setup in the radio of choice, they don’t have instructions online, and good offended on the Facebook page when I asked for what the one page manual was lacking, full instructions and setup not just explanation on the functions that are available on the vtx if your clarvoyent and can channel a Chinese tech for info

Reply
HanSolo_fpv 12th November 2017 - 3:33 pm

Is there a way to make this work with a Unify Race and XM plus receiver?

Reply
Oscar 12th November 2017 - 4:42 pm

You can use Betaflight OSD to change PID and VTx settings, but you won’t be able to use LUA script, because XM plus doesn’t do Smart Port.
You will need the R-XSR to do that.

Reply
spencer (canyons fpv) 4th December 2017 - 8:58 pm

would all this work with a crosfire micro rx? i have smart audio, do i need smartport tele to use the luas?

Reply
Oscar 12th December 2017 - 1:39 pm

Yes it should work with Crossfire.
You will need SmartPort to use LUA script.

Reply
Romain 1st November 2017 - 10:09 pm

Thanks for this tutorial Oscar, so to my understanding, I cannot do this and use the Tramp SmartAudio on an SP Racing F3 as the UART1 is for USB, UART 2 for SBUS and UART 3 for XSR telemetry… right ?

Best Regards

Reply
Gice 26th October 2017 - 5:14 pm

I also am still not seeing anything on these screens with an R-XSR. I flashed it with the latest firmware, still no dice. I have a Matek VTX-HV (which supposedly runs Tramp) and a Kakute F4 AIO.

Reply
Martin 18th October 2017 - 4:27 pm

Hi, I get — on all values in Taranis. Telemetry showing many sensors VFAS etc. XSR receiver, F3 flightcontroller, Taranis X9D+

Reply
ZeLaus 25th September 2017 - 10:20 pm

Hoi,
I’m using an R-XSR Receiver and get no PID, RATES and VTX on LUA. Telemetry is working as I’ve got 10 sensors showing up.
Runnig X9D+ with OpenTX 2.2.0, LUA X9 from BetaFlight github.
FC is an Omnibus F4 with SoftSerial set to Telemetry/Smartport.
There’s only one FW for that receiver.

Any help appreciated.

greetz,
ZeLaus

Reply
Nagy 26th September 2017 - 9:22 pm

Here the same. Better you ask FrSky.

Reply
ZeLaus 1st October 2017 - 7:31 pm

Everything working with newest firmware on normal XSR. OmnibusF3 AND F4 (with SoftSerial)
Not even to wire anything different…

I believe, it’s a firmware thing with the R-XSR.

Reply
Oscar 5th October 2017 - 1:37 pm

Unfortunately I don’t have a R-XSR to test this yet. But I guess it could be the RX that is causing this problem. Hopefully a future firmware release might fix this.

Reply
Bk9 21st October 2017 - 6:01 pm

I have a similar situation,
Two different omnibus f3 boards :
One with inav 1.7 and working well with the lua.
Another with bet a flight 3.2 and doesn’t work. Though I’m pretty sure it did work a few weeks ago.

A dys f4 build running BF 3.2 works fine.
Couldn’t find why the one omnibus isn’t working..

All running xsr’s

Reply
Ruben 13th August 2017 - 7:40 am

Hi Oscar,

Just to let it known: the Betaflight Lua script also worked in following situation:

– Naze32 (rev5) FC flashed with CLEANFLIGHT 2.1.0.
– X4R-SB receiver (with SBus and Smart Port) –> thx to your other post (https://oscarliang.com/sbus-smartport-telemetry-naze32/#f1)*
– Taranis XD9+ with 2.2.0 (RC18)

* I have noticed that for Cleanflight 2.1.0. the setting “tlm_inversion” is not present any more. Instead you will find “tlm_inverted”. I had to set tlm_inverted = OFF to get telemetry working.

Reply
Manish 27th July 2017 - 11:22 am

I was able to resolve the issue of no PID or VTX values on the FrSky Taranis Q X7 screen. If you are using the TBS Unify Pro HV VTX along with the FrSky XSR receiver and Betaflight F3 board, here is what you need to do.

Flash the “Beta” firmware for the XSR receiver onto the XSR.

frsky-rc.com/download/view.php?sort=&down=313&file=Beta%20Firmware-XSR

Then download the latest firmware version of Betaflight (3.1.7) onto your Betaflight F3 board. Ensure you have the LUA script running on your X7 after you flash the new firmware and it should work.

Reply
Manish 24th July 2017 - 2:20 pm

I’m getting PID value’s on screen but no VTX values. I am using TBS Unify Pro HV VTX, Betaflight F3 board and Taranis XSR receiver. Could this be a problem with the firmware in the receiver?

Reply
Robbo 5th March 2018 - 10:16 am

I have same problem, the PIDs and Rate control works in the Taranis LUA, and the VTX work through the OSD, but not the VTX in the LUA script??? F4 OMNIBUS board, XSR (170619 FW) and Tramp HV.

Did you get this working Manish? Any other suggestions?

Reply
J. V brecht 26th June 2017 - 9:06 pm

Same problem as number if people above.
Just — in the screen. Latest version Betaflight and latest version taranis x9d+ firmware. When i power up the flightcontroller i get values 1time. It wont refresh or load the other scripts. Any suggestions?

Reply
Oscar 29th June 2017 - 6:00 pm

have you recently flashed your RX? try a older version of the firmware perhaps..

Reply
Jodi 24th June 2017 - 10:56 pm

Did somebody try it with final opentx 2.2? I have a final 2.2 in my taranis and I’m not able to read / set values. Telemetry works, but script does not show any value. Just “–” and also I’m not able to switch next page (rates or vtx).

Reply
Oscar 25th June 2017 - 8:12 pm

This is only possible with OpenTX 2.2 or newer, so it should work.
According to your info, it sounds like your FC side isn’t working. Do you have the latest Betafilght installed? Or maybe the script hasn’t been installed properly, please repeat the process again and follow instruction carefully.

Reply
Jodi 25th June 2017 - 9:08 pm

I have latest BF 3.1.7 on both copters. I think wiring is OK, because telemetry works fine. Using XSR with s.port connected to TX on UART.2. I already tried v2 and v3 of that script, but with same result. It worked for me, I think, month ago, but not now. I think it was on some 2.2 RC version.

Reply
Jodi 27th June 2017 - 8:41 am

Oh I remembered, I also updated XSR FW to newest version 170605. There could be also problem.

Reply
Jodi 27th June 2017 - 7:51 pm

Got it. Frsky XSR fw 170605 is problem. When I tried fw 151118 it worked fine.

Reply
Oscar 29th June 2017 - 6:00 pm

that’s great, thanks for letting me know!

Reply
Brad 10th June 2017 - 2:38 pm

I recently installed a xsr on my Martian. And I can’t for the life of me get this script to work with my taranis qx7. Fury f3 flight controller, smart port on uart tx enabled on betaflight. Sbus on sbus pins. When I discover new sensors I only see three show up. Any thoughts, ideas? Thank you in advance.

Reply
S-L-R 14th July 2017 - 3:54 pm

You may have to set “sport_halfduplex=OFF” in the CLI for the telemetry to work.

Reply
maciek 8th June 2017 - 4:44 am

hi,

i used OTX 2.2 GA release (the latest)

i get Script Syntax Error message when going the to Screen1

Reply
Curtis Farr 3rd June 2017 - 8:45 am

Is there any way to default pit mode to off.? I am getting tired of having to reset pit mode to off every time I unplug the battery

Reply
Supe 27th April 2017 - 3:28 pm

i get the pids page up but cant get any values…i am running a a hyperlite f4…i get all my other telem data but not values for the pids….any ideas running a taranis 9

Reply
Oscar 1st May 2017 - 4:24 pm

latest Betaflight?
latest OpenTX firmware?

Reply
Marcin 15th June 2017 - 11:00 am

I have exactly the same situation.
My setup:
– FC F3,
– receiver XSR-M with NON-EU FW, but in D16 mode,
– Taranis 9D with FW 2.2-RC14 with LUA,
I see RSSI, A2, RxBT sensors but not telem from FW, UART set, telemetry enabled, I can see some data when connecting logic analyze to uart connected with smart port.

BTW instruciont is not complete, there is no information that I need to discover any sensors, but in LUA code there is check that when there is no RSSI discovered then screen will show mesage “No telemetry”.

Reply
Theo 17th June 2017 - 12:59 pm

Just received a new XSR-M receiver. Replaced an old X4r-sb on a quad with Betaflight F3 FC and Tramp HV, where everything worked, telemetry, lua script, including PID and VTX settings. Latest betaflight and opentx.
With the new XSR-M telemetry did not work at all initially until I flashed the latest firmware (dated 06-09). However, the lua script does not work any more. Only dashes are displayed, for both PID and VTX settings. I am starting to think that it is related to that particular receiver?

Reply
Brad 12th April 2017 - 4:48 am

I still can’t get this to work in Betaflight using a revolt V2. Can’t seem to find the 3rd UART (UART 6 in BF). Any idea?

Reply
Stefan 7th April 2017 - 1:40 pm

Do I still have telemetry for battery warning etc. when using this setting?

Reply
Artur 7th April 2017 - 8:50 pm

Yes, all works as normal. You can set another screen to show the telemetry values. If you set up alarms it will remain exactly the same.

Reply