the software is in beta stage - beware - beta testers wanted.
For the moment you need a LCD display to configure and use.
The buzzer alarm code is untested
Please help to finalize this, I do not yet have a working buzzer, so I cannot at the moment test the actual alarm. That should be relatively easy though.
Motivation:
the alarm based on battery voltage is cool, but on new generation of lipos (for me nanotech and probably others) the voltage drop is small and occurs late. The timer on the TX is kinda static and does not take into account flying style nor breaks.
So I wanted to measure true power consumption and get alarm when battery drained of say 80% capacity (only 20% nominal capacity left).
As a side effect I get separate measurements for each motor, so this may help in adjusting COG or detect bad motors.
idea:
instead of measuring and integrating over time the true current with a special hall sensor I do it in the software only.
Two assumptions:Updated: was assuming linear, then square; now code can deal with general curve.
a) the ESCs+motors provide a characteristic mapping from the input signal to the outputted power within the flying range (works for me, ymmv)
b) the time base (main loop time) is quite stable (seems safe with Alex' code)
For power measurement we sum up the signals sent to each motor over time starting at poweron.
Attach buzzer alarm threshold to the sum value.
Interface:
Updated
Note 1 - communication works with both GUI and LCD display configuration.
Note 2 - the alarm functionality is implemented and works.
Features:Updated
- independent from actual currents - works independently and equal for wide range of batteries and motor combinations; relies on number of motors and flight time.
- works for all possible copter configs (TRI, Quadx/plus,Y6, etc.)
- separate power meter for each motor (up to 6 motors)
- sum of all power meters
- accessible via LCD configuration interface and GUI
- user settable alarm threshold stored in eeprom
- alarm threshold read and write accessible via LCD configuration interface
- added feature to LCD config: Exit without Save - same as Enter config - yaw right and pitch up
- display battery voltage via LCD configuration interface and GUI
- get code or patch your code, apply your usual setup (TRI, yaw-direction, etc.), full binaries at google repository.
- activate power meter functionality / PMETER is defined by default for now
- load code into arduino
- choose battery with largest capacity (in mAh) you want to use
- go fly (or run on test bench) for apporx. half your usual expected flight time
- attach LCD or GUI (GUI only works if attaching does not reset the arduino as it does with my mac)
- use LCD config or GUI and read pMeter values for each motor and the pMeter Sum value
(for my TRI that gives after ~3 minutes in hover a sum of approx 2500 ) - if sum is > 30000 contact me, need to change internal divisor (currently set to 10000; sorry for inconvenience)
- continue flight as you normally would (per timer in TX or voltage alarm or ...)
- use LCD again, read counters per motor and sum
- set alarm threshold to this value: last entry in config menu, use sum value, divide by 100
- save and exit
- give some thought on the meaning of very different readings for front and tail motors - need to adjust COG?
- fly with new pack
- test alarm and inform me whether it works for you
I use it with a set of equal nanotech batteries of two different cpacities (1000mAh and 2200mAh).
My number of motors is constant - 3 for a TRI.
Flight times in hover are ~6 min and ~11 min
hover is at ~50% throttle
For the 1000mAh batteries the pMeter sum is ~4200 (needs 930mAh charge after filght) pAlarm threshold is set to 4200/100=42.
To prove the assumption of linear ESC rating: on another 1000mAh battery for a pMeter sum of 2240 the required charge is 510mAh - were the function absolutely linear, it would have required 520mAh charge - good enough for me.
Hope someone finds this useful,
Hamburger