OpenTX Lua Telemetry Script
Contents
Description
- Reads an OpenTX global variable to determine battery capacity in mAh
- Reads a battery consumption sensor and/or a voltage sensor to estimate mAh and % battery capacity remaining
- Displays remaining battery mAh and percent based on mAh used
- Displays battery voltage and remaining percent based on volts
- Displays details such as minumum voltage, maximum current, mAh used, # of cells
- Minimum voltage is useful in determining comparative battery internal resistance. At full throttle a battery with lower internal resistance will have a lower voltage drop and hence the minimum voltage will be higher when compared with a battery with higher internal resistance. Vmin = Vout – Vdrop, Vdrop = Internal Resistance x Current
- Maximum current is useful in determining if your ESC and propeller are sized correctly. Larger propellers and higher blade pitch take more power to turn and hence more current.
- Switch between simple and detailed display using a switch
- Switch is optional and configurable, Switch F down by default
- Writes remaining battery mAh to a Tx global variable
- Writes remaining battery percent to a Tx global variable
- Writes are optional, off by default
- Writing to a Tx global variable is useful when you want to use your own logic switches and special functions related to remaining battery energy.
- Announces percentage remaining every 10% change
- Announcements are optional, on by default
- Reserve percentage set for safety, 20% by default
- The reserve is configurable
- All values are calculated with reference to this reserve.
% Remaining = Calculated % Remaining – Reserve %
mAh Remaining = Calculated mAh Remaining – (Size mAh x Reserve %) - Here is an example of what is dislayed at start up
When the reserve is set at 20%
800mAh remaining is displayed for a 1000mAh battery
80% remaining
Notes & Suggestions
- The OpenTX global variables (GV) have a 1024 limit.
- mAh values are stored in them as mAh/100
2800 mAh will be 28
800 mAh will be 8
- The GVs are global to that model, not between models.
- Standardize accross your models which GV will be used for battery
capacity. For each model you can set different battery capacities.- E.g. If you use GV7 for battery capacity/size then
Cargo Plane GV7 = 27
Quad 250 has GV7 = 13
- E.g. If you use GV7 for battery capacity/size then
- Use Special Functions and Switches to choose between different battery capacities for the same model.
- To play your own announcements replace the sound files provided or turn off sounds
Use Logical Switches (L) and Special Functions (SF) to play your own sound tracks
Sensors
- FrSKY Current Sensor FAS40S
- OpenTX Calculated Consumption Sensor
- Sensor setup instructions
Download
File Locations
- Place the script file on Tx SD Card
- /SCRIPTS/TELEMETRY/
- Place the accompanying sound files in
- /SCRIPTS/TELEMETRY/mahRe2/
Configuration
- If you have no experience using Telemetry scripts please read Getting Started.
- Open the .lua file in a plain text editor to review and change the default settings.
Credits
- Dean Church
Comments, Questions & Help
- FliteTest Forum Taranis Q X7 OpenTX Battery Capacity Remaining Lua Script