Estimating Battery Discharge/Charge times

Post Reply
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Estimating Battery Discharge/Charge times

Post by omwdunkley » Thu Jun 13, 2013 10:22 pm

Hey guys!

Thought I would just open a discussion to talk about the best way to estimate charge/discharge times ;)

Goal would be to have a running countdown to a full charge while charging or a countdown to the battery state hitting low while in use. Its not really important but it would make the whole thing a little more friendly :)

Has anyone else thought about this? Lets discuss!

For a start, here is graph I just made from charging a flie from battery_state = LOW to battery_state = CHARGED:
Raw data here:

Also, for reference for the BC wiki: ... png?cache=

I guess an easy solution would be look at where one is in the graph and just use that information. Im sure there is a better way.


Posts: 100
Joined: Tue May 14, 2013 8:31 pm
Location: Austria

Re: Estimating Battery Discharge/Charge times

Post by Surrender » Fri Jun 14, 2013 6:39 am

I was working on that already, not on the charging but on the discharging part.
It is not that easy to do without a current sensor on the board. I have used the discharge curve for the battery to estaminate the actual capacity and duration until the battery is empty.
I just used a average current of 1400mA and get the value. Currently I'm not @home, so i have no access to my source code.

The main problem is that the measured voltage is going down when the thrust raises. So we have to measure the current of the motors, otherwise we can't compensate this voltage drop.

My next step (or somebody else can do, using a current clamp-> i dont have one :/) is to measure the current, % thrust and pushed weight.
The we have e.g. for 20% of thrust we have a current of 50mA and it can be pushed 2g.
From this we can multiply the current with 4 -> 200mA @ e.g. 3,8V.

I found also a website where it is explained how to use this data and estaminate the flight time (, I will post the exact page @ evening).

I've also implemented this into my pc client software using a Lookup table and a interpolation method the get the values between the points from the battery discharge curve.

Posts: 1919
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Estimating Battery Discharge/Charge times

Post by tobias » Fri Jun 14, 2013 7:28 am

This sounds like a really fun challenge to implement!
I think you are both on the right track. Using a capacity model, but also a voltage->capacity model to correct that against.
The challenge is that both models can be pretty complex and we only know the PWM and the battery voltage so there will be a lot of assumptions. The good thing is that relationships should be very similar between Crazyflies as they use the same components. Therefore, as you already said we need to find the transfer functions from PWM -> current -> capacity and from current -> battery voltage -> capacity. Does this make any sense or I'm I just rambling?
When the current estimation is high the current ->battery voltage -> capacity will be very uncertain, but when it is low it should be pretty certain (no internal battery voltage drop).

The battery voltage drop at a specific current could be measured or modelled using the parameters. The important modelling factors are:
* Battery internal resistance: <120 mOhm
* PCM circuit resistance: <60 mOhm
* Connector resistance: ~8 mOhm
I guess the problems are that they don't really specify the resistance, just below... Measurement might be the best way.

This will be very interesting to follow and I'll be leaving it for you guys to solve. Don't want to interfere with the fun ;)

Posts: 100
Joined: Tue May 14, 2013 8:31 pm
Location: Austria

Re: Estimating Battery Discharge/Charge times

Post by Surrender » Fri Jun 14, 2013 3:43 pm

Now I'm @ home (finally) and here are the links which i promised to give:
Attention: The first & second one are written in german, there is no english version available. If you need help, don't hesitate to ask me (I'm from austria) or use google translator.
The first one is about getting the motor curve: measuring current (with current clamp), in relation to thrust.
The second one is about flight time and a theoretical calculation of it.
The third and fourth one is in english and is about calculating batteries, some basics, ..

I'll fly now a little bit and then i add the code (interpolation, look up table, ..). It is not a pull request as i first want to get something usefull (without voltage drop errors).

Post Reply