Low battery alert with 12.3v (38%) goes RTL

My change does require recompiling the code.

You have probably noticed that the discharge curves of LiPO batteries vary with the current drawn. And that - at any given state of charge, the battery voltage goes lower as the current increases.
The vast majority of this change in voltage with current is due to a characteristic labeled Effective Series Resistance or “ESR”. Almost all electronic components have this characteristic. If it was drawn in a schematic, it would appear as a resistor in series with each cell in a battery, or in series with each capacitor, or in series with each inductor. This ESR is not a real resistor, but it behaves as one. As increasing current is drawn from a cell, the voltage goes lower due to the voltage drop across this ESR resistor. If the ESR of a cell is .005 ohms (5 milliohms), then each amp drawn will cause a voltage drop across that resistor of 1A times .005 or 5 millivolts. At a current draw of 20A, the drop due to ESR is 100 mV. If we put 4 cells in series, and each one has an ESR of 5 milliohms, and we draw 20A from that battery, the voltage drop due to ESR is 4 X .005 X 20 = 400mV. In this case, at a load of 20A, the actual cell voltage is 400mV HIGHER than we read at the terminals. This 400mV difference represents an error in our voltage measurement. But note that this error is not constant. It varies with the current drawn from the battery. At 0A load, there is no error, at 20A there is a 400mV error, at 40A there is a 800mV (.8V) error. The actual cell voltage is always equal to, or higher than what we measure at the terminals. My code change multiplies the current drawn times the ESR of the battery itself, added to the resistance of the wires going to the battery - which I calculate to be about .020 ohms for a 4 cell 6600mAH battery and the wiring I have between the voltage monitor and the battery itself.
This multiplication calculates the error due to ESR and adds that to the measured voltage. The result is a much better idea of battery condition.

Thanks Charles for the short and informing teaching. Am I right that I have to correct the AP_Battmonitor.cpp? Or seems it stupid from me? If yes, where can I find this .cpp file and how can I change this? By notepad? I hope this is the good translation in English. Thanks Herman

You need to be able to compile the code. There are tutorials on the net
to do this.

The source files are on GitHub.

Charles Linquist

All, thanks for helping me. I changed the “NEW_AMP_VOLT” to 28.00 and I think the voltage problem is solved. I gained with autotune and he is flying very well. MP is correct and said: autotune saved, so I think he is ready. Only I couldn’t see any difference between the old and the new saved situation. Both the same. Maybe still not saved? I will try again. Only one issue I’m worried about. During autotuning and my second flight, I got several times the message: no data for 10 seconds, no data for 15 seconds, till the time I flew the copter to the place I started and the message was gone. Till I flew again a little bit far away (50 meter). Again the error message. I tested some functions, like retracting the landing gear, left, right, everything is working. Why do I get this message or error? Thanks in advance, maybe somebody had the same problem. Greetings, Herman

All, thanks for helping me. I changed the “NEW_AMP_VOLT” to 28.00 and I think the voltage problem is solved. I gained with autotune and he is flying very well. MP is correct and said: autotune saved, so I think he is ready. Only I couldn’t see any difference between the old and the new saved situation. Both the same. Maybe still not saved? I will try again. Only one issue I’m worried about. During autotuning and my second flight, I got several times the message: no data for 10 seconds, no data for 15 seconds, till the time I flew the copter to the place I started and the message was gone. Till I flew again a little bit far away (50 meter). Again the error message. I tested some functions, like retracting the landing gear, left, right, everything is working. Why do I get this message or error? Thanks in advance, maybe somebody had the same problem. Greetings, Herman