Adding a charging circuit to a project.

Status
Not open for further replies.

alialiali

Well-known member
Hi everyone, I want to add a battery and charging to my project. I was looking at a chip like: MCP73831 (http://ww1.microchip.com/downloads/en/DeviceDoc/20001984g.pdf)

Screenshot from 2018-01-16 13-41-24.png

I pasted the typical application, and was just wondering how best to attach this to teensy 3.6

My plan is to take VUSB (TEENSY) and put it in VIN (MCP73831). Then for output to connect VBAT (MCP73831) to VIN (TEENSY). And of course cutting the VUSB/VIN (TEENSY) jumper.

Since I am pretty clueless I looked at the Adafruit Teensy adapter (https://github.com/adafruit/Adafruit-Teensy-3.x-Feather-Adapter-PCB/blob/master/schematic.png) which uses the same chip, but I see that my plan is not what Adafruit appear to do. They seem to just use VIN (Teensy). And I am quite confused now how their circuit even works.

Screenshot from 2018-01-16 13-49-46.png

Screenshot from 2018-01-16 13-50-20.png

This is how Sparkfun do it for a standalone charger (https://cdn.sparkfun.com/datasheets/Prototyping/SparkFun_Lipo_Charger_Basic-microUSB_v10.pdf) , which makes more sense to me, but can't imagine how to hook the Teensy up to this.

Screenshot from 2018-01-16 14-20-35.png

Thanks for any help as always.
 
Last edited:
Note, I'm a software guy, so I can't help with the detailed electronics.

There are two approaches that I've seen for adding a charger to Teensy products using the Teensy USB micro-B connector:
  • You cut the VIN/VUSB trace, hook the Teensy VUSB pin to the VIN of your charger, and connect grounds. You connect the VOUT pin of your charger to the Teensy's VIN pin. Thus the power always goes through the charger. It allows for you to put an on/off switch that will disconnect the Teensy's power whether it comes from battery or USB. One example of this is the onehorse chargers that are designed to be soldered under or over the Teensy directly: https://www.tindie.com/products/onehorse/stbc08-high-current-lipo-battery-charger/.
  • The other approach is the one the Adafruit feather adapter uses. There you hook up the Teensy VIN and ground to the charger. If there is power coming from Teensy's VIN pin, then the charger charges the battery. If there is no charge on Teensy's VIN, the charger then supplies the voltage from the battery. On this one, you do not cut the trace wire between VIN and VUSB.

In a previous thread, I measured the voltages of the two different chargers that the Teensy gets here:

Another Adafruit charger to look at is the Adafruit Pro Trinket Lion/Lipoly backpack charger:
 
Last edited:
Aha! Thank-you very much Michael. The second approach seems easier to me. (I'm not a software or a hardware guy :D)

Note, I'm a software guy, so I can't help with the detailed electronics.

There are two approaches that I've seen for adding a charger to Teensy products using the Teensy USB micro-B connector:
  • You cut the VIN/VUSB trace, hook the Teensy VUSB pin to the VIN of your charger, and connect grounds. You connect the VOUT pin of your charger to the Teensy's VIN pin. Thus the power always goes through the charger. It allows for you to put an on/off switch that will disconnect the Teensy's power whether it comes from battery or USB. One example of this is the onehorse chargers: https://www.tindie.com/products/onehorse/stbc08-high-current-lipo-battery-charger/ that are designed to be soldered under or over the Teensy directly.

In this case charger's VOUT pin is the pin that goes to the battery?

  • The other approach is the one the Adafruit feather adapter uses. There you hook up the Teensy VIN and ground to the charger. If there is power coming from Teensy's VIN pin, then the charger charges the battery. If there is no charge on Teensy's VIN, the charger then supplies the voltage from the battery.

And this would fail if you cut the VUSB/VIN jumper...
 
I'd like to put a plug in for LiPo battery charger add-on for Teensy 3.1 from onehorse. You can look at the plans for another example. It's "appallingly small" and the pinout is designed to fit over a little portion of a Teensy.

onehorse/lipo-battery-charger-add-on-for-teensy-31/ [p#4 link missing a ":"]

Also this higher current charger version Up to 800 mA charge current for larger LiPo support - also "improved with lugs to make the switch more robust and less prone to tearing off"
 
Thanks, I saw the onehorse charger. Seems a very neat circuit. But in the schematic, the Teensy pins are not labelled so I got even more confused.

From the link above:

2014-08-21T01_54_49.161Z-LiPoSchema.jpg
 
Thanks, I saw the onehorse charger. Seems a very neat circuit. But in the schematic, the Teensy pins are not labelled so I got even more confused.

The onehorse board is designed explicitly for the Teensys. If you look at the actual board, and not the schematic, the PCB labels the 3 pins that must be connected (VIN, VUSB, GROUND) on the Teensy (you must cut the VUSB<->VIN trace). You can mount the board under the Teensy or on top, using long male header pins. I tend to mount the charger on top of the Teensy, so that I can mount the Teensy flat on a PCB or breadboard.

I couldn't tell from your original post, whether you were designing your own PCB and wanted to lay out the charger, or if you were doing a one-off board. If you are doing a one-off board, the onehorse charger is pretty good. If you are going to build lots of the board, then doing the layout with the raw chips would be better.
 
May'be this is helpful/inspiring:
I am currently making a PCB for this schematic that I found online:
http://blog.zakkemble.co.uk/a-lithium-battery-charger-with-load-sharing/

That combines a MCP73831 and a fet to create a schematic that can perform loadsharing. Lipo's don't like to charge and provide power simultaneously.
This schematic basically disconnects the battery from the load when USB power is applied. When USB power is removed the schematic switches back to the lipo :)
 
Thanks for all the help everyone. I've sketched some out and sent some small test boards to the fab. As always this community has been great.
 
Status
Not open for further replies.
Back
Top