Battery Monitoring
Betaflight has a battery monitoring feature. The voltage of the main battery can be measured by the system and used to trigger a low-battery warning buzzer, on-board status LED flashing and LED strip patterns.
Low battery warnings can:
- Help ensure you have time to safely land the aircraft
- Help maintain the life and safety of your LiPo/LiFe batteries, which should not be discharged below manufacturer recommendations
Minimum and maximum cell voltages can be set, and these voltages are used to auto-detect the number of cells in the battery when it is first connected.
Per-cell monitoring is not supported, as we only use one ADC to read the battery voltage.
Supported targets
All targets support battery voltage monitoring unless status.
Connections
When dealing with batteries ALWAYS CHECK POLARITY!
Measure expected voltages first and then connect to the flight controller. Powering the flight controller with incorrect voltage or reversed polarity will likely fry your flight controller. Ensure your flight controller has a voltage divider capable of measuring your particular battery voltage.
Naze32
The Naze32 has an on-board battery divider circuit; just connect your main battery to the VBAT connector.
CAUTION: When installing the connection from main battery to the VBAT connector, be sure to first disconnect the main battery from the frame/power distribution board. Check the wiring very carefully before connecting battery again. Incorrect connections can immediately and completely destroy the flight controller and connected peripherals (ESC, GPS, Receiver etc.).
CC3D
The CC3D has no battery divider. To use voltage monitoring, you must create a divider that gives a 3.3v MAXIMUM output when the main battery is fully charged. Connect the divider output to S5_IN/PA0/RC5.
Notes:
-
S5_IN/PA0/RC5 is Pin 7 on the 8 pin connector, second to last pin, on the opposite end from the GND/+5/PPM signal input.
-
When battery monitoring is enabled on the CC3D, RC5 can no-longer be used for PWM input.
Sparky
See the Sparky board chapter.
Configuration
Enable the VBAT
feature.
Configure min/max cell voltages using the following CLI setting:
vbat_scale
- Adjust this to match actual measured battery voltage to reported value (which may be displayed via the status
command)
vbat_max_cell_voltage
- Maximum voltage per cell, used for auto-detecting battery voltage in 0.01V units, i.e. 430 = 4.3V
vbat_min_cell_voltage
- Minimum voltage per cell; this triggers battery-critical alarms, in 0.01V units, i.e. 330 = 3.3V
vbat_warning_cell_voltage
- Warning voltage per cell; this triggers battery-warning alarms, in 0.01V units, i.e. 340 = 3.4V
vbat_hysteresis
- Sets the hysteresis value for low-battery alarms, in 0.01V units, i.e. 10 = 0.10V
vbat_duration_for_warning
- Period voltage has to sustain before the battery state is set to battery-warning, in 0.1 s, i.e. 60 = 6.0 seconds
vbat_duration_for_critical
- Period voltage has to sustain before the battery state is set to battery-critical, in 0.1 s, i.e. 21 = 2.1 seconds
e.g.
set vbat_scale = 110
set vbat_max_cell_voltage = 430
set vbat_min_cell_voltage = 330
set vbat_warning_cell_voltage = 340
set vbat_hysteresis = 1
set vbat_duration_for_warning = 60
set vbat_duration_for_critical = 20
Current Monitoring
Current monitoring (amperage) is supported by connecting a current meter to the appropriate current meter ADC input (see the documentation for your particular board).
When enabled, the following values calculated and used by the telemetry and OLED display subsystems:
- Amps
- mAh used
- Capacity remaining
Configuration
Enable current monitoring using the CLI command:
feature CURRENT_METER
Configure the current meter type using the amperage_meter_type
settings here:
Value | Sensor Type |
---|---|
NONE | None |
ADC | ADC/hardware sensor |
VIRTUAL | Virtual sensor |
Configure capacity using the bat_capacity
setting, in mAh units.
If you're using an OSD that expects the multiwii current meter output value, then set multiwii_amperage_meter_output
to ON
(this multiplies amperage sent to MSP by 10 and truncates negative values)).