Enable telemetry on SPARKY
[betaflight.git] / docs / Battery.md
blobb438fb529617de35d269dba59cbc793808a64080
1 # Battery Monitoring
3 Cleanflight has a battery monitoring feature.  Battery voltage of the main battery can be measured by the system and used
4 to trigger a low-battery warning buzzer, on-board status LED flashing and LED strip patterns.
6 Low battery warnings can:
8 * help to ensure that you have time to safely land the aircraft.
9 * help maintain the life and safety of your LiPo/LiFe batteries which should not be discharged below manufacturers recommendations.
11 Minimum and maximum cell voltages can be set, and these voltages are used to detect the amount of cells you are using.
13 Per-cell monitoring is not supported, as we only use one ADC to read the battery voltage.
14   
15 ## Supported targets
17 All targets support battery voltage monitoring unless status.
19 ## Connections
21 When dealing with batteries **ALWAYS CHECK POLARITY!**
23 Measure expected voltages first and then connect to flight controller, connecting to the flight controller with
24 incorrect voltage or reversed polarity will likely fry your flight controller. Ensure that your flight controller
25 has a voltage divider that is capable of measuring your particular battery voltage.
27 ### Naze32
29 The Naze32 has an on-board battery divider circuit, connect your main battery to the VBAT connector.
31 ### CC3D
33 The CC3D has no battery divider, create one that gives you a 3.3v MAXIMUM output when your battery is
34 fully charged and connect the output from it to S5_IN/PA0/RC5.
36 S5_IN/PA0/RC5 is Pin 7 on the 8 pin connector, second to last pin, opposite end from the GND/+5/PPM signal input.
38 Note: When battery monitoring is enabled on the CC3D RC5 can no-longer be used for PWM input.
40 ## Configuration
42 Enable the `VBAT` feature.
44 Configure min/max cell voltages using the following CLI setting:
46 `vbat_scale` - adjust this to match battery voltage to reported value.
48 `vbat_max_cell_voltage` - maximum voltage per cell, used for auto-detecting battery voltage in 0.1V units, i.e. 43 = 4.3V
50 `set vbat_warning_cell_voltage` - warning voltage per cell, this triggers battery out alarms, in 0.1V units, i.e. 34 = 3.4V
52 `vbat_min_cell_voltage` - minimum voltage per cell, this triggers battery out alarms, in 0.1V units, i.e. 33 = 3.3V
54 e.g.
56 ```
57 set vbat_scale = 110
58 set vbat_max_cell_voltage = 43
59 set vbat_warning_cell_voltage = 34
60 set vbat_min_cell_voltage = 33
61 ```
63 # Current Monitoring
65 Current monitoring (Amperage) is supported by connecting a current meter to the appropriate current meter ADC input (See Board documentation).
67 When enabled, Amps, mAh used and capacity remaining are calculated and used by the telemetry and OLED display subsystems.
69 ## Configuration
71 Enable current monitoring using the CLI command
73 ```
74 feature CURRENT_METER
75 ```
77 Configure the current meter type using the `current_meter_type` settings as per the following table.
79 | Value | Sensor Type            |
80 | ----- | ---------------------- | 
81 | 0     | None                   |
82 | 1     | ADC/hardware sensor    |
83 | 2     | Virtual sensor         |
85 Configure capacity using the `battery_capacity` setting, which takes a value in mAh.
87 If you're using an OSD that expects the multiwii current meter output value, then set `multiwii_current_meter_output` to `1` (this multiplies amperage sent to MSP by 10).
89 ### ADC Sensor
90 The current meter may need to be configured so that the value read at the ADC input matches actual current draw.  Just like you need a voltmeter to correctly calibrate your voltage reading you also need an ammeter to calibrate your current sensor.
92 Use the following settings to adjust calibration. 
94 `current_meter_scale`
95 `current_meter_offset`
97 ### Virtual Sensor
98 The virtual sensor uses the throttle position to calculate as estimated current value. This is useful when a real sensor is not available. The following settings adjust the calibration.
100 | Setting                       | Description                                              |
101 | ----------------------------- | -------------------------------------------------------- | 
102 | `current_meter_scale`      | The throttle scaling factor [centiamps, i.e. 1/100th A]  |
103 | `current_meter_offset`     | The current at zero throttle (while disarmed) [centiamps, i.e. 1/100th A] |
105 There are two simple methods to tune the parameters depending in whether it is possible to measure current draw for your craft.
107 #### Tuning Using Battery Charger Measurement
108 It may be difficult to adjust `current_meter_offset` using this method unless you can measure the actual current draw with the craft disarmed. Adjust `current_meter_scale` until the mAh draw reported by Cleanflight matches the charging data given by your battery charger after the flight (if the mAh draw is lower than reported by your battery charger, increase `current_meter_scale`, and vice-versa).
109 #### Tuning Using Actual Current Measurements
110 If you know your crafts current draw while disarmed (Imin), and at maximum throttle while armed (Imax), you can calculate the scaling factors using the following formulas where Tmax is maximum throttle offset (i.e. for `max_throttle` = 1850, Tmax = 1850 - 1000 = 850):
112 current_meter_scale = (Imax - Imin) * 100000 / (Tmax + (Tmax * Tmax / 50))
113 current_meter_offset = Imin * 100
115 e.g. For a maximum current of 34.2 A and minimum current of 2.8 A with `max_throttle` = 1850
117 current_meter_scale = (Imax - Imin) * 100000 / (Tmax + (Tmax * Tmax / 50))
118                     = (34.2 - 2.8) * 100000 / (850 + (850 * 850 / 50))
119                     = 205
120 current_meter_offset = Imin * 100 = 280