Author Topic: One Lithium battery to rule them all.  (Read 8247 times)

0 Members and 1 Guest are viewing this topic.

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
One Lithium battery to rule them all.
« on: February 25, 2015, 12:00:43 am »
Hello!
One thing allways bugged me when building something portable, the circuit needs electricity.
I am a bit tired of 9V blocks or Li* cells with a LDO, 12V AA series battery packs, 2-3 AA battery packs and so forth.
I would like a single solution, all in one, neat and tidy.
Over the years i have come to like LiIon cells, and early last year i discovered the 18650 and 14500 formfactor as something reliably available and mostly cheap.
So... for the past weeks i have been working on a small board, it should to this:

Charge the Cell with a selectable current from 100mA to 1A if the cell allows it.
Use either a USB-Port or Phone charger as the power source with a µUSB connector.
Protect the Cell from over charge and over discharge because i do not want to rely on protected cells.
Keep loosely track of the charge and discharge state with a fuel gauge.
Monitor the cell voltage.
Provide 3.3V at 500mA over the whole discharge cycle with a low Iq.
Provide 5V at 500mA over the whole discharge cycle with a low Iq.
Provide 12V at 50mA over the whole discharge cycle with a low Iq.
Provide a clear and meaningfull interface to show the charge or discharge state,
not just one LED that lights up when charging.

The minium load should be around 100µA, and the current consumption of the circuit should be around the same.
One rail should allways be available for the logic and the others can be switched on demand.

For example ATMega 328P in power down mode and a DS3231 RTC on the 3.3V rail will draw around 200µA, on top of that 100µA for the "battery circuit".
That is still a lot standby current but something that is acceptable.
The µC can wake it self to perform a task, for example measure the ambient temperature and go to sleep again or be awakend by a level interrupt with a button press.

The parts selected are:

3.3V
Linear LTC3440 buck-boost regulator
http://www.linear.com/product/LTC3440

5V
Microchip MCP1640 boost regulator
http://www.microchip.com/MCP16404171966

12V
Not shure yet

LiIo protection and fuel gauge
Maxim DS2764 with IRF7324 p-channel mosfet
http://www.maximintegrated.com/en/products/power/battery-management/DS2764.html
http://www.irf.com/part/_/A~IRF7324

5V input LiIo Charger
Microchip MCP73833
http://www.microchip.com/MCP73833

Charge current selection
Cypress CY7C65213 USB Serial interface with charger detect
http://www.cypress.com/?mpn=CY7C65213-32LTXI
Analog 4052 multiplexer
I dont think i have to link this one :)

Yes, there are a bunch of better chips out there for either one of the listed above but there were some limitations. For one i do not want packages with hidden pads/legs since i handsolder and hate parts with hidden pads.
I do not want exotic and expensive parts (except for the DS2764) and i am limited by what is available in small quantities without paying through the nose.

Why 3.3V, 5V and 12V? Allmost everything on my bench runs at 3.3V, sometimes there is the odd part that demands 5V and one additional 5V regulator will not make that much of a difference.
The 12V rail is to be used by opamps and some fancy stuff in the future, not much power on this supply is needet.

For example, the MCP73833 provides three outputs to indicate a fault, connected power supply, charging and charge complete, on top of that it has a NTC output to monitor the battery temperature.
There are chips out there who do not need external parts to select the charge current, but they are 5 times as expensive.
The charge current should be selectable through a parallel 2 bit interface, a analog multiplexer does this nicely.

The LTC3440 buck/boost was the only part with non-legless package readily available to me.

The MCP1640 boost is cheap...

The DS2764 is expensive but it has a build in shunt resistor, a temperature monitor/compensation, a I2C interface, voltage monitor, output disconnect (hardware switch) and again is available with legs. Many other chips are only available in a QFN package.
 
The CY7C65213 provides a full serial interface, has a USB charger detect feature (SDP, CDP, DCP port), ensures a USB compliant current draw and controls the charge current.

Currently i have routed a bunch of breakout/testboards to evaluate the function of each component, the boards are ordered, half the parts are on my shelf and the remaining ones are ordered.

If someone is interested, i will post a few schematics and keep you updated if i do not run into a wall, loose interest or throw a tantrum caused by my lack of experience :)

I bet i allready have made a few big mistakes wich will bite my in the arse big time...

Greetings,
Peter
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29432
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: One Lithium battery to rule them all.
« Reply #1 on: February 25, 2015, 11:14:11 am »
Good project for those that want to remain isolated from mains.
Have you given any thought how that might be achieved while charging?

Getting output ripple down to low levels might be a challenge.

You should produce it in kit form to sell to members.

Sure post you developments.  :-+
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8789
  • Country: fi
Re: One Lithium battery to rule them all.
« Reply #2 on: February 25, 2015, 02:25:08 pm »
As you already have quite a lot of DC/DC going on there, I'd consider upgrading the charger input to switch mode as well. It would be nice if you could charge from 12V, for example. Linear charger IC is simple, but the efficiency is poor, 5V only requirement is not nice and the charging current is rather limited by the linear regulator heat dissipation. I'm not sure if there are nice integrated buck battery charger ICs, but I suspect there are...
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #3 on: February 25, 2015, 04:52:36 pm »
Good project for those that want to remain isolated from mains.
Have you given any thought how that might be achieved while charging?

I do not know what you mean with "isolated from the mains".
As for the charge and system load i will be using the microchip aplication Note AN1149 as my reference:
"Designing A Li-Ion Battery Charger and Load Sharing System"
This limits the charge current and i will have to do some tinkering with the numbers but i will have to do for now.

One thing i have not figured out is how i will manage charging, load sharing and usb connectivity to a host system.
Maybe a dedicated charging port will have to be addet...

Quote
Getting output ripple down to low levels might be a challenge.

For now my main concern are digital circuits, i have some ideas about managing that though.

Quote
You should produce it in kit form to sell to members.

Lets not get ahead of ourself, i barely know what i am dooing, i just hope i have something usefull at the end...
And even if, i doubt that many people would want such a device :)

As you already have quite a lot of DC/DC going on there, I'd consider upgrading the charger input to switch mode as well.

Yes, i had thought about that. At the same time i considered two series cells.
I could simply not find a suitable part, either the chip was too expensive/big or only available in a legless package.
The lot of the usual suspects are all linear chargers.

But that will be the part wich will give me the biggest headache, USB connectivity, charging and load sharing all over the same connector...

Right now, i do not know how to manage that...

If i do not come up with a suitable solution it will make the circuit a whole lot simpler.
Just wack a 2A wall wart jack in there, set the charge current at 1A and be done with it.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #4 on: March 04, 2015, 08:32:55 pm »
One thing i have not figured out is how i will manage charging, load sharing and usb connectivity to a host system.
Maybe a dedicated charging port will have to be addet...

There are a few ways i thought of, either all in software on the µC or hardwired without anny further logic.
Right now i got a big grin on my face, it is still a farily simple circuit but i am fairly proud of myself that it worked right away as expected :)



The circuit enables the µC to communicate with the host through the USB<->Serial interface.
The charging and power circuit can be interfaced to the µC with a 2 bit parrallel interface, though it would be possible to change that to I2C if the 4052 would be replaced by a bus expander.

USB connection:
2mA - USB Suspend
100mA - non enumerated USB connection
500mA - enumerated USB connection
1,5A - dedicated charging port

The Li* charger is controlled as well with a 2 bit parallel interface with a dedicated enable pin.
Either 4 different currents + enable or 3 different currents inkl. enable can be used through the 4052 multiplexer.

If annyone wants a schematic, ill upload one :-P
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #5 on: March 04, 2015, 08:52:50 pm »
I think it should be a good idea to keep track of the progression on the breadboard, so i cobbled the two board files together into one schematic.
And you should be able to understand my ramblings better if they are backed up with a pretty picture:

http://shiosai.de/gallery3/var/albums/Electronics/schematic.jpg?m=1425501961

On GPIO6 and GPIO7 the CY7C65213 report the current state of the USB interface.
That output is used to control the charge current of the MCP73833.

Of course, in this configuration it will draw slightly more current then allowed with the selected resistors, because of the LEDs and supply current of the ICs.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #6 on: March 05, 2015, 06:12:25 pm »
Next step, protection against over discharge, over charge, battery capacity aproximation and discharge current/voltage sensing, using the Maxim DS2764 and a IRF7324 dual p-channel mostfet.
The FET Rds-on is not the best but it is the best i could source, at least i hope i selected the right FET for the job.



The DS2764 has one neat feature, you can disable the load through I2C and enable the load with a button.
This comes in handy when cell the is neary depleted, a connencted µC can monitor the voltage and disconnect itself and the whole circuit from the battery reduce the drain to just a few µA.

On the other side, if no powersaving features are used a auto-off feature is easily implemented. This will eliminate the need to for a additional self sustaining soft on circuit (or whatever the corrent english translation for this is :)).
But this requires some sort of I2C communication.
The DS2764 adress is set though a I2C command, this should ensure that a address conflict should not happen.



To test everything there are two additional items on the breadboard, a ATMegs328p and a SSD1306 OLED display.
The remaining components on the DS2764 have to be populated but (this is happening too much) i dit not tell annyone im waiting for a package and noone told me that i am alone... just aout heard the delivery driver when he was leaving.
Oh... the thingy in the upper right is a LM75B harsh emi enviroment temperature sensor, just irgnore that for now :)

Annyone still interested in further updates? :-P
 

Offline marshallh

  • Supporter
  • ****
  • Posts: 1462
  • Country: us
    • retroactive
Re: One Lithium battery to rule them all.
« Reply #7 on: March 05, 2015, 07:10:23 pm »
I bought something similar a while back, though its much cheaper and only provides 5V output, and charging is very slow (200mA or so)

Verilog tips
BGA soldering intro

11:37 <@ktemkin> c4757p: marshall has transcended communications media
11:37 <@ktemkin> He speaks protocols directly.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #8 on: March 05, 2015, 09:06:29 pm »
I bought something similar a while back, though its much cheaper and only provides 5V output, and charging is very slow (200mA or so)

Yea, this could be done much, much simpler indeed... :)



I bodged two 1206 on each 0805 pad, could not wait till tomorrow, to get the correct resistance...
I grabbed a library of the internet wich i was relatively shure worked, at first it dit not but i expected as much with these horrible long breadboard wires but... behold.
After a bit of poking and proding i finally got was was requested from the chip on the UART.
Next i connected a 15Ohm 10% power resistor across the battery pack output and...

Code: [Select]
               Voltage: 3801
               Current: 220.0
   Accumulated Current: -8179
                Temp F: 79.5
          Power On Ind: ON
      Battery Capacity: 10
            Sleep Mode: Disabled
        Voltage Status: 1
         Charge Status: 1
           Charging is: ON
           Charging is: Enabled
      Discharge Status: 1
        Discharging is: ON
        Discharging is: Enabled
              Power is: ON

The measured current is 220mA and it should be 3,8V / 15Ohm = 250mA but that is close enough to prove that it somewhat works for now :)
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #9 on: March 06, 2015, 04:37:45 pm »
Looks like, i will talk to myself a bit more :)
Im fairly stupid... there was a bit of a mix up how i wired this thing.
This is the corrected schematic, the current reading is still slightly off... either i fried something (but i do not know how, it was wired wrong but not in a "bad" kind of way) or...
I have to investigate this further.



And how it looks, right now it sits on my bench connected to a cellphone charger with 1A charge current, charger detection seems to work fine.
Next step, output disconnect/load sharing circuitry...

 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #10 on: March 06, 2015, 08:10:03 pm »
For now, i declare victory... at least it seem to work like i intendet it to.

http://shiosai.de/gallery3/var/albums/Electronics/board%203.jpg?m=1425672496

The i keep my seperate board files up to date, but the "what is on the breadboard" schematic may still include some errors.

http://shiosai.de/gallery3/var/albums/Electronics/schematic%202.png?m=1425672495

Now the LDO will get replaced with the 3.3V LTC Buck-Boost regulator...
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: One Lithium battery to rule them all.
« Reply #11 on: March 07, 2015, 02:57:30 am »
I've picked up something like this at Five Below (a $5 or less store)

[img]http://static.bfads.net/size/250x250f/a/1481/i_Five-Below-2014-Portable-Rechargeable-Battery-BFAds-1415344697.jpg[/im]

It has a single 18650 battery inside (but cut-outs for 2) and it charges from USB and can power USB.  The board looks exactly like the one you showed in one of the pictures.
The larger the government, the smaller the citizen.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: One Lithium battery to rule them all.
« Reply #12 on: March 08, 2015, 02:57:18 pm »
Quote from: Stonent on March 07, 2015, 01:57:30 PM
I've picked up something like this at Five Below (a $5 or less store)
(...)
It has a single 18650 battery inside (but cut-outs for 2) and it charges from USB and can power USB.


The genuine sony and panasonic cells i bought were $7 a piece for 2900mA and 2000mA, of course i could have dismantled old laptop batteries.
I bought two different of these cheap chinese "boost regulators" and... well, have a look at that output.



Of course that might be a fluke and there will be regulators out there wich work better...
But i guess you are right, i can buy something like this way cheaper, convinient and easy.

Annyway... time for some voltage regulation, the LTC3440 buck boost runs at about 70% efficiency with a load of 100µA when the PFM mode is engaged.
That has to be good enough for now.

There are two INA226 shunt current monitors as well wich will be used for a bit of automated testing later on.

http://shiosai.de/gallery3/var/albums/Electronics/ina.jpg?m=1425826102

The layout for the LTC3440 is not that good but is works as intendet without too much noise.
http://shiosai.de/gallery3/var/albums/Electronics/ltc3440.jpg?m=1425826102

But the next board iteration is allready done, and the schematic has a few addional components as suggested by the datasheet to get a wider input voltage range and better stability. And a much smaller inductor will be used.
 

Offline marizo

  • Newbie
  • Posts: 1
Re: One Lithium battery to rule them all.
« Reply #13 on: April 26, 2015, 07:21:47 pm »
Thanks PeterFW for thread..
Few weeks ago I received ESP8266 WiFi module (It's my first 3.3v supply device). There is no problems using step down linear voltage regulator from 5V DC, but I want to make some temperature, PIR motion or reed switch sensors powered by 5V mini/micro USB and Li ion cell as backup. E-bay was lack of dc-dc buck-boost converters 2,5-5,5 to 3,3V about 0,5A. I was surprised - nobody's using Li-ion cells for powering 3.3v devices!? Searched around TI, LT and also come to LTC3440, because it's package.
My idea was simpler - only Li-ion charger/protection module (TP4056, DW01-P) from e-bay and DC-DC buck-boost, but unfortunately there can't be any load connected to that charger module while charging..
So I'm interested in updates of Your project.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf