Page 1 of 1

[Solved] Charging and Discharging unprotected batteries.

Posted: Tue Jan 26, 2021 4:17 am
by cafeciaojoe
Hi,

Bit of a wordy problem here.

I am looking to install a charging station that will recharge these batteries (via the onboard usb port) that do not have the circuit protectors.
https://hobbyking.com/en_us/turnigy-nan ... tore=en_us
Is this a sensible way of doing this? the batteries will be cycled through at most 40 times. Should I perhaps use a dedicated charger instead?https://hobbyking.com/en_us/turnigy-up- ... s_products

The other question is about discharging. I have been told that the real danger with these batteries is not to deplete them too far. I am planning to write some code or firmware change that will prevent the drone from taking off if under a certain voltage. if the drone lands as soon as the red light is displayed (whatever that voltage is, I cant remember the value) is this a sensible value? or should it be higher?

Thanks for your help!

Re: Charging unprotected batteries via USB.

Posted: Wed Jan 27, 2021 1:14 pm
by tobias
The charger will work fine and is designed for LiPo and will cut off at 4.2V. The depletion though should perhaps be handled a bit better and is the most common risk I see. Something as simple as shutting off the system if the voltage has been lower then 2.9V for e.g. 3 seconds. This should preferably be handled in the nRF51 but could be handled in the STM32 as well.

Re: Charging unprotected batteries via USB.

Posted: Thu Jan 28, 2021 7:03 pm
by cafeciaojoe
Thanks very much for the info, I think I will start with the STM32, as it is vaguely familiar to me.

in pm_stm32f4.c line 149 there seems to be the beginnings of a ACTIVATE_AUTO_SHUTDOWN condition, Is this the reason why the CF just tries to restart itself indefinately when the batt is critically low?

Any tips on how to finish this feature off?

I assume some sort of message needs to be passed to the nRF51 in a special format. I see that '0x11' is the 'on/off' switch between the two. and that in syslink.h there is some sort of function (struct? sorry not familiar with C) that seems to be able to send packets,

Code: Select all

typedef struct _SyslinkPacket
{
  uint8_t type;
  uint8_t length;
  char data[SYSLINK_MTU];
} __attribute__((packed)) SyslinkPacket;

Re: Charging unprotected batteries via USB.

Posted: Fri Jan 29, 2021 1:57 pm
by tobias
This is fully untested but might work :-)

Code: Select all

/**
 * Shutdown system
 */
static void pmSystemShutdown(void)
{
#ifdef ACTIVATE_AUTO_SHUTDOWN
  SyslinkPacket slp;

  slp.type = SYSLINK_PM_ONOFF_SWITCHOFF;
  slp.length = 0;
  syslinkSendPacket(&slp);
#endif
}
You might also want to change the auto off timeout if it works, PM_SYSTEM_SHUTDOWN_TIMEOUT which is now set to ~5min.

The critical low behavior is caused by the voltage being so low that the MCUs can't run reliably. Hitting what is normally called brown-out reset.

Re: Charging unprotected batteries via USB.

Posted: Mon Feb 01, 2021 4:25 am
by cafeciaojoe
Hi Tobias,

Thanks for the suggestion. I implemented the code, the 'pmSystemShutdown' function did not seem to be able to be called unless I uncommented the line below from the config.h file.

Code: Select all

#define ACTIVATE_AUTO_SHUTDOWN

Re: Charging unprotected batteries via USB.

Posted: Mon May 03, 2021 3:44 am
by cafeciaojoe
tobias wrote: Wed Jan 27, 2021 1:14 pm The charger will work fine and is designed for LiPo and will cut off at 4.2V. The depletion though should perhaps be handled a bit better and is the most common risk I see. Something as simple as shutting off the system if the voltage has been lower then 2.9V for e.g. 3 seconds. This should preferably be handled in the nRF51 but could be handled in the STM32 as well.
Is it possible to change this maximum value of 4.2v in the firmware?

Re: [Solved] Charging and Discharging unprotected batteries.

Posted: Mon May 03, 2021 7:00 am
by tobias
The 4.2v is controlled by the BQ24075 charger and looking in the datasheet the charging voltage can't be changed.