Current limiting circuit L298

For a model railway I want to build a digital command central. I want to use a multiwatt through hole L298 chip with heatsink because they are quite affordable.

Model railways are typical to shortcircuit alot. My past projects always used this chip with current sensing and shunt resistors. I allow a shortcircuit to last for 50ms before I cut of the power. This works really well but the voltage output of the power supply also dips when a short circuit is happening. Usually it is not a big deal, but for the new central I no longer want a voltage drop in the main power supply by staying under it's maximum output current.

In order to prevent the main 18V power supply from dropping below 18V. I want to add the following current limiting circuit.

Under sense_A I have 3x 0R1 in parallel giving me a total shunt value of 0.033R. ( 1/Rt = 1/0.1 + 1/0.1 + 1/0.1 -> Rt = 1/30) With a maximum current draw of 2A for this channel, this should get me a voltage of 2A x 0,033R = 0.067V

The + input of the LM311 opamp is fixed at 0.065V. If the current reaches 2A, the voltage at the - input should be greater causing the opamp to switch off.

The 5K pull-up resistor goes to an IO pin (powerOn). During powering up, the pin is floating. The 100k pulldown resistor should make sure that the 'mainPower' line (goes to the enable) remains low. The Lm311 switches open-collector.

If the 'powerOn' is set on, the mainPower/shortDetect will be pulled up. As soon as the 2A is reached, the opamp will pull the line down. This should turn off the enable of the L298 as well as notifying the uController that an overcurrent is in progress.

Will this work, or am I missing something?

Kind regards,

Bas

I would add hysteresis with a resistor (1M ?) from OpAmp pin 7 to pin 2. Is there some sort of latch ? Because without it, the circuit will be enabled again, right after being disabled...

The opamp should pull the shortcircut line down. If this happens for longer than 50ms, the uController will respond by setting 'powerOn' LOW. This pulls the enable pin of the L298 down to 0V

What i'm telling you is that the Over-current condition will disappear as soon as Enable is pulled LOW by the OpAmp => OpAmp will go HIGH => over-current again, and so on and so forth.
But maybe that is not a problem...

I suspected it would oscillate. But I am also not sure if that will be a problem or not. Filtering that out in software is not a big deal.

I added the 1M resistor.

I am also open to alternative ideas.

Bas

No alternative ideas.

Something else, the LM311 is not rail-to-rail so you must shift Vin+ and Vin- upward (~2.5V) with more resistors. Do you know how ?

Arduino motor shield rev3 (with L298) has current detection built-in.
Schematic available online.
Leo..

The LM311 is a voltage comparator, not an op amp so there is no need to shift the input level.

My bad, you're right, I didn't pay attention. Even the suggested 1M resistor is way too low. If you want to add hysteresis, it should be at least 6.8M-10M.

And what about the 750K - 10K divisor ? Would you add a trimpot to toggle at the desired value ?

Trimpot: I think it depends on how accurate a threshold bask185 wants.

What is wrong with the divisor? Should I use lower values like 1k and 75k or does that really not matter?

I would prefer not to use a potentiometer because potentiometers can have a wrong setting if somebody else is 'doing it wrong'. So fixed values have my preference..

If the circuit works around 2A plus minus some dA, I'll be happy. I just need the power supply not to dip in and the L298 musn't die.

Regards,

Bas

In the worse case scenario, considering a 5% tolerance, 750k is 712.5K, 10k is 10.5k => Vref =.0726V
0.033 is .03135 => Current = .0726/.03135 = 2.32A instead of 2A.

The trimpot allows compensation. But it's the worse case scenario, you may ignore the trimpot.

If you intend to do short-circuit tests, use a weak (or protected) power supply first and observe the behavior (recovery => collapse oscillation), the Arduino having its own PS with shared ground.
21W car bulbs may be an option.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.