DC motor over-current protection - Page 1
Forum section: electronics / beginners

author: Zeno
author_rank: Newbie
timestamp: April 06, 2025, 04:03:33 pm
content: I’m designing a DC motor driver for a school project and thought it would be a good idea to add over-current protection using spare parts I have on hand. Here’s the circuit:The motor itself drives fine with PWM, but the over-current detection part is giving me trouble. I initially tested the circuit by bypassing the motor, and it seemed to work—the ESP received pulses and reduced the duty cycle accordingly. However, I can’t figure out what the actual current limit is.I thought the calculation would be something like:I=2,49*r/((r+10^4)*0,22)With R8 = 300Ω, I expected a limit around 300mA, but the MCU starts triggering over-current warnings at just 10mA.I suspect this might be related to the inductive load, since I get different results with a purely resistive load. How do I properly calculate the current limit in this circuit?Thanks

author: UnijunctionTransistor
author_rank: Frequent Contributor
timestamp: April 06, 2025, 05:22:41 pm
content: First things first, and let’s divide the problem into segments. Please answer;1- What is the actual reference voltage you require?2- When the current is exceeded do you want the comparator turn high or turn low?3- How much current do you expect to drive through the coupler’s LED?

author: Xena E
author_rank: Frequent Contributor
timestamp: April 06, 2025, 05:33:07 pm
content: 3Amps

author: Zeno
author_rank: Newbie
timestamp: April 06, 2025, 05:38:16 pm
content: Quote from: UnijunctionTransistor on April 06, 2025, 05:22:41 pm1-I estimated a threshold of66mVacross the shunt resistor, since that would correspond to a current of>300mA(given the 0.22Ω sense resistor), so I wanted a reference of 660mV across R8.edit: Sorry I meant 660mV, that would give me >3A2-I need the comparator output to go low when over-current is detected, which will pull the optocoupler's collector high and signal the MCU.3-20mA, I believe. I changed that 50R resistor to get this current. I also measured it on my breadboard also.

author: Zeno
author_rank: Newbie
timestamp: April 06, 2025, 06:02:04 pm
content: Quote from: Xena E on April 06, 2025, 05:33:07 pmBut the comparator is going low at a much lower current when testing with a real motor. What could be causing this?

author: Xena E
author_rank: Frequent Contributor
timestamp: April 06, 2025, 06:07:07 pm
content: Could be spikes caused by the motor inductance ... try hanging a large capacitor across the sense resistor and see if it makes a difference.The rest of the circuit as shown should work I think.Have you access to a scope?X

author: Xena E
author_rank: Frequent Contributor
timestamp: April 06, 2025, 06:17:03 pm
content: Trying to drive a largish current to ground from the output of the LM 358 may also be causing problems, may be better to use a 'real' comparator.X

author: UnijunctionTransistor
author_rank: Frequent Contributor
timestamp: April 06, 2025, 09:18:25 pm
content: I also agree that motor noise is a likely suspect.Brushed DC motors are very noisy. And I mean VERY noisy.You may start experimenting with;Add a 0.1 to 1 uF ceramic capacitor across the motor terminals.Add positive feedback (hysteresis) to the comparator.EDIT: a 100 uF minimum electrolytic across the supply and a 0.1 uF ceramic across the IC.

author: Benta
author_rank: Super Contributor
timestamp: April 06, 2025, 11:27:58 pm
content: I think you need to select one of two scenarios:1: protecting the MOSFET from overcurrent.2: really having a precise constant current limit.The first one is easy and can be done with a few discrete components, limiting maximum drain current pulse-by-pulse.The second one (which you seem to prefer) is much more complicated, but makes little sense. Why would you want to limit a PMDC motor in a precise way?

author: johansen
author_rank: Super Contributor
timestamp: April 07, 2025, 12:07:45 am
content: Quote from: Xena E on April 06, 2025, 06:07:07 pmMotor inductance is not the problem. A second free wheeling diode can be redundantly soldered directly to the motor if you want.Dv/dt and di/dt at the mosfet is the problem because of its proximity to the rest of the sensitive circuitry.An appropriate rc snubber across the mosfet drain to source, and a capacitor from V+ to mosfet source, combined with a low inductance path between the mosfet, dc cap, free wheeling diode.. and a microprocessor can accurately measure the amps flowing at 50khz bandwidth with 1990's era technology

author: BILLPOD
author_rank: Frequent Contributor
timestamp: April 07, 2025, 01:15:10 pm
content: Good Morning Zeno, What is the amperage rating of the motor; either from a name plate, or the motors data sheet? That would be an important parameter. Or measure it under a load greater than the load it usually powers?

author: Infraviolet
author_rank: Super Contributor
timestamp: April 08, 2025, 03:22:31 pm
content: My thoughts would be to use an initial op-amp, followed by a low pass filter, to amplify the voltage across the shunt (R5) up to a decent fraction of your op-amp's voltage range, then feed this through an RC low pass filter and in to a second op-amp which would be used in comparator mode. This would therefore respond to time averaged current rather than responding to brief spikes and dips. If your PWM signal is relatively slow then it is quite likely that, at present, you are seeing a higher current than your limit during the ON part of a cycle, even when the average current is lower.Also, why the optocouplers, particularly the one at the right side of the diagram? Can't you just use potential divider resistor pairs to ensure the logic signal going to the ESP is safely within the ESP's input pin votage range? Without them you could send an analogue signal to the ESP, giving an indication of the time averaged current at a given time, as well as having a logic signal indiacting whether or not the current limit had been breached.