Shop our Airplanes Products Drone Products Sales
Thread Tools
This thread is privately moderated by Miami Mike, who may elect to delete unwanted replies.
Nov 23, 2017, 08:18 PM
Healthy suntan is an oxymoron.
Miami Mike's Avatar
Thread OP

Taranis: LiPo Fuel Gauge!

A "fuel gauge" for your telemetry screen to display your LiPo pack's charge state as a percentage of full charge.

For OpenTX Versions 2.1 and 2.2

Update, 11/27/2017: Permission was requested by and granted to Martin Phillips ("thebriars") to include this in the Version 2.2 update of his OpenTX Documentation.


Here's a "fuel gauge" setup for your Taranis to display your flight battery's state of charge as a percentage, beginning at 100% for a fully-charged pack and decreasing as you consume battery power. It requires a current sensor, such as a FrSky SP-40A - Smart Port 40 Amp Sensor or FrSky SP-150A - Smart Port 150 Amp Sensor.

You'll be able to add alarms and voice announcements that trigger at specific charge states, or at regular time intervals, or each time the charge state decreases by a certain amount so that you'll get announcements at, for example, 100%, 90%, 80%, etc. You'll also be able to bring up announcements whenever you like by flipping a switch.

The battery state will be retained between flights even if the radio is turned off, so a switch is provided to reset the charge state to 100% when the battery is replaced or recharged.

This setup is known to be compatible with OpenTX Versions 2.1 and 2.2.

If you have questions, suggestions, requests, or problems, please post in the comment section below.

Begin by configuring the sensor on the Telemetry page.

The Curr line should be created automatically with the Discover new sensors function. You can then add the mAH line anywhere on the page. Be sure to checkmark Persistent.

Next, create a new input on the Inputs page.

Inputs are confined to a range of -100% to +100%, but since only positive numbers are used here the allowed input range is 0% to +100%. No matter what your battery capacity is you can scale it down to the 0% to +100% range with the Scale setting, which will appear when you select mAH as the source. The incoming value will be divided by Scale before further processing.

For a start you can set it to the mAH capacity of your battery as in the example above, which would be appropriate for a 2200 mAH pack. Later you might choose to enter a lower number based upon preserving battery life or avoiding low-voltage cutoff. You can change the Scale value whenever you like.

Add the input to your telemetry screen.

The value of the input (here named "[I10]Lipo"), can be displayed directly on one of your telemetry screens along with Curr, VFAS, mAH, and other telemetry values.

Here you see "75" in the lower-right corner, indicating that the pack has 75% of its charge remaining.

Add a reset switch.

You'll need to add a special function to reset the charge state to 100% after changing packs. Here I'm using a special combination of conditions detected by logical switch L2, but you could use a simple switch position such as SH↓ if you have an unused switch available.

Coming up next in a follow-up post below, how to add alarms and voice announcements!

Last edited by Miami Mike; Jan 22, 2019 at 01:22 PM.
Sign up now
to remove ads between posts
Nov 23, 2017, 10:04 PM
Healthy suntan is an oxymoron.
Miami Mike's Avatar
Thread OP

Adding Alarms and Voice Announcements

To add voice announcements my first step was to find the WAV file that says "percent" in the SOUNDS/en/SYSTEM folder of my SD card. Mine has two of them, named "0129.wav" and "0130.wav", so I copied one of them to my SOUNDS/en folder where I could play it with a special function, and I renamed it to "percent.wav".

You can generally shuffle lines around on your Special Functions page with no effect, but I've found one exception in that if two functions have the same trigger, they'll be executed in top-down order. Therefore the function that plays the value should be followed, not preceded, by the function that says "percent" so that when you call them both you'll get "50 percent" instead of "percent 50":

I'm calling the announcements with Logical Switch L22. Here's a version that plays the percentage value every time it drops by 10%, so that you'll get announcements at 100%, 90%, 80%, etc.

You can add a switch, such as SA↑, to turn that on or off:

Of course you can use a Play Sound function if you want to add an alarm sound.

If you just want it to play the value when you pull SH, you won't need any logical switches:

Please post here if you come up with any other ideas.
Latest blog entry: OpenTX: Circling the Square
Nov 23, 2017, 11:00 PM
ancora imparo
jj604's Avatar
Mike, here's a track that might be useful.

Need to unzip it as RCGroups won't allow wav files

It says "Flight pack percentage is"

Last edited by jj604; Nov 24, 2017 at 05:31 AM.
Nov 24, 2017, 04:16 AM
Fly low and slow
TrueBuld's Avatar
This does look a nice piece of work.
I especially like the ability to set the size of the battery!
Nov 24, 2017, 09:08 AM
Healthy suntan is an oxymoron.
Miami Mike's Avatar
Thread OP
Thanks! One thing I'm happy about is that this is a contribution that can apply to a wide range of r/c model types, as opposed to most of my other work which is specifically for sailplanes.

Speaking of sailplanes, my sailplane setup is a bit complicated and uses every switch a Taranis has, with some even doing double or triple duty. It was therefore a challenge for me to come up with a way to reset the battery charge state to 100%, but I had two factors working in my favor:
  • It's not something one would do while flying so it can be a relatively complex procedure.
  • The model doesn't have to be turned on when you do it.
Back when I got into OpenTX I started out with Mike Shellim's sailplane setup, which was extremely educational for me, but my own setup has since evolved to the point of being totally original except for one feature: the Calibrate mode. It's entered by holding the aileron-elevator stick in the lower-left corner while pulling SH↓.

In my sailplane setup, logical switch L2 is true when Calibrate mode is enabled.

I realized that since it was already programmed into my setup, I could borrow L2 to also trigger a battery charge reset. And if the model's battery is unplugged when I do it then the model doesn't even go into Calibrate mode. All I need to do is swap batteries, enter and exit Calibrate mode, plug in the fresh battery, and I'm ready for the next flight.
Latest blog entry: OpenTX: Circling the Square
Nov 24, 2017, 05:57 PM
robkit's Avatar
Dear Mike.. This is soo nice !! I am very impressed and if there was a way for me to
send you a cake here... I would,, I hope people realize the benefit of this feature you have created..

(I used to visit Miami boat show every january,
If I do it again I will invite you for a real cake)


Nov 25, 2017, 05:47 PM
If it has wings it will fly...
ckleanth's Avatar
really cool mate
Dec 10, 2017, 06:20 PM
Registered User
Kaolith's Avatar
Why do you have the calculated mAh set as persistent? Wouldn't that keep it from resetting when the pack is unplugged?
Dec 10, 2017, 06:47 PM
Healthy suntan is an oxymoron.
Miami Mike's Avatar
Thread OP
mAH is set to Persistent so that if you do a short flight, land, and turn your radio off, then when you turn your radio back on the telemetry reading will still be there to indicate how much charge is left in your battery. Then you can decide whether you should swap batteries or continue flying with the same battery.

When you do swap batteries, you can reset the reading to 100% using the Reset special function, as shown above.
Latest blog entry: OpenTX: Circling the Square
Dec 11, 2017, 06:25 PM
Registered User
Kaolith's Avatar
That's a great move, I can't believe I didn't think of that... I'm still getting used to all the telemetry possibilities... I'm gonna get this up and test it out on a foamie I have.
Dec 15, 2017, 09:18 AM
Healthy suntan is an oxymoron.
Miami Mike's Avatar
Thread OP

Here's an additional note about the SP-40A

I found out the hard way that my FrSky SP-40A Smart Port 40 Amp Sensor draws about 15 ma of current when a 3S LiPo battery is plugged into it, even when nothing is connected to the output side and the normally flashing red LED is dark. A couple of days ago I left a 3S pack in one of my models, connected to the SP-40A input side but with the ESC disconnected from the SP-40A output side, and I just discovered that it had been drained to 1.9 volts and is presumably destroyed.

The bottom line: You can turn your model off by disconnecting the ESC from the SP-40A output, but don't leave it that way or the SP-40A will slowly discharge your battery.

Also posted on the FrSky forum
Latest blog entry: OpenTX: Circling the Square
Dec 18, 2017, 02:25 PM
Registered User
Thank you for this post I was looking exactly for such a script.

Just to be clear, in the special functions tab I select "L01" for example, not "!L01", right?
Dec 18, 2017, 02:48 PM
Healthy suntan is an oxymoron.
Miami Mike's Avatar
Thread OP
If you want an announcement to play when the logical switch becomes true, you'd use "L1." If you want it to play when the switch becomes false, use "!L1."
Latest blog entry: OpenTX: Circling the Square
Apr 01, 2018, 10:28 AM
Healthy suntan is an oxymoron.
Miami Mike's Avatar
Thread OP
Here's an enhancement for people who switch between two (or more) battery packs of unequal capacities. Basically you set up multiple, switch-selected input lines much the same way that you set up multiple stick rates.
Latest blog entry: OpenTX: Circling the Square
Jun 09, 2018, 03:36 PM
Fly Hard or Fly Home!!!
VF-Alpha's Avatar
The scale doesn't go past 3,000. I'm using a 8,000 mah pack, following the 80% rule that's 6,400 mah. how would I set up for that ?

Quick Reply
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion How much oil should I add to Cool Power airplane fuel to run in a helicopter? jimm1962 Fuel Heli Talk 5 Sep 12, 2017 03:26 AM
Data How much oil to add to a gallon of fuel to get a specific percentage Balsaworkbench Engines 5 Oct 30, 2016 08:31 PM
Discussion Lipo "fuel gauge", worth it? DontTMACajun Electric Plane Talk 16 Sep 23, 2012 01:57 PM
New Product Dualsky Lipo Mate Battery Checker/Balancer/Fuel Gauge 2dogrc Batteries and Chargers 0 Sep 27, 2010 09:12 PM
Fuel light, another way to add the "glow" in glow fuel lectraplayer Car Talk 1 Dec 18, 2004 03:19 PM