Please review the code example below.
int res = System.setPowerConfiguration(conf);
// returns SYSTEM_ERROR_NONE (0) in case of success
powerSourceMaxCurrent- The maximum current the device can pull from the source.
100, 150, 500, 900, 1200, 1500, 2000, 3000 - The PMIC will set closest usable value.
powerSourceMinVoltage- The minimum voltage at which current is available (useful for Solar panels):
3880-5080 in increments of 80(mV).
batteryChargeCurrent- The current at which the battery will be charged.
100, 150, 500, 900, 1200, 1500, 2000 - The PMIC will set closest usable value.
batteryChargeVoltage- The termination voltage at which the device will cease charging the battery. In hot environments a lower voltage is recommended.
4110 or 4210
How do I reset the PMIC?
In some cases errant settings or misconfigurations can cause undesired behavior. The code below will reset the PMIC to its default values.
When troubleshooting power-related issues, taking care to perform a PMIC reset is a useful and necessary step prior to initiating contact with our Support team.
Currently (as of DeviceOS 2.0.1) the Power manager cannot enable or disable charging.
To do so one needs to call the old PMIC API.
To call the PMIC API it ideally needs to be wrapped inside a function to avoid interference from the Power Manager.
PMIC pmic(true); //Calling it with true locks it to the user code
When a device is running solely on battery power it needs to conserve power. The new Sleep API (link) is the best way to achieve this, if paired with an efficient publishing schema. We will release documentation optimized for low-power use-cases in the future, but in the meantime please see the following considerations for low-power deployments:
- The PMIC will not enter a low-power state if powered from the USB port or VUSB. Quoted power draw has been calculated with the device powered at 3.7V from the Li+ pin.
- Prior to Device OS 1.5.2/2.x, Sleep mode will not operate as expected and current draw can in fact increase during Sleep. We encourage all customers to upgrade to our latest LTS Device OS version (2.x) in order to avail oneself of the advancements to our Sleep implementation.
- Battery chemistry and configuration is important. Primary (alkaline AAs for ex.) cells have a long shelf life and excellent capacity, but their constant draw is low and they have limited peak current capabilities. Lithium batteries have a much higher self-discharge rate and should not be drained too low.