FEATURE REQUEST for power management

Due to how the charging/power management/power switching is implemented on the CubeCell boards, I am unable to determine the following:

-When is it on external power (USB)
-When is it charging. I need this to compensate for self-heating during charging.

Can we get the option on the next version of boards to have a set of bridge pads to tie these to a GPIO?
My reason for this is to alter the behaviour and transmit interval based on the state of the power system.

While I am asking, a current sensor for the battery such as the INA219 would be a nice addition to the boards.

If anyone knows of a way to achieve these requests with the current boards it would be appreciated (I am using the Cubecell board and Dev-plus boards).

thanks,

-michael

you can use the battery level to determine if you are on power or battery…
see this example:

basically when an external power is plugged in the level will be higher than 4.1v based ob that you can run your logic…

cheers,
Jay

Unfortunately,

This does not add the information I need. My problem is two fold:

  1. My device has an internal temperature sensor. When charging, I am getting some self heating. I need a binary indicator that the device is charging (or not). There is a cute little red LED that comes on when charging. I need that signal for my program logic.
  2. I have tried the battery level and it is based on a calculation I am already performing

uint8_t BoardGetBatteryLevel()

{

            // 5.5 End-Device Status (DevStatusReq, DevStatusAns)

            // 0      The end-device is connected to an external power source.

            // 1..254 The battery level, 1 being at minimum and 254 being at maximum

            // 255    The end-device was not able to measure the battery level.

            const double maxBattery = 4.212;

            const double minBattery = 3.7;

            const double batVoltage = fmax(minBattery, fmin(maxBattery, getBatteryVoltage() / 1000.0));

            const uint8_t batlevel = BAT_LEVEL_EMPTY + ((batVoltage - minBattery) / (maxBattery - minBattery)) * (BAT_LEVEL_FULL - BAT_LEVEL_EMPTY);

            //printf("battery level (1-254): %u\n", batlevel);

            return batlevel;

}

Again, I need a binary indicator that the external power is present or not as this calculation does not produce consistent results due to battery age, ambient temperature, etc.

-michael

Hello,
try this:

uint16_t batteryVoltage = getBatteryVoltage();
Serial.print(batteryVoltage); //Basically when the power is plugged in this number will be above 4100mv since the lithium will require up to 4.2v to charge and will go below that when its not plugged in..

//for lora packet:
appData[0] = (uint8_t)(batteryVoltage >> 8);
appData[1] = (uint8_t)batteryVoltage;

Hi, The schematic for the AB01 board shows that the Vin pin is connected to the USB 5V. With a suitable voltage level shifter ( resistive divider, mosfet, or something similar) you should be able to detect whether USB power is present. There are blocking diode shown on the schematic which prevent the battery from back feeding voltage onto the USB port.

Don’t be tempted to connect Vin directly to a GPIO pin.

Yeah, I was thinking the same. Just did not want to add another PCB/component if there was some way to get the information. I am thinking of just moving the power and battery to an external PCB and add the needed logic outputs there. Maybe even an i2c interface like the laptop mfgs do. Better power diagnostics will be valuable improvements to the cubecell development boards since many of us are using them as-is in products.

thanks for the input,
-michael