I have two SparkFun ESP32 Things. They were $20 each and have onboard 3.7v battery charging. It's amazing - if I'm near a USB port, I plug it in and it charges while the Thing runs. If I unplug it, the Thing still runs.
Now, I have a few projects that would work well on a 3.3v Pro Mini. I bought a bunch from China at $1.64 each. I'd love to do a similar battery setup with that, so naturally I searched for a I'm having trouble finding many options out there. Most seem to be around $20 and possibly overkill. The other end of the spectrum is cheap and questionable.
Do any of you have advice on what to look for to add basic, single sell Lithium/LiPo charging to standard Arduinos?
Look for TP4056 modules on eBay, very cheap, I bough 10 for £2 delivered recently.
USB in for charging.
You need to ensure the charging resistor is a suitable value for the capacity of the actual battery. As standard the modules may have a 1A charge rate which is not suitable for a lot of LiPos.
Some TP4056 modules have OUT +/- and some don't. Is it safe to assume that the ones with OUT are the only ones that will allow the automatic switching between battery power and USB? (leaving it plugged into project)
You can use the (cheaper) ones without the automatic switching as long as the charge current is a little over what the circuit takes, and that current is within sensible limits for the battery.
The battery will charge (even if some of the current is used buy the project) and the charge IC will prevent the battery overcharging since it will limit the charge voltage to 4.2V\4.1V
ok, I found some inexpensive ones with the OUT +/- holes.
I read that some of the cheaper ones sometimes don't cut off the charge at 4.2. Is this generally a simple one-time test? For instance, can I hook up a volt meter, monitor the battery, and as long as it stops charging at 4.2, then I'm good to go?
keith204:
ok, I found some inexpensive ones with the OUT +/- holes.
I read that some of the cheaper ones sometimes don't cut off the charge at 4.2. Is this generally a simple one-time test? For instance, can I hook up a volt meter, monitor the battery, and as long as it stops charging at 4.2, then I'm good to go?
All the cheap (20P) ones I have tested do charge the battery as expected.
If it stops charging at circa 4.2V then thats OK.
However, it does depend on the situation, if this was a commercial\industrial application you would be insane to use a 20p charger from eBay as a safety critical part of the product.
keith204:
ok, I found some inexpensive ones with the OUT +/- holes.
I read that some of the cheaper ones sometimes don't cut off the charge at 4.2. Is this generally a simple one-time test? For instance, can I hook up a volt meter, monitor the battery, and as long as it stops charging at 4.2, then I'm good to go?
I don't think the ones with the separate OUT and BATT connections actually switch between battery and USB power. The difference is that the ones with separate OUT connections have the battery protection circuit on the module's PCB, and the ones without the separate terminals do not. Which one you decide to use will depend on if your battery has the protection circuit built into it. You only want one circuit protecting the battery, because I believe 2 of them connected to the same battery will not play nice with each other. However, whether it's on the battery or the module, you must have a protection circuit. Lithium cells can catch fire if they are abused.
You can just connect the battery to the load, but because the charger is current limited it will take charging current away from the battery, making it take longer to charge.
The better solution is to connect both the battery and USB connector to the load (and USB to the battery charger) and have a circuit decide where power can come from. There's a few ways to do this:
A diode in series with the battery. This is the cheapest and simplest method, but also introduces a voltage loss and wastes power in the diode.
A comparator+MOSFET solution like what's used on the Uno and Mega boards that uses a P-MOSFET to block USB power when something is connected to VIN, but when VIN is disconnected lets power in from USB.