Hi,
we already have a powerful CPU onboard, so I do not see any need to use a separate full fledged datalogger for this simple task. I find that monitoring only the voltage is not a good indicator of remaining energy in the battery as the decay of voltage over usage varies over time and batteries.
Would it be possible to use a hall current sensor to monitor the current consumed at each moment and integrate it over time? That should give the total capacity drained from the battery in mAh, right? Integration would be a simple sum, if interval of analog_read could be kept more or less stable (wihich should be the case with the MultiWii loop already).
Then
- have battery capacity specific maxvalue in eeprom,
- initialize sum to 0 in setup(),
- increment sum by value read from hall sensor in main loop,
- give alarm if sum > maxvalue
Has this been done? Any Hints?
Hamburger
monitor total battery drain with current sensor? - closed
monitor total battery drain with current sensor? - closed
Last edited by Hamburger on Tue Aug 14, 2012 12:05 am, edited 1 time in total.
Re: monitor total battery drain with current sensor?
This is a good proposal and I would like to help implementing a solution.
As a reference, here is what ArduPilot is using: https://code.google.com/p/ardupilot-meg ... tage?wl=en
It is based on this sensor PCB from Sparkfun: https://www.sparkfun.com/products/9028
I am using a Arduino Pro Mini (AtMEGA 328P) on the MWC board from Warthox.
Are there any free inputs on this board combination that could assimilate the sensor?
Jonek
As a reference, here is what ArduPilot is using: https://code.google.com/p/ardupilot-meg ... tage?wl=en
It is based on this sensor PCB from Sparkfun: https://www.sparkfun.com/products/9028
I am using a Arduino Pro Mini (AtMEGA 328P) on the MWC board from Warthox.
Are there any free inputs on this board combination that could assimilate the sensor?
Jonek
Re: monitor total battery drain with current sensor? - close
Jonek,
you are kinda late on this. I did the implementation about 3 versions ago, can't remember.
The feature is called powermeter.
Enjoy, Hamburger
you are kinda late on this. I did the implementation about 3 versions ago, can't remember.
The feature is called powermeter.
Enjoy, Hamburger
Re: monitor total battery drain with current sensor? - close
Hi Hamburger, cool that you already did it. Is there any documentation of your implementation available? What hardware are you using? Do you monitor voltage _and_ current or only one of them? Jonek
Re: monitor total battery drain with current sensor? - close
setup procedure is described in config.h
Works with every current sensor that maps current to voltage (0 - 5 Volts max.); I use amploc sensors.
MWii allows monitoring both voltage and current at the same time, it just works.
Works with every current sensor that maps current to voltage (0 - 5 Volts max.); I use amploc sensors.
MWii allows monitoring both voltage and current at the same time, it just works.
current reading for powermeter code ?
@hamburger
I have been using your powermeter software together with FrSky telemetry to show 'Fuel' on my transmitter (your variable 'intPowerMeterSum')
http://www.multiwii.com/forum/viewtopic.php?f=7&t=1929&start=30&hilit=powermeter
I've rescaled it so intPowerMeterSum shows from 0 - 2000 mAh (by adjusting PLEVELDIV), and it shows up on the 9X display as 100 ... 0 % Fuel (2000 mAh I consider 'empty'). I can also make it show mAh on the display, but that's more confusing to read while flying
The 9X can also show amp draw.... just need to get a number sent over..... but I don't have a real current sensor.
Your routine seems to do a pretty good job to estimate total mAh used, so there should be some variable in the powermeter_SOFT routine, that would represent Amps (not mA_hour, but mA, i.e. current) ?
I can rescale it to fit actual amps, as long as it more or less linear with the current draw....
I'm not very familiar with arduino..... just enough to replace some variables, but not enough to understand your code
I know the powermeter already provides summed mAh used, so there is not really a separate need for amps as well..... but as it should be possible, why not
One other thing I noticed.
The mAh used estimation works reasonably well, provided I use similar batteries. Normally I fly 3S Lipo's of various capacities (2200 / 3300), and that works fine.
However, sometimes I use a 3S A123 2300 (LiFe) pack (because they are rugged, and last a long time). With the A123's the mA reading is nearly double of what is actually used... I guess that has to do with the lower output voltage and hence the higher throttle output required to stay airborn. But I assumed your code uses the vbat voltage reading to adjust for that ? That seems to be far off.....
Wilco
I have been using your powermeter software together with FrSky telemetry to show 'Fuel' on my transmitter (your variable 'intPowerMeterSum')
http://www.multiwii.com/forum/viewtopic.php?f=7&t=1929&start=30&hilit=powermeter
I've rescaled it so intPowerMeterSum shows from 0 - 2000 mAh (by adjusting PLEVELDIV), and it shows up on the 9X display as 100 ... 0 % Fuel (2000 mAh I consider 'empty'). I can also make it show mAh on the display, but that's more confusing to read while flying

The 9X can also show amp draw.... just need to get a number sent over..... but I don't have a real current sensor.
Your routine seems to do a pretty good job to estimate total mAh used, so there should be some variable in the powermeter_SOFT routine, that would represent Amps (not mA_hour, but mA, i.e. current) ?
I can rescale it to fit actual amps, as long as it more or less linear with the current draw....
I'm not very familiar with arduino..... just enough to replace some variables, but not enough to understand your code

I know the powermeter already provides summed mAh used, so there is not really a separate need for amps as well..... but as it should be possible, why not

One other thing I noticed.
The mAh used estimation works reasonably well, provided I use similar batteries. Normally I fly 3S Lipo's of various capacities (2200 / 3300), and that works fine.
However, sometimes I use a 3S A123 2300 (LiFe) pack (because they are rugged, and last a long time). With the A123's the mA reading is nearly double of what is actually used... I guess that has to do with the lower output voltage and hence the higher throttle output required to stay airborn. But I assumed your code uses the vbat voltage reading to adjust for that ? That seems to be far off.....
Wilco
Re: monitor total battery drain with current sensor? - close
for powermeter.soft there currently is no mA representation. It is simple to do and I have it on my todo list - need it for one small copter myself.
About other battery types: yes, the approximation can only take into account the vbat and the ESC throttle signals. While it should follow the same physics it will require a different scaling factor for different battery types. Your explanation is correct.
About other battery types: yes, the approximation can only take into account the vbat and the ESC throttle signals. While it should follow the same physics it will require a different scaling factor for different battery types. Your explanation is correct.