Pages: [1]   Go Down
Author Topic: Feedback/Advice on MOSFET circuit  (Read 1497 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,
  I've set up the following circuit, which is a multi-stage battery charger for a lead acid battery. The main battery charger feeds in 15V and the MOSFET (a logic-level, N-channel MOSFET, IRL1104PBF) switches the ground on and off via a PWM pin on the Arduino. There is an INA219 voltage/current sensor that is reading across a 50A/75mV shunt and sending values back via I2C.

It all works as expected. However I have somehow recently blown the INA219 when I switched the setup off (or on). It may have had to do with the order in which I switched the mains charger and the battery isolator (not shown, but on the negative battery terminal off).

Anyone have any comments, advice, or feedback on my circuit and anything that I might want to do to make it more robust? The eventual idea is that the charger will be replaced with solar panels and this becomes a solar regulator.

One note: I just realised in drawing this a slight mistake. The Vin and GND to the Arduino are not on that side of the circuit as shown, but connected across the + and - of the 12V battery on the other side of the circuit.



-Matt
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just noticed that the Adafruit INA219 breakout board that I'm using has a 0.1uF cap across +5v and GND. I'm wondering if that is the component that has blown and shorted causing my problems. If that is the case (I'll try and see if I can de-solder it this evening) I'm wondering what caused it.

-Matt
Logged

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 21
Posts: 1339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if you look at your circuit the shunt (that I guess you are using to measure current) is up around 15 volts
I don't know if that contributed to its short life!
can you move current sensing to the low side and have the FET on the high side?
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The shunt it a big 'ole strip metal thing and rated to 50A. It won't be bothered by the voltage being 15v.

The INA sensing the voltage across that shunt can measure voltage on the Vin pins up to 26v with reference to ground. It can measure up to 160mV differential across the shunt on the amplifier range I have it configured for.

I couldn't move the shunt to the negative as that would mean I couldn't measure the voltage to ground at the same time as measuring the current. It would also affect the ground voltage as well which would cause complications. And moving the MOSFET to the high side would mean I would then need additional circuitry (pump, driver, etc) to run it.

-Matt
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12443
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
One note: I just realised in drawing this a slight mistake. The Vin and GND to the Arduino are not on that side of the circuit as shown, but connected across the + and - of the 12V battery on the other side of the circuit.

In that case the whole circuit is probably flawed.  Please send a clear drawing of how the circuit actually is.  The MOSFET
source needs to be at the ground potential of the Arduino if the Arduino is drving the gate.  Which MOSFET are you using?
Logged

[ I won't respond to messages, use the forum please ]

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem I see with your circuit is that you are charging your battery with a 15V rectangular wave with no peak current limiting other than the internal resistance of the 15V supply and the battery (and the 1.5milliohm shunt). Therefore you will get very high peak currents, which will probably damage the battery, and perhaps other components too. You need to change the circuit so that the battery is charged in such a way that the peak current limited to a suitable value. There are two ways to do this:

1. Run the mosfet in the linear mode, by feeding it from an analog output pin followed by an RC network to smooth the PWM. Ramp the PWM up slowly, monitoring the current, until you reach the desired maximum charging current. The mosfet will dissipate a lot of power, so it will need a good heatsink, and the circuit will not be very efficient.

2. Smooth the PWM output using an inductor and flyback diode. You will need to increase the PWM frequency to a much higher value in order to use a low enough value of inductor for this to be feasible. The advantage of this approach is that it doesn't waste a lot of power. However, because of the higher switching frequency, you may need to use a mosfet driver in order to keep the mosfet switching losses low, otherwise you will need a heatsink again.

If you were to change the circuit to use high side switching (which will be easier of you use a mosfet driver chip), then you could monitor the battery voltage as well, which will help you tell when charging is complete.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
One note: I just realised in drawing this a slight mistake. The Vin and GND to the Arduino are not on that side of the circuit as shown, but connected across the + and - of the 12V battery on the other side of the circuit.

In that case the whole circuit is probably flawed.  Please send a clear drawing of how the circuit actually is.  The MOSFET
source needs to be at the ground potential of the Arduino if the Arduino is drving the gate.  Which MOSFET are you using?

The circuit is exactly as above, but the Vin to the Arduino goes to the +12v of the battery, and the GND goes to the 0v on the battery.

The MOSFET is as I said in the 2nd sentence of the post, a logic-level, N-channel MOSFET, IRL1104PBF.

Yes, my Arduino is not on the MOSFET source side of ground, but on the drain side. What are the implications of this?

-Matt
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem I see with your circuit is that you are charging your battery with a 15V rectangular wave with no peak current limiting other than the internal resistance of the 15V supply and the battery (and the 1.5milliohm shunt). Therefore you will get very high peak currents, which will probably damage the battery, and perhaps other components too. You need to change the circuit so that the battery is charged in such a way that the peak current limited to a suitable value. There are two ways to do this:

OK, I guess this could be the difference in using this with a charger as opposed to a solar panel (it's eventual use). A Solar panel is naturally current limited.

The battery is a 115Ah battery (and will likely be a 2-3x bigger bank eventually). So I was thinking that its internal resistance should limit the current. I didn't think it would mind the square wave and its internal capacitance and resistance would smooth that out, but maybe I do need to do something manually myself.

1. Run the mosfet in the linear mode, by feeding it from an analog output pin followed by an RC network to smooth the PWM. Ramp the PWM up slowly, monitoring the current, until you reach the desired maximum charging current. The mosfet will dissipate a lot of power, so it will need a good heatsink, and the circuit will not be very efficient.

2. Smooth the PWM output using an inductor and flyback diode. You will need to increase the PWM frequency to a much higher value in order to use a low enough value of inductor for this to be feasible. The advantage of this approach is that it doesn't waste a lot of power. However, because of the higher switching frequency, you may need to use a mosfet driver in order to keep the mosfet switching losses low, otherwise you will need a heatsink again.

I just found this example which shows high side switching with a capacitor, inductor and diode:
http://archive.siliconchip.com.au/cms/A_112335/article.html

Would that circuit still work if you were low-side switching? Would you keep the capacitor and inductor on the high side?

If you were to change the circuit to use high side switching (which will be easier of you use a mosfet driver chip), then you could monitor the battery voltage as well, which will help you tell when charging is complete.

I was hoping to not require a MOSFET driver. Looks like there is no real reason to do high-side switching unless I can't switch on the ground (e.g. the solar panel/charger and battery are common grounded via another path, e.g. vehicle chassis).

The INA219 is already doing voltage monitoring. That is how I'm adjusting the PWM signal. As I said, it is currently working and seems to be OK, I just want to make sure it is a bit more robust and I try and work out how I managed to kill the INA219 last time and don't do it again!

Here is a basic sketch and idea of how it is working... this is using a voltage divider to read the voltage in lieu of the INA219 until the replacement one turns up... but the MOSFET side is the same:

http://opensourcebatterymonitor.blogspot.co.uk/2013/02/simple-but-it-works.html

-Matt
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2925
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The easiest fix is to put a silicon diode in series with the battery that way there is a more limited discharge path for the battery...
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree with MarkT that your current circuit is flawed. The Arduino will not be able to turn the mosfet off in that configuration unless the charging voltage is only slightly greater than the battery voltage. I suggest you use a circuit with high side switching, similar to the one you posted, but add a mosfet driver chip between the microcontroller output and the mosfet gate (TC4420 will do if the charging voltage won't exceed 18V). You can add your shunt and current monitor between the capacitor and the battery +ve terminal. Alternatively, if you don't need a common ground, then you can put the shunt in series with the battery negative terminal, and use an op amp to amplify the voltage drop sufficiently to feed into an Arduino analog input.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd highlight that note, or update the diagram, as it changes the whole topology. Also add the isolator. We don't know if the gnd to arduino is disconnected when you isolate the battery.

I would have thought you could stick with the N channel mosfet, but as other posters have said, it's ground needs to been connected to the arduino's ground.

I've charged batteries successfully in this manner before, the other methods posted here may be better for batteries - I couldn't say. I know battery charging can be complex!

Without the full circuit it's hard to see why the current sensor chip would have got damaged.
Matt
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree with MarkT that your current circuit is flawed. The Arduino will not be able to turn the mosfet off in that configuration unless the charging voltage is only slightly greater than the battery voltage. I suggest you use a circuit with high side switching, similar to the one you posted, but add a mosfet driver chip between the microcontroller output and the mosfet gate (TC4420 will do if the charging voltage won't exceed 18V). You can add your shunt and current monitor between the capacitor and the battery +ve terminal. Alternatively, if you don't need a common ground, then you can put the shunt in series with the battery negative terminal, and use an op amp to amplify the voltage drop sufficiently to feed into an Arduino analog input.

OK, thanks for the input. In this case my voltages are pretty close (15v vs 12.8-14.4v) so that is maybe why it is OK. With a solar panel the panel could be trying to get up to 18v or so. It *seems* to be switching off fine, but maybe its not entirely.

If switching off completely is not an issue for me then would the circuit be OK? I mean all it would mean is that the battery gets a certain base level of charge (would it be current or voltage?) then that would probably be OK. In real world usage the PWM signal to the MOSFET would never be at duty cycle 0% so I'm wondering if this would be a real issue or not. Are there any real downsides to this? Will it harm the MOSFET?

I want to keep the shunt on the positive side as the INA219 measures voltage against ground at one end of the shunt.

-Matt
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would have thought you could stick with the N channel mosfet, but as other posters have said, it's ground needs to been connected to the arduino's ground.

I think that is the issue here. I don't think that would be possible. I guess it's not often that you have the Arduino powered by the 'load' rather than the power source. So that might mean I'm going to have to move to high side switching and using a MOSFET driver or equivalent.

-Matt
Logged

Pages: [1]   Go Up
Jump to: