One Lithium battery to rule them all. - Page 1
Forum section: electronics / projects

author: PeterFW
author_rank: Frequent Contributor
timestamp: February 25, 2015, 12:00:43 am
content: 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.3VLinear LTC3440 buck-boost regulatorhttp://www.linear.com/product/LTC34405VMicrochip MCP1640 boost regulatorhttp://www.microchip.com/MCP1640417196612VNot shure yetLiIo protection and fuel gaugeMaxim DS2764 with IRF7324 p-channel mosfethttp://www.maximintegrated.com/en/products/power/battery-management/DS2764.htmlhttp://www.irf.com/part/_/A~IRF73245V input LiIo ChargerMicrochip MCP73833http://www.microchip.com/MCP73833Charge current selectionCypress CY7C65213 USB Serial interface with charger detecthttp://www.cypress.com/?mpn=CY7C65213-32LTXIAnalog 4052 multiplexerI dont think i have to link this oneYes, 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 experienceI bet i allready have made a few big mistakes wich will bite my in the arse big time...Greetings,Peter

author: tautech
author_rank: Super Contributor
timestamp: February 25, 2015, 11:14:11 am
content: 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.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 25, 2015, 02:25:08 pm
content: 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...

author: PeterFW
author_rank: Frequent Contributor
timestamp: February 25, 2015, 04:52:36 pm
content: Quote from: tautech on February 25, 2015, 11:14:11 amI 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...QuoteFor now my main concern are digital circuits, i have some ideas about managing that though.QuoteLets 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 deviceQuote from: Siwastaja on February 25, 2015, 02:25:08 pmYes, 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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: March 04, 2015, 08:32:55 pm
content: Quote from: PeterFW on February 25, 2015, 04:52:36 pmThere 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 expectedThe 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 Suspend100mA - non enumerated USB connection500mA - enumerated USB connection1,5A - dedicated charging portThe 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

author: PeterFW
author_rank: Frequent Contributor
timestamp: March 04, 2015, 08:52:50 pm
content: 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=1425501961On 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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: March 05, 2015, 06:12:25 pm
content: 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 nowAnnyone still interested in further updates? :-P

author: marshallh
author_rank: Unknown
timestamp: March 05, 2015, 07:10:23 pm
content: I bought something similar a while back, though its much cheaper and only provides 5V output, and charging is very slow (200mA or so)

author: PeterFW
author_rank: Frequent Contributor
timestamp: March 05, 2015, 09:06:29 pm
content: Quote from: marshallh on March 05, 2015, 07:10:23 pmYea, 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:Voltage: 3801Current: 220.0Accumulated Current: -8179Temp F: 79.5Power On Ind: ONBattery Capacity: 10Sleep Mode: DisabledVoltage Status: 1Charge Status: 1Charging is: ONCharging is: EnabledDischarge Status: 1Discharging is: ONDischarging is: EnabledPower is: ONThe 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

author: PeterFW
author_rank: Frequent Contributor
timestamp: March 06, 2015, 04:37:45 pm
content: Looks like, i will talk to myself a bit moreIm 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...

author: PeterFW
author_rank: Frequent Contributor
timestamp: March 06, 2015, 08:10:03 pm
content: 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=1425672496The 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=1425672495Now the LDO will get replaced with the 3.3V LTC Buck-Boost regulator...

author: Stonent
author_rank: Super Contributor
timestamp: March 07, 2015, 02:57:30 am
content: I've picked up something like this at Five Below (a $5 or less store)http://static.bfads.net/size/250x250f/a/1481/i_Five-Below-2014-Portable-Rechargeable-Battery-BFAds-1415344697.jpgIt 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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: March 08, 2015, 02:57:18 pm
content: Quote from: Stonent on March 07, 2015, 01:57:30 PMThe 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=1425826102The 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=1425826102But 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.

author: marizo
author_rank: Newbie
timestamp: April 26, 2015, 07:21:47 pm
content: 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 - onlyLi-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.