drone-flight-controller icon indicating copy to clipboard operation
drone-flight-controller copied to clipboard

battery_voltage

Open Hugh20210 opened this issue 3 years ago • 2 comments

Hi Man,

Don't understand how to set battery voltage. What's the default battery_voltage? And how to connect Li battery to Arduino MLB pin? Can you explain detail. Thanks very much bool isBatteryConnected() { // Reduce noise with a low-pass filter (10Hz cutoff frequency) battery_voltage = battery_voltage * 0.92 + (analogRead(0) + 65) * 0.09853;

return battery_voltage < 1240 && battery_voltage > 800;

}

Do you have any update plan on the Arduino Drone? Like GPS, Pan&Tilt...

Hugh20210 avatar Oct 14 '22 09:10 Hugh20210

Hi @Hugh20210

At very first, battery_voltage has no value, meaning 0. => Maybe I should initialize it explicitly.

This code reads the voltage on PIN A0, then apply a 10Hz-low-pass filter to remove noise:

 battery_voltage = battery_voltage * 0.92 + (analogRead(0) + 65) * 0.09853;

On the PIN A0, apply a voltage divider bridge in order to get 5V from your Lipo.

lobodol avatar Oct 14 '22 09:10 lobodol

Thanks for your fast reply. It is superise for me. So we need to connect Battery to Arduino board VCC and motor, and also need divider battery voltage for analog A0.

BTW, do you have any other upgrade or suggest for your drone?

Hugh20210 avatar Oct 17 '22 06:10 Hugh20210