Skip to content

Commit

Permalink
Small doc enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Cabello Miguel committed Apr 16, 2021
1 parent 025ee87 commit 518bc1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/Battery.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ amperage_meter_scale = (Imax - Imin) * 100000 / (Tmax + (Tmax * Tmax / 50))
= 205
amperage_meter_offset = Imin * 100 = 280
```
Measuring Imax requires a battery and an ESC that can both deliver and support max current for the duration of the measurement, so it's prone to big inaccuracies. Alternatively, current can be measured at a much lower throttle position and be taken into account in the calculations.

Following the previous example, if we measured an Ibench current of 6A at 30% of throttle (1255 in the motors tab because (0.3*(max_throttle-1000))+1000))
```
Tbench = Tmax * bench_throttle = 850 * 0.3 = 255
amperage_meter_scale = (Ibench - Imin) * 100000 / (Tbench + (Tbench * Tbench / 50))
= (6 - 2.8) * 100000 / (255 + (255 * 255 / 50))
= 205
amperage_meter_offset = Imin * 100 = 280
```
#### Tuning Using Battery Charger Measurement
If you cannot measure current draw directly, you can approximate it indirectly using your battery charger.
However, note it may be difficult to adjust `amperage_meter_offset` using this method unless you can
Expand Down
2 changes: 1 addition & 1 deletion src/main/sensors/current.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void currentMeterVirtualRefresh(int32_t lastUpdateAt, bool armed, bool throttleL
throttleOffset = 0;
}

int throttleFactor = throttleOffset + (throttleOffset * throttleOffset / 50); // FIXME magic number 50, 50hz?
int throttleFactor = throttleOffset + (throttleOffset * throttleOffset / 50); // FIXME magic number 50. Possibly use thrustLinearization if configured.
currentMeterVirtualState.amperage += throttleFactor * (int32_t)currentSensorVirtualConfig()->scale / 1000;
}
updateCurrentmAhDrawnState(&currentMeterVirtualState.mahDrawnState, currentMeterVirtualState.amperage, lastUpdateAt);
Expand Down

0 comments on commit 518bc1b

Please sign in to comment.