Building battery charger, can't figure out where pwm fet should be??

Papabravo

Joined Feb 24, 2006
21,225
Well it is a bit hard to satisfy your request when you show up with one or more preconceived notions and say "here make it work". People tell you what might be wrong with your original ideas, but you don't want to hear that. You just want the solution you expect and never mind the facts or the physics or the risks involved. Your knowledge needs to catch up with your expectations, and that problem cannot be solved in a forum post or even a pile of forum posts. You might start by saying "here are my requirements, what kind of solutions should I consider?"
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
What I don't want to hear is "go buy a charger" or "scrap this project and do something else" and "you're going to kill yourself". So far other than the level shift no ideas or useful advice has been given. If you want me to research circuit designs and come back at least give me some keywords or a link!
 

Lestraveled

Joined May 19, 2014
1,946
Rudy (and everyone else) lighten up
To build the kind of charger you are talking about requires a skill level that you have not demonstrated to the forum. Because of this, you should expect the "buy a charger" or "do something else" comments. If you really want to build a smart charger, show us something more than an elementary "stick figure" design. Papabravo gave some great links to battery charger links. Look at them. Read them.

Here is my favorite battery charger link. I have made a lot of chargers using this chip.

http://www.ti.com/product/bq2031
 

MCU88

Joined Mar 12, 2015
358
Off-the-shelf solutions are often chosen in real world. They maybe cheaper. They maybe better. They maybe both.

Battery chargers are cheap. Where is the incentive to engineer your own? I personally would buy an commercial charger on eBay.
 

Roderick Young

Joined Feb 22, 2015
408
Seems to me that your original schematic 1.png would be fine. You would simply monitor the voltage at the negative terminal of the battery, and in software, calculate that the battery voltage is (20 - reading voltage). If you want to measure the top of the battery to make sure it's really 20 volts, you could do that, too. If the A/D converters on your PIC only go up to (say) 5 volts full scale, then use two-resistor voltage dividers to scale the voltage down to something you can read. My apologies if I'm not being clear, but I have an errand to run at the moment and can't sketch it out. Maybe someone else can, or I can come back later?
 

AnalogKid

Joined Aug 1, 2013
11,048
A basic problem with the original question is using a 20 A source for a 300 mAh problem. Yes, a *true* buck regulator will work, but only with all of those extra parts not even hinted at in the original post. Also, #12's level shift approach was correct with the tiny bit of information you chose to share with us at that time, but now that we know the vast difference between your source and load, anything without more complexity won't work. And yes, I have heard of switching power supplies. Have you heard of the complexities of Li battery chemistry?

Do you plan to use a LiPo charge controller, or just wing it? The simplest approach is to junk all of the silicon and use a relay and a resistor. It is just slightly less dangerous than nothing.

ak
 

Roderick Young

Joined Feb 22, 2015
408
Ok, I'm back. Here is what I meant
HPIM2241.gif
You would take your voltage reading with the MOSFET off, of course.

If you're charging some kind of Li chemistry, I encourage you to go for it as a learning experience. There's no reason why it shouldn't work if you read that battery's spec sheet carefully and follow charging recommendations with your circuit. Try to charge at a low rate, like C/20 or C/10, for initial experiments, and work your way up later as everything is brought up. Will you be putting a temperature sensor on the batteries?
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
Ok, I'm back. Here is what I meant
View attachment 82127
You would take your voltage reading with the MOSFET off, of course.

If you're charging some kind of Li chemistry, I encourage you to go for it as a learning experience. There's no reason why it shouldn't work if you read that battery's spec sheet carefully and follow charging recommendations with your circuit. Try to charge at a low rate, like C/20 or C/10, for initial experiments, and work your way up later as everything is brought up. Will you be putting a temperature sensor on the batteries?

Thanks for the advice. I have actually been working with these batteries for almost 10 years so I'm very familiar with the charging process and associated dangers. However the picmicro chip only has one port per adc channel, so would I have to use an external adc chip?
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
Thanks for the advice. I have actually been working with these batteries for almost 10 years so I'm very familiar with the charging process and associated dangers. However the picmicro chip only has one port per adc channel, so would I have to use an external adc chip?
It does have a voltage reference pin though I'll have to do some research.
 

Roderick Young

Joined Feb 22, 2015
408
Thanks for the advice. I have actually been working with these batteries for almost 10 years so I'm very familiar with the charging process and associated dangers. However the picmicro chip only has one port per adc channel, so would I have to use an external adc chip?
A single adc channel should be enough, as long as you can route the adc to different pins to take readings. Let's say that the voltage divider for the +20V supply was connected to pin A, and the voltage divider for the bottom of the battery was connected to pin B. Then in software, you would first make sure that the MOSFET was off, then read the voltage on pin A, then read the voltage on pin B, then perform a subtraction in software. If the PIC processor that you chose does not have enough free pins, then you could choose a different model of PIC.
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
A single adc channel should be enough, as long as you can route the adc to different pins to take readings. Let's say that the voltage divider for the +20V supply was connected to pin A, and the voltage divider for the bottom of the battery was connected to pin B. Then in software, you would first make sure that the MOSFET was off, then read the voltage on pin A, then read the voltage on pin B, then perform a subtraction in software. If the PIC processor that you chose does not have enough free pins, then you could choose a different model of PIC.
What's been happening is when the mosfet is off there's no ground reference for the adc, and the voltage measured at both points is basically random, getting readings from 2 to 18 volts unless mosfet is on, then it's accurate to about 0.1 volts. I'm going to do some testing to make sure everything is working correctly.
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
OK got it figured out, one bad connection was scrambling my results. So far everything is working fine, though I'm using a dummy load until I make sure the charger is reliable, and will always closely monitor it while charging actual lithium batteries.
 
Top