Thread Tools
This thread is privately moderated by sandet01, who may elect to delete unwanted replies.
Jan 31, 2020, 06:31 PM
Registered User
Thread OP
Discussion

Taranis Flight Log/Battery gauge for gas-glow


A flight logger and battery use meter for the Taranis X9D family. Tested and used in versions from 2.2.4 to 2.3.11.
-shamelessly modeled on the work by Vulturetec.

Why? There are much easier options for electric powered models - voltage sensors, amperage sensors, etc. But a traditional fuel engine with a flight-controls-only battery is more problematic. Amp usage is too small for a sensor to reliably measure. Volts only really tell you "It's time to quit". In these models, one can get many flights off of one charge. The question is: "How many?", or more importantly "Can I get one more flight in for the day?" Old school is to track the time for each flight, and then measure how many maH's were put back in. Then use that info to guesstimate how many average flights a pack may allow before going dead. This script does all that for you!

Automatically detects takeoff events as flights, and total time receiver was "on" for a day. On a new day, asks for the mAH restored to the flight pack. Uses that data to estimate remaining battery capacity for the current day. Shows total flights and time from the prior day, as well as grand totals since first use.


Name: Capture.JPG
Views: 34
Size: 269.8 KB
Description:


Requires a long press of the Page button to get the main screen to display after turning on the transmitter.

Pretty self explanatory as to what is what. The battery gauge takes the current time, and uses the long-term average of mAH/Min to estimate how much juice is left (not counting a reserve capacity you can adjust).

The very first time the script is run for a new model, it will prompt for the full capacity of your battery pack, and stores that for all future use. It defaults to assuming that 20% of the capacity should be hidden, to act as an emergency reserve.

Flight timer is started using the "telemetry" setting, so is the total amount of "power on" time for the RX for the day.

At the first startup on a new day, it will prompt you for entry of the mAH put back into the battery after the last days session. It initially shows how much you added previously, just to reduce the amount of button pushes to get to the current amount. You can use the elevator stick to fast scroll the amount up or down.
If you recharge during the day, LONG PRESS MENU. This undocumented button press will bring up the mAH screen, update the totals, and reset the flight/times for the day.
If it is a new day, you are initially prompted as to whether you want to reset things, or not. Handy if you are just checking results, and not yet ready to enter the Mah's consumed.

If you want to reset everything and start over completely, just find and delete the txt file with the name of the model, in whatever directory you defined (if not the default TELEMETRY folder on the radios SD card).

The script can be invoked for multiple models, each one of which will have its own data file created.

NOTE: If testing using the Companion simulator, it does not actually store the new day/flight counts in the model settings! So unless GVar 8 is set to today's day-date in the model, the Simulator will always assume you are starting the first session of a new day. Go into the GVars in the Simulation Radio screen if you want to verify that they are updating. A new model data file will be added to wherever you are storing your stuff on your computer, if you haven't separately copied one over from your radio. Be careful if using some kind of automatic synch software between your computer and the radio to keep the radio SD card updated - the computer file might overwrite the one on the radio, or vice versa!


Setting it all up:

The script is agnostic as to what model it is used on, as long as the model settings below are properly configured. Data files are saved according to the name of the model.


Set up the model:
Attached is a simple model file for loading into Companion, showing the settings needed to get this to work:
1. Timer 2 set to use Telemetry as a switch. Count up mode. Persistent.

2. Under Flight Mode 0, Gvar's 8 and 9 will store the day and flight counter, respectively. Naming them is optional and the only thing you might want to do here.

3. Logical Switch L01 (after working with L02) drives the throttle arming on or off (ignition channel on a gasser - or via the mixer preventing the carb from being opened for glow. Basic setup for glow show, adjust as needed for gas ignition).

4. L04 through L08 are the takeoff detection logic. In this logic, L04 detects an elevator movement of 5% up. Depends on the direction of servo travel, and how much minimum elevator you need to hold to take off, so you may need to adjust. Trips flight counter if Arming on, throttle high, and elevator is 5% up. Will not trip again until after arming has been turned off.

5. L08 is the actual switch to key other actions off of. Note the small amount of duration needed (0.2). Setting to less may result in the switch not tripping the special functions consistently. A greater value is fine, but not really needed.

6. The lua script doesn't care about any of the LS's, so you can put them anywhere on the LS list. But you will have to edit them to reflect their new positions in the batting order.

7. One line needed in Special Functions, using L08, Adjust GV9:, Increment 1. This increments the flight counter stored in GVar 9 upon takeoff.
7a. Optional for you to add voice call outs, etc. in Special Functions. Not shown, but I also use L08 to reset the countdown Timer 1 back to default, to edit out any messing around time in the pits prior to takeoff. Also I use it to announce "Takeoff!".
8. Download the fltlog.txt file, and rename from "txt" to "lua". Put in the Scripts/Telemetry directory of your SD card.

9. Telemetry setup on TX - define a Custom Screen Type "Script", with the name of the script. Will only appear as a choose-able item IF the script is already in the Telemetry directory of the SD card.
For the first session, while it does ask for total battery capacity, the estimates for remaining battery capacity will not work, as there is not yet any history of mAH usage to use in the calculations.

If you want to start over, just delete the [MY MODEL NAME}.txt file.

Customizations:
1. If you wish to store the model data files somewhere else on the SD card, edit the first line of the lua script using any text editor. Default is "SCRIPTS/TELEMETRY".
2. If you desire a later change in total battery capacity, or the amount held in reserve, open the file for that model ( "[MYPLANE].TXT" ) and edit either of the last two entries.
--Example: The file will look something like: 21,312,4,1012,580,10028,2200,20
The second to last number (2200) is the battery capacity in Mah. The last is the % to use as a safety margin (20). Change as desired.
Future things for me to work on:
1. Evaluate storing all the data on the card, and stop using GVars.
2. Evaluate using scripts to replace the bulk of the Logical Switches, and the Special Function.
3. Test for future ability of OpenTX to allow automatic startup of the script on power up.
Last edited by sandet01; Mar 04, 2021 at 12:23 PM. Reason: updates
Sign up now
to remove ads between posts


Quick Reply
Message:
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Mini-HowTo F3K trainer, setup menu, flightlog log and EPEE for Taranis: Released l shems Hand Launch 19 May 21, 2016 08:17 AM
Question Wire gauge for Rx battery pack ululi1970 Batteries and Chargers 14 May 01, 2016 09:23 AM
Discussion Aerostar Gas/Electric Props from HK - for Glow Engines? PGregory Engines 20 Apr 25, 2016 11:01 AM
Question Electric (battery) Gas Gauge unknownflier Batteries and Chargers 2 Jun 20, 2015 08:07 PM
Discussion NEW: PowerPanel LCD Display - a real-time "Gas Gauge" for your pack billpa Product Announcements 0 Sep 15, 2006 11:29 AM