|
ME 405 Term Project
|
Public Member Functions | |
| __init__ (self, adc_pin) | |
| read_voltage (self) | |
| droop_gain (self, refresh=False) | |
| refresh (self) | |
Public Attributes | |
| adc = ADC(Pin(adc_pin)) | |
| tuple | scale = (self.R_1_OHM + self.R_2_OHM) / self.R_2_OHM |
| bool | warned = False |
Static Public Attributes | |
| float | R_1_OHM = 9.98e3 |
| float | R_2_OHM = 4.712e3 |
| float | V_REF = 3.3 |
| float | V_NOM_SINGLE = 1.3 |
| int | V_NOM_TOTAL = 6*V_NOM_SINGLE |
| float | LOW_BATT_THRESHOLD = 6.0 |
Protected Attributes | |
| _cached_voltage = None | |
| float | _cached_gain = None |
Reads raw battery voltage through a voltage divider and computes a gain (based on the measured voltage) to be used in the closed loop control to compensate the effort for battery droop.
| battery_droop.Battery.__init__ | ( | self, | |
| adc_pin ) |
Initializes the Battery object with ADC pin and voltage divider values.
| battery_droop.Battery.droop_gain | ( | self, | |
| refresh = False ) |
Return droop gain, caching after first measurement. Set refresh=True to re-measure.
| battery_droop.Battery.read_voltage | ( | self | ) |
Reads the raw ADC value and computes the actual battery voltage.
| battery_droop.Battery.refresh | ( | self | ) |
Force a new calculation of droop gain.
|
protected |
|
protected |
| battery_droop.Battery.adc = ADC(Pin(adc_pin)) |
|
static |
|
static |
|
static |
| tuple battery_droop.Battery.scale = (self.R_1_OHM + self.R_2_OHM) / self.R_2_OHM |
|
static |
|
static |
|
static |
| bool battery_droop.Battery.warned = False |