[Solved] Charging and Discharging unprotected batteries.

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
cafeciaojoe
Member
Posts: 81
Joined: Mon Jun 18, 2018 2:37 am

[Solved] Charging and Discharging unprotected batteries.

Post 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!
Last edited by cafeciaojoe on Mon Feb 01, 2021 6:48 am, edited 3 times in total.
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
tobias
Bitcraze
Posts: 2123
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Charging unprotected batteries via USB.

Post 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.
cafeciaojoe
Member
Posts: 81
Joined: Mon Jun 18, 2018 2:37 am

Re: Charging unprotected batteries via USB.

Post 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;
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
tobias
Bitcraze
Posts: 2123
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Charging unprotected batteries via USB.

Post 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.
cafeciaojoe
Member
Posts: 81
Joined: Mon Jun 18, 2018 2:37 am

Re: Charging unprotected batteries via USB.

Post 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
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
cafeciaojoe
Member
Posts: 81
Joined: Mon Jun 18, 2018 2:37 am

Re: Charging unprotected batteries via USB.

Post 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?
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
tobias
Bitcraze
Posts: 2123
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: [Solved] Charging and Discharging unprotected batteries.

Post by tobias »

The 4.2v is controlled by the BQ24075 charger and looking in the datasheet the charging voltage can't be changed.
Post Reply