Author Topic: Sanity check on N/P channel MOSFET's for battery charge/discharge  (Read 2763 times)

0 Members and 1 Guest are viewing this topic.

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: ca
Sanity check on N/P channel MOSFET's for battery charge/discharge
« on: September 11, 2018, 10:52:20 pm »
On to the next phase of my homemade battery charger, I want to confirm my understanding of MOSFET's.



+CHARGE comes from a PWM controlled voltage source that Hero999 and some others helped me figure out.

R10 is a shunt resistor (value still to be determined).

When CHARGE_EN is enabled (pulled low), current will be allowed to flow through the shunt resistor, Q1 and charge the battery. Current is controlled by measuring voltage drop between ADC1/2, and battery voltage is determined by measuring ADC2/ADC3. (In theory ADC3 will be at 0V, but it can't hurt to have this). When disabled, current will not be able to flow backwards into the circuit.

When DISCHARGE_EN is enabled (pulled high), current will be allowed to flow through Q2 to ground. When disabled, no current can flow. (Controlling the amount of current being discharged is still in the "todo" column. I am torn between a simple power resistor (non adjustable load), or with controlling the MOSFET.

Hopefully this is correct - what I took away from reading (and the internal symbol) is that if I had chosen different MOSFET types (N/P), current would still be able to flow even when the MOSFET was turned off.
 

Offline LukeB

  • Contributor
  • Posts: 46
  • Country: au
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #1 on: September 11, 2018, 11:39:04 pm »
Schematic??
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: ca
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #2 on: September 11, 2018, 11:45:17 pm »
It's posted at the top.
 

Offline Sceadwian

  • Supporter
  • ****
  • Posts: 55
  • Country: us
  • Beware those that tell you the way the world is.
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #3 on: September 12, 2018, 12:42:21 am »
Q1 Drain/Source is swapped, that'd be a great smoke generator.
-Because I be, what I be. I would tell you what you want to know if I could, mum, but I be a cat. And no cat anywhere, ever gave anyone a straight answer.-
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: ca
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #4 on: September 12, 2018, 12:51:00 am »
Q1 Drain/Source is swapped, that'd be a great smoke generator.

Does Q1 have to be a P-channel?
 

Offline Sceadwian

  • Supporter
  • ****
  • Posts: 55
  • Country: us
  • Beware those that tell you the way the world is.
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #5 on: September 12, 2018, 01:18:14 am »
No, but you will have gate drive level requirement issues with an N fet depending on how much current is involved because your source voltage will be floating above ground and the source to gate voltage is what turns it on. It depends on the exact VCC you have to work with and the exact FET's you have available.

This is a common high side/low side switching problem with FETs. There are ways around it such as using a photo voltaic isolator but that's pretty exotic.

-Because I be, what I be. I would tell you what you want to know if I could, mum, but I be a cat. And no cat anywhere, ever gave anyone a straight answer.-
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: ca
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #6 on: September 12, 2018, 01:25:24 am »
I see. So I can stick with the P channel, but fix the direction :) I did totally misread the diode inside Q1. Smoke generator indeed!

(an aside, ‎IRFP150MPBF looks like a potential candidate for Q2 (discharge). Apparently used in other electronic loads.)
 

Offline Sceadwian

  • Supporter
  • ****
  • Posts: 55
  • Country: us
  • Beware those that tell you the way the world is.
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #7 on: September 12, 2018, 01:51:18 am »
Pmos is fine for this.

I'm guessing with the ADC net you have listed there that this will be micro controller driven? I'm going to assume until you correct me that you'll be sensing the current with the MCU which will be controlling the voltage? For proper current control you're going to want an opamp in the current sense loop or you're not going to have adequate control over it. Typically you'd use an opamp to drive the gate and feed the opamp a voltage from a DAC that will set the desired current, relying on the MCU to control the current via controlling the +charge voltage would very likely not be stable.

But I'm just guessing there.

A better idea of what you're doing here would be helpful. And be damn careful with that discharge enable line, you screw up and turn both of those fets on at the same time on accident and more magic smoke happens :)
-Because I be, what I be. I would tell you what you want to know if I could, mum, but I be a cat. And no cat anywhere, ever gave anyone a straight answer.-
 

Online Alex Nikitin

  • Super Contributor
  • ***
  • Posts: 1177
  • Country: gb
  • Femtoampnut and Tapehead.
    • A.N.T. Audio
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #8 on: September 12, 2018, 09:27:55 am »
Batteries are dangerous stuff. I would design this kind of a circuit in a way that would be inherently safe, limiting the maximum discharge current and minimum discharge voltage in hardware, ideally with resistors as ultimately limiting elements and perhaps with a fuse as well.

Cheers

Alex
 

Offline krish2487

  • Frequent Contributor
  • **
  • Posts: 500
  • Country: dk
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #9 on: September 12, 2018, 11:00:36 am »
Also,
if it were me, I would have some sort of physical steering logic for the charge and discharge enable lines using some 7400 logic..


That way even if the firmware accidentally set both to active.. the gating should prevent accidental shoot through.
If god made us in his image,
and we are this stupid
then....
 
The following users thanked this post: Sceadwian

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: ca
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #10 on: September 12, 2018, 11:58:22 am »
Sceadwian - indeed this was only a snippet. I was trying to break things down into topics. I figured a "battery charger" post in projects would be one of a million. Here is a look at the source of the charge net



I do know now how to find the appropriate resistor values to get the desired output from the LM317/338. These aren't 100% final either, as perhaps I'd want to accept cells as low as 3V. (Or not).

Alex - I like the idea of a fuse, this will probably save me a lot of headaches :) I will put one in, and at the start keep it low around 1A, and just work out all the mCU code/logic keeping things under 1A. Hell, maybe 500mA. Then I can start nudging upwards.

Krish - I had thought about the exact same thing. Having the hardware ensure it's not possible for both to be on. I'll consider it, if not for the final design then at least during the prototype phase. I don't want to add too much in the way of the footprint, and I can have a function in the mCU that guards these outputs to ensure they are never conflicting as well.

 

Offline Sceadwian

  • Supporter
  • ****
  • Posts: 55
  • Country: us
  • Beware those that tell you the way the world is.
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #11 on: September 12, 2018, 10:45:13 pm »
Yeah, this is not looking like a very good design. You're relying on the micro controller to be the control loop for the current limit. Based on your current sense resistor all it will take is one glitch that causes the PWM to fail logic high and you'll be jamming 5amps down the throat of any cell connected.

Have you even checked your response time by simulating this stuff in LTspice? I don't want to be a wet blanket, but based on the fact you also had the PFET backwards in the original image here I think you might be biting off a bit more than you can chew.

Sceadwian - indeed this was only a snippet. I was trying to break things down into topics. I figured a "battery charger" post in projects would be one of a million. Here is a look at the source of the charge net



I do know now how to find the appropriate resistor values to get the desired output from the LM317/338. These aren't 100% final either, as perhaps I'd want to accept cells as low as 3V. (Or not).

Alex - I like the idea of a fuse, this will probably save me a lot of headaches :) I will put one in, and at the start keep it low around 1A, and just work out all the mCU code/logic keeping things under 1A. Hell, maybe 500mA. Then I can start nudging upwards.

Krish - I had thought about the exact same thing. Having the hardware ensure it's not possible for both to be on. I'll consider it, if not for the final design then at least during the prototype phase. I don't want to add too much in the way of the footprint, and I can have a function in the mCU that guards these outputs to ensure they are never conflicting as well.
-Because I be, what I be. I would tell you what you want to know if I could, mum, but I be a cat. And no cat anywhere, ever gave anyone a straight answer.-
 

Offline Sceadwian

  • Supporter
  • ****
  • Posts: 55
  • Country: us
  • Beware those that tell you the way the world is.
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #12 on: September 12, 2018, 10:51:57 pm »
What's the PWM frequency by the way? I'll simulate it, see what you got on your hands at least. This might not be horrible. But I can think of at least a half dozen different ways I'd do this to be much safer.
-Because I be, what I be. I would tell you what you want to know if I could, mum, but I be a cat. And no cat anywhere, ever gave anyone a straight answer.-
 

Offline joeyjoejoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 267
  • Country: ca
Re: Sanity check on N/P channel MOSFET's for battery charge/discharge
« Reply #13 on: September 12, 2018, 11:41:42 pm »
2kHz for the PWM.

I'm not sure I follow where the response time matters for a charger. It's about 400mS to go full swing. I didn't really design it to be responsive, as I figure a use case is battery goes in, the MCU starts off low and slowly adjust upwards based on what is required. As the battery approaches the cutoff voltage, it stops the charge. That was the thinking behind it. Any sudden/emergency anomalies could just abort the charge.

While I am definitely at the edge (or beyond) what I know right now, the PFET backwards was a mistake :) Probably staring at KiCad too long.

Definitely open to your ideas and criticism! The actual charger doesn't matter. The journey is the fun part and the objective is to learn as much as possible which so far, has been quite successful with some of the nice members of this forum!

Last night I watched the video below, which made me think some more about the principal, for both charging and discharging.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf