PaxInstruments / labwiz-board

A development board based on the STM32 series processors specifically targeting the STM32F103RxT series.
4 stars 2 forks source link

Battery charging #10

Closed charlespax closed 8 years ago

charlespax commented 8 years ago

Implement a solid battery charging circuit. See http://community.paxinstruments.com/t/pax-instruments-labwiz/167

charlespax commented 8 years ago

From stmdude:

Power.. Battery... I've been looking at the T400 schematic with regards to the battery and charging. Now, before you read further, you need to know that I'm very paranoid and particular about the charging of lithium based batteries. :wink:

To decide how (and if) you want to charge a LiPo cell, there are a few parameters one has to know:

  1. The maximum allowed charge-current for the cell
  2. The lowest cell voltage allowed for full-current charge
  3. The maximum allowed cell-voltage for the cell
  4. The current temperature of the cell

So, in the T400, the MCP73831 handles a lot of this (btw, you haven't specified which MCP73831 you are using in the schematic. Using the wrong one (I'm thinking of people copying the board, etc) can lead to over-charged cells, which is bad).

  1. Is set by the resistor on the PROG pin
  2. The MCP73831 uses a very safe value for this. Downside: Charging an over-discharged battery can take a while longer than it should/could
  3. This isn't handled. And, considering the nature of the device, it probably should.

So, if you read the datasheet for a LiPo battery, you'll find two temperatures. These specify the range where charging is permitted (typically from 0C -> 45C). Charging the battery when it's outside of these temperature-ranges can damage it.

So, my suggestion is: Since the battery itself doesn't have a thermistor in it, use the internal themometer in the STM to sense the temperature. Put a N-Channel MOSFET on the PROG pin of the MCP, which the STM32 can control. This allows you to terminate charging (floating PROG = disabled charging).

Also, I'm assuming you'll adopt the battery detect circuitry to the STM, and just feeding VBAT into an ADC channel (via a voltage divider, of course)? (With a FET to be able to get rid of the leakage, just like the T400 has)

Sorry for the rant..

charlespax commented 8 years ago

I just ripped open a BL-5C battery. Here is the internal protection PCB. d9d5010e75819f5cd54aacaf05dd2d8ac8dc04b4_1_690x266

It contains two ICs. One is marked DW01 z, which is a battery protection IC from Fortune Semiconductor. It is probably similar to this one. The 8205S is a 8205A dual NFET. e5ca1a334d8c39f92ede216440cf8a37611c9e78 5120c79fcaea953de3724e96545adb41ccd7a21b_1_467x500

What do you think?

charlespax commented 8 years ago

From stmdude:

It's a pretty basic (and adequate) protection circuit. One thing you should confirm though (you might have already done it) is to make sure that the MCP73831 actually tries to charge a little bit before trying to do a battery detect (VBAT > 0V). Otherwise, "4. Charge Detection after Overdischarge" won't work. I've been bitten by that one once before. (Not with the MCP chargers though, that was a BQ)

Still, some rudimentary temperature checks would be in order (considering that people might very well put an instrument like this in a temp-chamber)

charlespax commented 8 years ago

The Adafruit Feather boards could be a nice reference design for our battery charging system. It's fairly similar to the T400 as well. Adafruit has a series of Feather boards with different microcontrollers and various wireless options.

Below are the power and battery charging circuits for the various boards. Decoupling cap and other bits may be left out.

Adafruit-Feather-32u4-Basic-Proto-PCB screen shot 2016-07-24 at 12 38 05 screen shot 2016-07-24 at 12 37 53

Adafruit-Feather-32u4-Bluefruit-LE-PCB screen shot 2016-07-24 at 12 38 51 screen shot 2016-07-24 at 12 39 06

Adafruit-Feather-32u4-FONA-PCB screen shot 2016-07-24 at 12 40 09 screen shot 2016-07-24 at 12 40 42

Adafruit-Feather-32u4-RFM-LoRa-PCB screen shot 2016-07-24 at 12 42 03 screen shot 2016-07-24 at 12 41 58

Adafruit-Feather-ESP8266-HUZZAH-PCB screen shot 2016-07-24 at 12 42 50 screen shot 2016-07-24 at 12 42 41

Adafruit-Feather-M0-Adalogger-PCB screen shot 2016-07-24 at 12 43 31 screen shot 2016-07-24 at 12 43 23

Adafruit-Feather-M0-Basic-Proto-PCB screen shot 2016-07-24 at 12 44 58 screen shot 2016-07-24 at 12 44 28

Adafruit-Feather-M0-Bluefruit-LE-PCB screen shot 2016-07-24 at 12 46 30 screen shot 2016-07-24 at 12 45 58

Adafruit-Feather-M0-RFM-LoRa-PCB screen shot 2016-07-24 at 12 47 09 screen shot 2016-07-24 at 12 47 28

Adafruit-Feather-M0-WiFi-WINC1500-PCB screen shot 2016-07-24 at 12 48 17 screen shot 2016-07-24 at 12 48 36

Adafruit-WICED-WiFi-Feather-PCB screen shot 2016-07-24 at 12 49 41 screen shot 2016-07-24 at 12 49 31

All Feather boards use the same MCP73831 battery charging circuit that we also use in the T400, so I think we should stick with that for the LabWiz board. screen shot 2016-07-24 at 12 38 05

Each Feather board uses one of two LDO voltage regulators: SPX2319-3.3, AP2112-3.3. screen shot 2016-07-24 at 12 49 31 screen shot 2016-07-24 at 12 43 23

charlespax commented 8 years ago

Here is the voltage regulator and the battery charging circuit. screen shot 2016-08-08 at 23 09 00 screen shot 2016-08-08 at 23 08 30

We still need to implement switching between battery power and USB power https://github.com/PaxInstruments/labwiz-board/issues/37.