Wednesday, 27 November 2013

Dangerous Assumptions

When You Assume....

Back in the start of my Alarm interface project, I ran into problems with my current limiting circuit.  My little 3A FET would go up in smoke with limited to 500mA and I just put this down to a need to heatsink the FET.  The thinking here is that passing 500mA when switched on was too much for the little SOT23 package.

I was wrong!

But before I knew that, I decided to beef up my circuit, switching the PMV48XP for a TD2955PT4G which comes in a D-PAK package, and rated to run with a Heavy Duty 12A steady state current.  500mA should be nothing for this beast, and the bigger case might compensate for the lack of heatsink (I was trying to get a physically small solution).

However, the only thing I knew was that I was going on guesswork here.  I didn't have any hard maths that proved what I was thinking was correct, and rather than commit to winging it on my next run of Seeed studio PCB's I built a test circuit to check it out.

Rather glad I did that now!

High Side Limit Schematic

High Side Limit PCB

I whipped up this test board in Altium and milled it at work.  Yes, I used the Sick of Beige sizing, and it makes (imho) the little test board look quite snazzy.  I built the board with M3 bolts (no cover) and it's handy in that it elevates the board off the bench so the through hole parts don't make it unstable when sitting there.  



I had a small problem - at home I didn't have anything to reliably set the load current for my protection circuit.  Just loading it up with some random high power LEDs wasn't going to cut it.

My Usual Method Of Load Testing.  Not Brilliant (ha!)

Thankfully there's a pretty easy design that can be used to build a Constant Current Load.

My version is similar with a my main Variation being that U2B buffers my set voltage (where the output voltage is equal to my set current - i.e. 500mV = 500mA).  Otherwise you need to measure the output current (or the voltage across the shunt resistor) while stressing your circuit.  I also used a Quad op-amp because that's what I had lying around.  Again, I used a Sick of Beige outline for my PCB.

There is one caveat - if setting the current limit by measuring the set voltage from U2B, there will be an error due to the tolerance of the shunt resistor.  The feedback loop of U2A tries to set the voltage across the shunt to that of the reference voltage from U2B.  As current is equal to that voltage divided by the value of the shunt resistor (1 ohm for easy maths), the current in amps *WHEN LIMITED* is equal to the voltage set by U2B.  If every part was perfect this would be the case.  However my shunt resistor has a 5% tolerance so my actual current can vary from the set point by +/- 5%.  I can live with that.

Constant Current Load Schematic

Constant Current Load PCB

Around this time my EEVBlog uRuler turned up. This shot shows how I mounted the pot directly to the PCB, and the heatsink I intended to use.

I've aimned for my rig to be cable of sinking 5A, and with a 12V supply that's a cracking 60W load that needs to be dissipated.  To survive the MTP3055 requires adequate heatsinking, and you can see it in the above shot.  Yes, I'm aware of the irony here.

As I was in a relative hurry I cheated - I simply bonded the MTP3055 to my heatsink with some JB Weld, and while at it I also glued my PCB stand offs down.  Everything looked nice and aligned, and I left it to cure overnight.

Of course this means that the kids disturbed it (telling a kid to 'not touch something' is equivalent to putting wet paint signs on things) and things ended up a bit crooked.

Mr Sticky Fingers Himself

Testing, Without Magic Smoke

Once built it was tested.  Yes, I made a mistake with my MOSFET pinout but as I was hooking it up with flying leads I simple had to reorder them and not hack the PCB.  I used a single turn pot to give me a set range of 0 - 5A, but this meant that dialing in 500mA was fiddly.  So I kludged 41k (parallel combo of two 82k 1/4W resistors) in series with the pot to reduce my range to 0 - (almost) 1A but with easier adjustability.

If you look closely in the above pic, you can see one resistor on the opposite side of the PCB to one of the power supply caps.

If I ever make one again, I might add some jumpers to set a high / low range on the load (i.e. bypass the series resistor).

But it works, and that's fine.

Current Limit Testing

Just to confuse things - there are *TWO* current limiting circuits at play here.  The 'High Side' limiting circuit I want to finalise for use in my PCB's and the 'Low Side' constant current load.  I set my 'test current' with my load, and while this is less than the high side limit my 'High Side' limit won't be operating.  Still follow?

Add my test circuit and my current load to my rudimentary 15V 1A supply I was ready to test.  Under my 500mA setpoint, my MOSFET was happily passing current and was cool to the touch.

Nudging things up I hit the current limit trip point and got an unpleasant surprise.

My MOSFET rapidly began to heat - in fact it got so hot it re-flowed it's solder joints!

Yes, I was perplexed - surely this 12A FET could handle this amount of current!  To confirm this I removed the switching transistor from circuit (so the MOSFET was continuously switched on) and tested again.

Sinking up to 1A into my current load, my MOSFET didn't miss a beat and kept cool.  But when adding the switching transistor, the MOSFET made a damn fine heater.


My current limit circuit doesn't switch the MOSFET on or OFF.  What happens is that it *begins* to turn the MOSFET off, and thus it's drain - source resistance increases.  This means that the current in the circuit decreases, the limiting circuit starts to turn the MOSFET back on and then current increases until the limiting circuit starts to turn off etc etc....

But unfortunately the drain - source resistance is now significant and losses in the MOSFET cause it to heat.  At 15V and 500mA the MOSFET is dissipating 7 1/2 Watts.  Dammit.

Getting Clever.

So I thought I'd be smart - rather than letting the MOSFET oscillate so quickly I'b be crafty and add
some external switching to pull it hard off.  I was aware that this would still lead to oscillation but I was hoping that I could make it switch slowly with the addition of some capacitance, and that the MOSFET would spend less time dissipating power.

My shunt resistor was used to trigger the BC807, but now it was used to trigger a PN100 that drove another PN100 (classic inverter arrangement) to switch the MOSFET off.

IT didn't work.

It was that bad that I'm not even going to show my test circuit sketch - the pic below shows my crappy efforts.

Nothing's Neat at 2AM

The circuit did switch as required but the MOSFET still got damn hot.  It took longer than before but I was still up against the problem of dissipating 7 1/2 watts.


The above shot of my scope shows the switching signal into the gate of my FET (top trace) and current in the load (voltage across the shut resistor).  You can see that I succeeded in getting the FET to switch off, but only for a few micro seconds.  Then it's on for around 150 micro seconds and it repeats.  Not good.

Now I could 'fix' this by using a big heat sink, but that effects the purpose of my circuit.  I wanted a *small* current limiting circuit, and this approach just isn't going to cut it.  Darn.


I've taken a seat, and asked myself 'why am I doing this' and it comes down to two reasons:

1.  Accuracy.  I blew up some play stuff because my 1A polyswitch was happy to dump 2A into my circuit for 10 seconds or so.  So I wanted a 1A fuse that fused at 1A.

2.  Price.  Polyswitches can be ridiculously expensive.  Like a whole dollar the last time I bought them!

But when you make some new (sane) comparisons:

The PMV48XP I used in the alarm interface is $0.47
The NTD2955PT4G I'm currently torturing is $0.79

Add 4 jellybean transistors, a pair of caps and a couple of diodes and I'm soon over the dollar mark.


Then I re-checked polyswitches on Mouser

Yep, 500mA, $0.42.  Trip current is at 1A, but knowing that you can design around it.  Also it's nice to be able to have some 'surge' overhead in your design.  My latch idea above would sit at 499mA all day and if there' a tiny blip to 501mA your system ends up rebooting.

So that's that.  I give up, call it a lost cause and will go to a simple polyswitch for future power
supply current limits.  Like I always have before and had success with... Grrr

It's not all lost effort.  It's been an education in how MOSFETs work, I'm more comfortable with switching them and I now know to factor in a big assed heatsink when ever I use one in a current limiting role...  And I've got a nice Constant Current Load for future testing.

Onto the next problem!


  1. You can build a highly efficient constant current source out of a buck converter. Simply don't take your feedback from the output voltage, but from the voltage drop over a small current sense resistor.

    I think the polyswitch will not perform better than your FET approach (it will not blow, but shutdown when it gets too hot).

  2. Classic mistake (make that two)
    First your opamp does not handle capacitive load well, and mosfet Gate-Source junction is beefy cap that will make OP oscillate. Typical solution is putting resistor between OPamp out and gate (50-220ohm will do), second is reducing bandwidth of the amp, place a 100pf cap between inverting input and output will do the trick...wiggle the values a little bit for the best result, enjoy.