Post Top Ad

Saturday, April 8, 2023

on video Top 3 useful/must-have circuit for 3.7v li-ion battery




THE FRIENDLY NEIGHBORHOOD CHARGER

There’s a whole bunch of ways to charge the cells you’ve just added to your device – a wide variety of charger ICs and other solutions are at your disposal. I’d like to focus on one specific module that I believe it’s important you know more about.


You likely have seen the blue TP4056 boards around – they’re cheap and you’re one Aliexpress order away from owning a bunch, with a dozen boards going for only a few bucks. The TP4056 is a LiIon charger IC able to top up your cells at rate of up to 1 A. Many TP4056 boards have a protection circuit built in, which means that such a board can protect your LiIon cell from the external world, too. This board itself can be treated as a module; for over half a decade now, the PCB footprint has stayed the same, to the point where you can add a TP4056 board footprint onto your own PCBs if you need LiIon charging and protection. I do that a lot – it’s way easier, and even cheaper, than soldering the TP4056 and all its support components. Here’s a KiCad footprint if you’d like to do that too.

This is a linear charger IC – if you want 1 A out, you need 1 A in, and the input-output voltage difference multiplied by current is converted into heat. Thankfully, the TP4056 modules are built to handle high temperatures reasonably well, and you can add a heatsink if you want. Maximum charging current is set by a resistor between ground and one of the pins, default resistor being 1.2 kΩ resulting in 1 A current; for low-capacity cells, you can replace it with a 10 kΩ resistor to set a 130 mA limit, and you can find tables online for intermediate values.


There’s some cool things about the TP4056 IC that most people don’t know about if they’re using the modules as-is. The IC’s CE pin is hardwired to 5 V VIN, but if you lift that pin, you can use it to disable and enable charging with a logic level input from your MCU. You can monitor the charging current by connecting your MCU’s ADC to the PROG pin – the same pin used for the current setting resistor. There’s also a thermistor pin, typically wired to ground, but adaptable for a wide range of thermistors using a resistor divider, whether it’s the thermistor attached to your pouch cell or one you added externally to your 18650 holder.

There’s problems with the TP4056 too – it’s a fairly simple IC. Efficiency isn’t an imperative where wall power is available, but the TP4056 does waste a decent bit of power as heat. A switching charger-based module avoids that, and often also lets you charge at higher currents if ever required. Connecting a cell in reverse kills the chip, and the protection circuit too – this mistake is easy to make, I’ve done that aplenty, and this is why you need spares. If you reverse the cell contacts, throw the board out – don’t charge your cells with a faulty IC.


Also, given the TP4056’s popularity, copies of this IC are manufactured by multiple different chip vendors in China, and I’ve observed that some of these copy ICs break more easily than others, for instance, no longer charging your cells – again, keep spares. The TP4056 also doesn’t provide charging timers like other, more modern ICs do – a subject we touched upon in the comment section of the first article.


All in all, these modules are powerful and fairly universal. It’s even safe to use them to charge 4.3 V cells, as due to the CC/CV operation, the cell simply won’t charge to its full capacity – prolonging your cell’s life as a side effect. When you need to go beyond such modules, there’s a myriad of ICs you can make use of – smaller linear chargers, switching chargers, chargers with built-in powerpath and/or DC-DC regulator features, and a trove of ICs that do LiIon charging as a side effect. The world of LiIon charger ICs is huge and there’s way more to it than the TP4056, but the TP4056 is a wonderful starting point.


THE PROTECTION CIRCUIT YOU WILL SEE EVERYWHERE

Just like with charging ICs, there’s many designs out there, and there’s one you should know about – the DW01 and 8205A combination. It’s so ubiquitous that at least one of your store-bought devices likely contains it, and the TP4056 modules come with this combo too. The DW01 is an IC that monitors the voltage of your cell and the current going to and from it, and the 8205A is two N-FETs in a single package, helping with the actual “connect-disconnect the battery” part. There’s no additional current sensing resistor – instead, the DW01 monitors voltage across the 8205A junction. In other words, the same FETs used to cut the cell from the outside world in case of failure, are used as current sensing resistors. This design is cheap, prevalent, and works wonders.

The DW01 protects from overcurrent, overdischarge and overcharge – the first two happen relatively often in hobby projects, and that last one’s handy if your charger ever goes rogue. If something wrong happens, it interrupts the connection between the cell’s negative terminal and GND of your circuit, in other words, it does low-side switching – for a simple reason, FETs that interrupt GND are cheaper and have lower resistance. We’ve also seen some hacks done with this chip – for instance, we’ve covered research from a hacker who figured out that the DW01 can be used as a soft power switch for your circuit – in a way that doesn’t compromise on safety. You only need to connect a GPIO pin of your MCU to the DW01, preferably through a diode – this comment describes an approach that seems pretty failure-resistant to me.


When you first connect a LiIon cell to the DW01+8205A combination, sometimes it will enable its output, but sometimes it won’t. For instance, if you have a holder for 18650s and a protection circuit connected to it, it’s a 50/50 chance that your circuit will power up once you insert the battery. The solution is simple – either connect a charger externally, or short-circuit the OUT- and B- with something metal (I often add an external button), but it’s annoying to deal with. Just like TP4056, the DW01+8205A combo dies if you connect the battery in reverse. Also, the DW01 is internally wired for 2.5 V overdischarge cutoff, which technically isn’t changeable. If you don’t have a separate software-controlled cutoff, the FS312 is a pin-compatible DW01 replacement with 3.0 V overdischarge point, helping you prolong your cell’s life.


You can buy a batch of ready-to-go protection circuit modules, or just use the protection circuit laid out on the TP4056 module PCB. You can also accumulate a decent stock of protection circuits by taking them out of single-cell batteries whenever the cell puffs up or dies – take caution not to puncture the cell while you do it, please.


ALL THE WAYS TO GET 3.3 V

For a 4.2 V LiIon cell, the useful voltage range is 4.1 V to 3.0 V – a cell at 4.2 V quickly drops to 4.1 V when you draw power from it, and at 3.0 V or lower, the cell’s internal resistance typically rises quickly enough that you will no longer get much useful current out of your cell. If you want to get to 1.8 V or 2.5 V, that is not a problem, and if you want to get to 5 V, you’ll use a boost regulator of some sort. However, most of our chips still run at 3.3 V – let’s see what our options are here.

When it comes to LiIon range to 3.3 V regulation, linear regulators closely trail switching regulators in terms of efficiency, often have lower quiescent (no-load) current if you seek low-power operation, and lower noise if you want to do analog stuff. That said, your regular 1117 won’t do – it’s an old and inefficient design, and the 1117-33 starts grinding its gears at about 4.1 V. Instead, use pin-compatible, low dropout voltage replacements like AP2111, AP2114 and BL9110, or AP2112, MIC5219, MCP1700 and ME6211 if you’re okay with SOT23 stuff. All of these are linear regulators comfortable providing 3.3 V with input down to 3.5 V and sometimes even 3.4 V, if you’d like to power something like an ESP32. It’s hard to deny the simplicity of using a linear regulator – one chip and a few caps is all it takes.


If you want 500 mA to 1000mA or even more current on an ongoing basis, a switching regulator will be your best friend. My personal favourite is PAM2306 – this regulator is used on the Raspberry Pi Zero, it’s very cheap and accessible, and even has two separate output rails. Given its capability to do 100% duty cycle operation, it can extract a lot of juice out of your cells, often desirable for higher-power projects where runtime matters. And hey, if you got Pi Zero with a dead CPU, you won’t go wrong snipping a part of the PCB off and soldering some wires to it. When designing your own board, use datasheet recommendations for inductor parameters if the whole “picking the right inductor” business has you confused.


So, the PAM2306 is the regulator on the Pi Zero, and it’s also LiIon-friendly? Yep, you can power a Pi Zero directly from a LiIon battery, as all the onboard circuitry works down to 3.3 V on the “5 V” pins. I’ve tested it extensively in my own devices, and it even works with the Pi Zero 2 W. Combined with this powerpath and a charger, you have a complete “battetery, as all the onboard circuitry works down to 3.3 V on the “5 V” pins. I’ve tested it extensively in my own devices, and it even works with the Pi Zero 2 W. Combined with this powerpath and a charger, you have a complete “battery-powered Linux” package, with all the oomph that a Raspberry Pi provides – at cost of only a handful of components. One problem to watch out for is that MicroUSB port VBUS will have battery voltage – in other words, you’re best off filling the MicroUSB ports with hot glue just in case someone plugs a MicroUSB PSU there, and tapping the USB data testpoints for USB connectivity.

A POWER PATH TO JOIN THEM ALL

Now, you’ve got charging, and you got your 3.3 V. There’s one problem that I ought to remind you about – while you’re charging the battery, you can’t draw current from it, as the charger relies on current measurements to control charging; if you confuse the charger with an extra load, you risk overcharging the battery. Fortunately, since you have a charger plugged in, you must have 5 V accessible. It’d be cool if you could power your devices from that 5 V source when it’s present, and use the battery when it’s not! We typically use diodes for such power decisions, but that’d cause extra voltage drop and power losses when operating from the battery. Thankfully, there’s a simple three-component circuit that works way better.




THE FRIENDLY NEIGHBORHOOD CHARGER

There’s a whole bunch of ways to charge the cells you’ve just added to your device – a wide variety of charger ICs and other solutions are at your disposal. I’d like to focus on one specific module that I believe it’s important you know more about.


You likely have seen the blue TP4056 boards around – they’re cheap and you’re one Aliexpress order away from owning a bunch, with a dozen boards going for only a few bucks. The TP4056 is a LiIon charger IC able to top up your cells at rate of up to 1 A. Many TP4056 boards have a protection circuit built in, which means that such a board can protect your LiIon cell from the external world, too. This board itself can be treated as a module; for over half a decade now, the PCB footprint has stayed the same, to the point where you can add a TP4056 board footprint onto your own PCBs if you need LiIon charging and protection. I do that a lot – it’s way easier, and even cheaper, than soldering the TP4056 and all its support components. Here’s a KiCad footprint if you’d like to do that too.

This is a linear charger IC – if you want 1 A out, you need 1 A in, and the input-output voltage difference multiplied by current is converted into heat. Thankfully, the TP4056 modules are built to handle high temperatures reasonably well, and you can add a heatsink if you want. Maximum charging current is set by a resistor between ground and one of the pins, default resistor being 1.2 kΩ resulting in 1 A current; for low-capacity cells, you can replace it with a 10 kΩ resistor to set a 130 mA limit, and you can find tables online for intermediate values.


There’s some cool things about the TP4056 IC that most people don’t know about if they’re using the modules as-is. The IC’s CE pin is hardwired to 5 V VIN, but if you lift that pin, you can use it to disable and enable charging with a logic level input from your MCU. You can monitor the charging current by connecting your MCU’s ADC to the PROG pin – the same pin used for the current setting resistor. There’s also a thermistor pin, typically wired to ground, but adaptable for a wide range of thermistors using a resistor divider, whether it’s the thermistor attached to your pouch cell or one you added externally to your 18650 holder.

There’s problems with the TP4056 too – it’s a fairly simple IC. Efficiency isn’t an imperative where wall power is available, but the TP4056 does waste a decent bit of power as heat. A switching charger-based module avoids that, and often also lets you charge at higher currents if ever required. Connecting a cell in reverse kills the chip, and the protection circuit too – this mistake is easy to make, I’ve done that aplenty, and this is why you need spares. If you reverse the cell contacts, throw the board out – don’t charge your cells with a faulty IC.


Also, given the TP4056’s popularity, copies of this IC are manufactured by multiple different chip vendors in China, and I’ve observed that some of these copy ICs break more easily than others, for instance, no longer charging your cells – again, keep spares. The TP4056 also doesn’t provide charging timers like other, more modern ICs do – a subject we touched upon in the comment section of the first article.


All in all, these modules are powerful and fairly universal. It’s even safe to use them to charge 4.3 V cells, as due to the CC/CV operation, the cell simply won’t charge to its full capacity – prolonging your cell’s life as a side effect. When you need to go beyond such modules, there’s a myriad of ICs you can make use of – smaller linear chargers, switching chargers, chargers with built-in powerpath and/or DC-DC regulator features, and a trove of ICs that do LiIon charging as a side effect. The world of LiIon charger ICs is huge and there’s way more to it than the TP4056, but the TP4056 is a wonderful starting point.


THE PROTECTION CIRCUIT YOU WILL SEE EVERYWHERE

Just like with charging ICs, there’s many designs out there, and there’s one you should know about – the DW01 and 8205A combination. It’s so ubiquitous that at least one of your store-bought devices likely contains it, and the TP4056 modules come with this combo too. The DW01 is an IC that monitors the voltage of your cell and the current going to and from it, and the 8205A is two N-FETs in a single package, helping with the actual “connect-disconnect the battery” part. There’s no additional current sensing resistor – instead, the DW01 monitors voltage across the 8205A junction. In other words, the same FETs used to cut the cell from the outside world in case of failure, are used as current sensing resistors. This design is cheap, prevalent, and works wonders.

The DW01 protects from overcurrent, overdischarge and overcharge – the first two happen relatively often in hobby projects, and that last one’s handy if your charger ever goes rogue. If something wrong happens, it interrupts the connection between the cell’s negative terminal and GND of your circuit, in other words, it does low-side switching – for a simple reason, FETs that interrupt GND are cheaper and have lower resistance. We’ve also seen some hacks done with this chip – for instance, we’ve covered research from a hacker who figured out that the DW01 can be used as a soft power switch for your circuit – in a way that doesn’t compromise on safety. You only need to connect a GPIO pin of your MCU to the DW01, preferably through a diode – this comment describes an approach that seems pretty failure-resistant to me.


When you first connect a LiIon cell to the DW01+8205A combination, sometimes it will enable its output, but sometimes it won’t. For instance, if you have a holder for 18650s and a protection circuit connected to it, it’s a 50/50 chance that your circuit will power up once you insert the battery. The solution is simple – either connect a charger externally, or short-circuit the OUT- and B- with something metal (I often add an external button), but it’s annoying to deal with. Just like TP4056, the DW01+8205A combo dies if you connect the battery in reverse. Also, the DW01 is internally wired for 2.5 V overdischarge cutoff, which technically isn’t changeable. If you don’t have a separate software-controlled cutoff, the FS312 is a pin-compatible DW01 replacement with 3.0 V overdischarge point, helping you prolong your cell’s life.


You can buy a batch of ready-to-go protection circuit modules, or just use the protection circuit laid out on the TP4056 module PCB. You can also accumulate a decent stock of protection circuits by taking them out of single-cell batteries whenever the cell puffs up or dies – take caution not to puncture the cell while you do it, please.


ALL THE WAYS TO GET 3.3 V

For a 4.2 V LiIon cell, the useful voltage range is 4.1 V to 3.0 V – a cell at 4.2 V quickly drops to 4.1 V when you draw power from it, and at 3.0 V or lower, the cell’s internal resistance typically rises quickly enough that you will no longer get much useful current out of your cell. If you want to get to 1.8 V or 2.5 V, that is not a problem, and if you want to get to 5 V, you’ll use a boost regulator of some sort. However, most of our chips still run at 3.3 V – let’s see what our options are here.

When it comes to LiIon range to 3.3 V regulation, linear regulators closely trail switching regulators in terms of efficiency, often have lower quiescent (no-load) current if you seek low-power operation, and lower noise if you want to do analog stuff. That said, your regular 1117 won’t do – it’s an old and inefficient design, and the 1117-33 starts grinding its gears at about 4.1 V. Instead, use pin-compatible, low dropout voltage replacements like AP2111, AP2114 and BL9110, or AP2112, MIC5219, MCP1700 and ME6211 if you’re okay with SOT23 stuff. All of these are linear regulators comfortable providing 3.3 V with input down to 3.5 V and sometimes even 3.4 V, if you’d like to power something like an ESP32. It’s hard to deny the simplicity of using a linear regulator – one chip and a few caps is all it takes.


If you want 500 mA to 1000mA or even more current on an ongoing basis, a switching regulator will be your best friend. My personal favourite is PAM2306 – this regulator is used on the Raspberry Pi Zero, it’s very cheap and accessible, and even has two separate output rails. Given its capability to do 100% duty cycle operation, it can extract a lot of juice out of your cells, often desirable for higher-power projects where runtime matters. And hey, if you got Pi Zero with a dead CPU, you won’t go wrong snipping a part of the PCB off and soldering some wires to it. When designing your own board, use datasheet recommendations for inductor parameters if the whole “picking the right inductor” business has you confused.


So, the PAM2306 is the regulator on the Pi Zero, and it’s also LiIon-friendly? Yep, you can power a Pi Zero directly from a LiIon battery, as all the onboard circuitry works down to 3.3 V on the “5 V” pins. I’ve tested it extensively in my own devices, and it even works with the Pi Zero 2 W. Combined with this powerpath and a charger, you have a complete “battetery, as all the onboard circuitry works down to 3.3 V on the “5 V” pins. I’ve tested it extensively in my own devices, and it even works with the Pi Zero 2 W. Combined with this powerpath and a charger, you have a complete “battery-powered Linux” package, with all the oomph that a Raspberry Pi provides – at cost of only a handful of components. One problem to watch out for is that MicroUSB port VBUS will have battery voltage – in other words, you’re best off filling the MicroUSB ports with hot glue just in case someone plugs a MicroUSB PSU there, and tapping the USB data testpoints for USB connectivity.

A POWER PATH TO JOIN THEM ALL

Now, you’ve got charging, and you got your 3.3 V. There’s one problem that I ought to remind you about – while you’re charging the battery, you can’t draw current from it, as the charger relies on current measurements to control charging; if you confuse the charger with an extra load, you risk overcharging the battery. Fortunately, since you have a charger plugged in, you must have 5 V accessible. It’d be cool if you could power your devices from that 5 V source when it’s present, and use the battery when it’s not! We typically use diodes for such power decisions, but that’d cause extra voltage drop and power losses when operating from the battery. Thankfully, there’s a simple three-component circuit that works way better.

No comments:

Post a Comment

Post Top Ad

Pages