DC motor current limiter

Thread Starter

topher217

Joined Oct 17, 2019
22
Background:
I'm working with an existing motor+driver board with Vin being supplied by a 4.2V LiPo -> TP4056 Charger Protection Board -> Boost Voltage Regulator. I've also got another subcircuit attached to the end of the TP4056 module through another voltage regulator and diode that powers a microcontroller.

Issue:
The trouble I'm having is that when the motor stalls (or more specifically when it switches between full speed forward to full speed backward) I am getting a high enough current draw that the LiPo protection circuit, the short-circuit protection on the DW01A on the TP4056 board in particular, is shutting down the whole circuit and causing the microcontroller circuit to also shutdown. Needless to say, this is not desired behavior.

So what I'm trying to do is limit the current the motor can draw in the worst case scenario of going back and forth at full speed. Note this happens VERY regularly as this is controlling a balancer robot.

Attempted Solutions:
Here are the things I've tried thus far:

Method 1:
Splitting the microcontroller and motor driver power supplies​

Results:
Stabilizes the microcontroller supply voltage a great deal due to removing the fluctuations from the motor during various draw changes, but does not solve the undesired DW01A cutoff issue.​

Method 2:
Attempt to adjust or tune the overcurrent or short circuit detection voltage/current on the DW01A.​
Results:
As the current sense pin voltage is determined by the resistance of the two ON MOSFETs, and the current needed to trigger the short circuit protection gets smaller the higher this resistance, I'm not sure what I could do other than try to find another dual mosfet with lower R_DS(ON), but this would likely be a great pain to modify such a tiny SMD part on all these one dollar modules just for this one issue.​
Method 3:
Add a series resistor somewhere to limit the current. Considered 1.) Directly in series with the motor 2.) In series with Vin for the driver circuit 3.) In series with Vin of the voltage regulator governing the driver circuit.​
Results:
Putting it at 2 runs the risk of having too high a voltage drop over this resistor leading to too low a voltage over the driver circuit, and I could lose power to that intermittently (something I also want to avoid for reasons not specified here for brevity). So locations 1 and 3 remain. I measured the effective resistance in all these cases during a.) motor full speed with no external restrictions and b.) motor shorted for active braking (highest current draw I can repeatably test) at location 3.

For placement at 3, I measured R_eff to be 14.83 Ohms at unrestricted 100% speed and 1.33 Ohms at shorted motor coil active brake. So if I add on a 1 Ohm resistor in series here, I'd reduce my peak current by about half and be wasting about 0.1 W during normal operation. Not terrible, but not great for a battery powered project either.​
Method 4:
Trying to find an active current limiter circuit I can add on to this somewhere. Have tried adapting the circuit @crutschow presented here, and see a lot of possibilities in this cookbook

Results:
I'm not sure if I can adapt the one by @crutschow as it would need to work in reverse as well since the motor will be driven in both directions. I thought about using it at location 3 mentioned in Method 3, but I'd end up still burning the same? amount of power on the R1 resistor right?

The biggest trouble I'm having adapting anything from the cookbook is that I don't have access to the gates of the control mosfets in the H-bridge tb6593fng, so even if I have a great sensing circuit, there's not much I can do with that information is there? I thought about using such a sensing circuit to actively change the PWM signal with the microcontroller, but the loop would be too long (typically 5-15 ms) and miss these 5-50 microsecond current peaks.​
Method 5:
Try adding a larger capacitor in parallel with the motor to smooth out any peaks or a zener diode to cut the peaks off.​
Results:
I was seeing 8-9 V peaks directly over the motor when the normal driving voltage is 6V. I added a much larger capacitor in parallel with the existing one and saw these peaks disappear, but the peak current draw remained about the same (3.2 Amps or so). I'm not all that well versed in the physics of DC motors, so if someone wants to clue me in as to why the current can remain the same with a lower voltage, I'm eager to know. After seeing these results, I abandoned buying and testing an appropriate zener diode, as it appears the peaks in voltage do not directly effect the peak current (still confused on that).
Anyone have any suggestions for things that would be any more efficient than Method 3?
 

AlbertHall

Joined Jun 4, 2014
12,343
Adjust the motor control algorithm so the motor doesn't suddenly try to go from full forward to full reverse. Ramp the speed down, change direction and ramp the speed up again. Change the slope of the ramps to control maximum current.
 

peterdeco

Joined Oct 8, 2019
484
I ran into a similar problem dealing with a motor. First make absolutely certain motor noise isn’t the cause of the shutdown. Select a power resistor and use it in place of the motor that will draw the same current. Does the circuit still shutdown? Whether it's yes or no there still are ways to deal with this.
 

Thread Starter

topher217

Joined Oct 17, 2019
22
Adjust the motor control algorithm so the motor doesn't suddenly try to go from full forward to full reverse. Ramp the speed down, change direction and ramp the speed up again. Change the slope of the ramps to control maximum current.
Thank you for your idea, though unfortunately that is not an option as the controller is a Neural Network based learned controller (i.e. there will be inherent exploratory behavior while learning how to balance, which implies this kind of movement will be unavoidable). I other words, I need a way to soft limit the maximum current with hardware not software.
 

Thread Starter

topher217

Joined Oct 17, 2019
22
I ran into a similar problem dealing with a motor. First make absolutely certain motor noise isn’t the cause of the shutdown. Select a power resistor and use it in place of the motor that will draw the same current. Does the circuit still shutdown? Whether it's yes or no there still are ways to deal with this.
Can you elaborate on what you mean by "motor noise"? I'm not sure what replacing the motor with a power resistor would test other than show what I already know, i.e. that the motor does not act like a linear resistor :D. If I were to even try, what value resistor would I choose? As the effective resistance of the motor changes with the amount of current draw, there is no single value resistor that would accurately resemble the motor's behavior. Ideally the motor would behave like a simple power resistor, but unfortunately I don't think it is this simple.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
. I other words, I need a way to soft limit the maximum current with hardware not software.
Generally the usual way is for what ever is controlling the motors is to receive feedback in the way of some kind of encoder. i.e. servo action.
If wishing to do this with without this method either use as mentioned in post#2 or remove power for the period that it takes for the motor to slow to the practically zero point before applying power in the opposite direction.
But the fastest way is as used in CNC applications i.e. PID loop control.
Max.
 

Thread Starter

topher217

Joined Oct 17, 2019
22
Generally the usual way is for what ever is controlling the motors is to receive feedback in the way of some kind of encoder. i.e. servo action.
If wishing to do this with without this method either use as mentioned in post#2 or remove power for the period that it takes for the motor to slow to the practically zero point before applying power in the opposite direction.
But the fastest way is as used in CNC applications i.e. PID loop control.
Max.
I'm not quite sure I'm understanding your suggestions. The microcontroller sets the In+/- and PWM signal inputs on the motor driver, and the driver takes those inputs to "control" the motor. The idea of feedback to the microcontroller would be too slow (see Method 4 results in my original post), so this prevents any feedback relying on the calculated speed of the motor. In other words a microcontroller PID controller is not feasible here as the loop time is orders of magnitude too slow.

The idea of feedback to the driver logic is also addressed in Method 4, as the timing here would only be limited by the mosfet or comparator switching time (nanoseconds), but I don't know how I'd control anything as I don't have pin outs to the mosfet gates in the H-bridge to turn anything on/off directly. If you have any ideas for how to adapt some of the
Linear Technology cookbook circuits to the unexposed H-bridge in the tb6593fng, I'm all ears! :)
 

peterdeco

Joined Oct 8, 2019
484
The idea that I was referring to is to load down the circuit comparable to the motor load to see if it is truly a current limiting problem or spikes in the supply voltage caused by the motor. Also, try turning off brown out detect on the microcontroller.
 

Thread Starter

topher217

Joined Oct 17, 2019
22
The idea that I was referring to is to load down the circuit comparable to the motor load to see if it is truly a current limiting problem or spikes in the supply voltage caused by the motor. Also, try turning off brown out detect on the microcontroller.
I'm still not understanding how I would "load down the circuit comparable to the motor load" if the motor load changes with current draw. Can you elaborate on how you'd choose an appropriate resistor load? Would you set this at the effective resistance of the motor under shorted circumstances? If so, this would be on the order of 5-10 mOhms according to the tests I've done. I don't have access to a known resistance at the small a level, though I guess I could order some if I end up seeing the advantage here.

Then what would you test for? I have already tested with a larger capacitor in parallel with the motor to eliminate any voltage spikes (confirmed with oscilloscope), and still see the overcurrent short-circuit protection kick in. Does this not imply that I need to limit the current? I'm not sure what the conclusions of your proposed test would be.

>Also, try turning off brown out detect on the microcontroller.

I have completely disconnected the microcontroller circuit during these tests and am just using a straight (i.e 100% PWM) voltage over the motor to simulate "full speed". I then have pins to simulate the active brake and forward/backwards motion with jumpers that the microcontroller would otherwise be controlling.
 

Thread Starter

topher217

Joined Oct 17, 2019
22
Is it still locking up without the microcontroller?
You mean the motor? I am intentionally stress testing it (forcing it to pull it's max current by switching back and forth 100% forward to 100% backward). It is not locking up, unless I intentionally hold it to test the stall current.

This is typical operation for the robot as a balancer using the microcontroller, but I'm doing this simply with a mechanical switch to simulate this behavior without the microcontroller for the purpose of testing this current limit functionality.
 

Thread Starter

topher217

Joined Oct 17, 2019
22
So when you use the microcontroller and go back and forth it locks up but without it it's working correctly?
Everything is working correctly in all cases, in that everything that is happening is well understood and working as expected. This is a design question rather than trying to debug something. I already know what is wrong I just need a good design to deal with the expected behavior.

I'm still not clear what you mean by "locks up", but assuming you mean undergoes a stalling current, then yes, in both cases (microcontroller or not), the stalling current is present. This is not the issue though as this is expected and normal operation. The issue is reducing this stall current maximum in a graceful way so as not to trigger the short-circuit protection.
 

Sensacell

Joined Jun 19, 2012
3,432
Thank you for your idea, though unfortunately that is not an option as the controller is a Neural Network based learned controller (i.e. there will be inherent exploratory behavior while learning how to balance, which implies this kind of movement will be unavoidable). I other words, I need a way to soft limit the maximum current with hardware not software.
I think you missed the point there... the results will be the same, hardware or software. You cannot limit the motor current without limiting the performance.

A software solution might be easier to implement.
 

BobaMosfet

Joined Jul 1, 2009
2,110
Background:
I'm working with an existing motor+driver board with Vin being supplied by a 4.2V LiPo -> TP4056 Charger Protection Board -> Boost Voltage Regulator. I've also got another subcircuit attached to the end of the TP4056 module through another voltage regulator and diode that powers a microcontroller.

Issue:
The trouble I'm having is that when the motor stalls (or more specifically when it switches between full speed forward to full speed backward) I am getting a high enough current draw that the LiPo protection circuit, the short-circuit protection on the DW01A on the TP4056 board in particular, is shutting down the whole circuit and causing the microcontroller circuit to also shutdown. Needless to say, this is not desired behavior.

So what I'm trying to do is limit the current the motor can draw in the worst case scenario of going back and forth at full speed. Note this happens VERY regularly as this is controlling a balancer robot.

Attempted Solutions:
Here are the things I've tried thus far:

Method 1:
Splitting the microcontroller and motor driver power supplies​
Results:
Stabilizes the microcontroller supply voltage a great deal due to removing the fluctuations from the motor during various draw changes, but does not solve the undesired DW01A cutoff issue.​

Method 2:
Attempt to adjust or tune the overcurrent or short circuit detection voltage/current on the DW01A.​
Results:
As the current sense pin voltage is determined by the resistance of the two ON MOSFETs, and the current needed to trigger the short circuit protection gets smaller the higher this resistance, I'm not sure what I could do other than try to find another dual mosfet with lower R_DS(ON), but this would likely be a great pain to modify such a tiny SMD part on all these one dollar modules just for this one issue.​
Method 3:
Add a series resistor somewhere to limit the current. Considered 1.) Directly in series with the motor 2.) In series with Vin for the driver circuit 3.) In series with Vin of the voltage regulator governing the driver circuit.​
Results:
Putting it at 2 runs the risk of having too high a voltage drop over this resistor leading to too low a voltage over the driver circuit, and I could lose power to that intermittently (something I also want to avoid for reasons not specified here for brevity). So locations 1 and 3 remain. I measured the effective resistance in all these cases during a.) motor full speed with no external restrictions and b.) motor shorted for active braking (highest current draw I can repeatably test) at location 3.​
For placement at 3, I measured R_eff to be 14.83 Ohms at unrestricted 100% speed and 1.33 Ohms at shorted motor coil active brake. So if I add on a 1 Ohm resistor in series here, I'd reduce my peak current by about half and be wasting about 0.1 W during normal operation. Not terrible, but not great for a battery powered project either.​
Method 4:
Trying to find an active current limiter circuit I can add on to this somewhere. Have tried adapting the circuit @crutschow presented here, and see a lot of possibilities in this cookbook

Results:
I'm not sure if I can adapt the one by @crutschow as it would need to work in reverse as well since the motor will be driven in both directions. I thought about using it at location 3 mentioned in Method 3, but I'd end up still burning the same? amount of power on the R1 resistor right?​
The biggest trouble I'm having adapting anything from the cookbook is that I don't have access to the gates of the control mosfets in the H-bridge tb6593fng, so even if I have a great sensing circuit, there's not much I can do with that information is there? I thought about using such a sensing circuit to actively change the PWM signal with the microcontroller, but the loop would be too long (typically 5-15 ms) and miss these 5-50 microsecond current peaks.​
Method 5:
Try adding a larger capacitor in parallel with the motor to smooth out any peaks or a zener diode to cut the peaks off.​
Results:
I was seeing 8-9 V peaks directly over the motor when the normal driving voltage is 6V. I added a much larger capacitor in parallel with the existing one and saw these peaks disappear, but the peak current draw remained about the same (3.2 Amps or so). I'm not all that well versed in the physics of DC motors, so if someone wants to clue me in as to why the current can remain the same with a lower voltage, I'm eager to know. After seeing these results, I abandoned buying and testing an appropriate zener diode, as it appears the peaks in voltage do not directly effect the peak current (still confused on that).​
Anyone have any suggestions for things that would be any more efficient than Method 3?
You can also try an inrush current thermistor on the motor.
 

BobaMosfet

Joined Jul 1, 2009
2,110

nsaspook

Joined Aug 27, 2009
13,079
If you change direction on the motor, at the peak of the sine, the motor is stopped (no matter how short a time period) it is stopped and thus can present a dead short which must be overcome with current to keep it moving.
Easily programmed with a proper motor controller using proper frequency/current control loops and dynamic braking to drain excess KE. Slam-Bang reversals by just flipping a switch (going back and forth at full speed) doesn't seen a good way to enable precision balancing.
http://www.crydom.com/en/tech/newsletters/jan 2013 - solid statements - dc motor reversing.pdf
 

Thread Starter

topher217

Joined Oct 17, 2019
22
I think you missed the point there... the results will be the same, hardware or software. You cannot limit the motor current without limiting the performance.

A software solution might be easier to implement.
Nope, I understand the end result is the same, but due to the design requirements for this project, with a NN based controller, I cannot touch the software side in the way described, and even if I could, the processor loop time is orders of magnitude too slow to be able to catch the microsecond peaks.

As much as I'd like to "keep it simple stupid", an "easier to implement" solution is not a design requirement here. I need it to work under the design requirements given and a software solution using the existing microcontroller is simply not an option due to the loop time.
 

Thread Starter

topher217

Joined Oct 17, 2019
22
The simple solution is to not stall the motor. With adequate torque and speed this should never happen during normal balancing operation.
https://people.ece.cornell.edu/land...oject_webpage_v2/dc686_nn233_hz263/index.html
If only this were possible with the motor's I've been told to use :D ... Yes, this was an argument I put forth at the beginning of the project, but for reasoning too lengthy to post here, I've been told I have to use the motors I'm currently using...which will regularly hit their max torque during the back and forth behavior needed to balance. Its wasteful for power, wears down the motors to their breaking point regularly, but it is what it is. :\

The motors in the cornell project are MASSIVE compared to the ones we're using. We're using those tiny little thumb sized chinese motors. Again, I totally agree with you that this would be ideal, but this is just another design restriction I have to work around. I'll keep trying to push this though. :)
 
Top