Author Topic: DC motor driver problems  (Read 2383 times)

0 Members and 1 Guest are viewing this topic.

Offline gaminnTopic starter

  • Frequent Contributor
  • **
  • Posts: 339
  • Country: 00
DC motor driver problems
« on: February 06, 2019, 07:36:21 pm »
Hi,
I drive this type of motor https://www.ebay.com/itm/High-Torque-DC6V-12V-24V-Encoder-Gear-Box-Electric-Motor-Replacement-PICK/182645563123?hash=item2a86861ef3:m:meZOhh_Zd85SzjxiwmH14Wg:rk:18:pf:0 (6V DC) with DRV8837 driver http://www.ti.com/lit/ds/symlink/drv8837.pdf . I noticed that during direction change of the motor or when braking, spikes on Vm rail (motor supply voltage) are visible. On my PCB I use 5 V Vm from USB and this voltage is also used by other ICs on the board. The spikes can go up to 8 V for 1 ms in my case and cause some problems (and of course, it can be bad to generate 8 V spikes on USB which is connected to my PC).

This is my first design with DC motor drive. What are some good practices to avoid this problem? I thought about bigger bulk capacitor on Vm line (even that this is a problem when your Vm is USB voltage which can have max 10 uF capacitance) or about connecting power schottky diode in series and e.g. 6 V zener diode parallel to Vm to prevent the spikes to reach other ICs on my board and to clamp them by zener diode.

In the picture attached there are the spikes I'm talking about during motor braking. When the motor runs in steady state the Vm voltage is clean.
« Last Edit: February 06, 2019, 07:43:06 pm by gaminn »
 

Online uer166

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: DC motor driver problems
« Reply #1 on: February 06, 2019, 09:58:31 pm »
That's normal for braking any sort of motor, the energy has to go somewhere (think regenerative braking). You've essentially created a boost converter the input of which is the motor's back-EMF, and the output your 5V rail (which goes above 5V during regen, since again energy has to go back somewhere). This is ok if supply is battery, but not in your case. The energy of the rotor spinning gets dissipated back into the 5V rail when you brake.

For proper design I would never power a DC motor from a logic rail, it needs to be its' own high current supply, which 5V USB is not.

EDIT: ignore all this you already figured it out
Alternatively as a higgledy piggledy fix, you can isolate the motor power via a diode pointing from 5V into VM of DRV chip, and adding a 5V Zener on that rail to absorb regenerative energy of rotor during brake and reverse. The diode will prevent spikes on this rail from going back into USB 5V, while zener will keep voltage under 11V (max of DRV chip).
« Last Edit: February 06, 2019, 10:01:00 pm by uer166 »
 

Offline gaminnTopic starter

  • Frequent Contributor
  • **
  • Posts: 339
  • Country: 00
Re: DC motor driver problems
« Reply #2 on: February 06, 2019, 10:13:32 pm »
Thanks. Yes, that diode pointing from 5V to VM and zener diode was my initial idea. However, it is not ideal as I'm quite tight with my motor voltage requirement - 5V for motor is fine but loosing 400 mV at the diode is not what I really need.

I was thinking about some smart DC motor driver IC that is able to dissipate the energy from the motor in itself leaving Vm untouched. Not sure if something like that exists.
 

Offline jbb

  • Super Contributor
  • ***
  • Posts: 1231
  • Country: nz
Re: DC motor driver problems
« Reply #3 on: February 06, 2019, 10:42:58 pm »
If you’re in a hurry, there are two things you could try.

In brief, when you try to suddenly reverse the motor, some the kinetic energy is converted to electrical energy (generator action) and jammed back into the supply rails.

Two possible solutions in software:
1- force both sides of the motor to 0. This basically shorts out the motor, which will convert the kinetic energy into heat in the motor windings and driver. This is an electromagnetic brake. It could be too rough on your mechanics.

2- disable the driver (motor open circuit) and allow the motor to coast to a stop before reversing. May be too slow.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: DC motor driver problems
« Reply #4 on: February 06, 2019, 10:49:32 pm »
Use a driver circuit, that can work only in I. and III. quadrants (i.e. does not switch the low side transistors synchronously).

Or use a software control over in which of the quadrants the drive operates and limit operation only to those two quadrants (no regenerative braking allowed).
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: DC motor driver problems
« Reply #5 on: February 07, 2019, 12:00:59 am »
Use a boost converter to get 6V for the motor supply.  The diode in it will prevent the braking spikes getting back onto USB Vbus, and it will be far more tolerant of low Vbus caused by low host 5V rail, worn connectors or long cables.

I'd still put a 6.8V Zener across the output to dump the breaking energy though.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: DC motor driver problems
« Reply #6 on: February 07, 2019, 06:17:25 am »
That is also a rather simple and effective approach. If the motor is small, then a decently sized zener / TVS may gulp all the braking energy fine.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: DC motor driver problems
« Reply #7 on: February 07, 2019, 07:08:35 am »
Well it cant be a *BIG* motor or it couldn't be USB powered at 5V in the first place.   Therefore a comparator circuit driving a MOSFET to cut in a honking great big braking resistor is definitely overkill unless its got to be capable of braking against an external driving force.  If the dissipation is a bit more than is convenient for a simple zener, add a power BJT to form an amplified zener.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: DC motor driver problems
« Reply #8 on: February 07, 2019, 07:10:20 am »
It is not about the power of the motor, but the inertia it is driving. I am sure you could spin up some pretty large inertia even with the USB power available  :)
 

Offline gaminnTopic starter

  • Frequent Contributor
  • **
  • Posts: 339
  • Country: 00
Re: DC motor driver problems
« Reply #9 on: February 07, 2019, 11:39:15 am »
Use a driver circuit, that can work only in I. and III. quadrants (i.e. does not switch the low side transistors synchronously).

Or use a software control over in which of the quadrants the drive operates and limit operation only to those two quadrants (no regenerative braking allowed).

Thanks. You are right. I modified my controller - as you write, the worst spikes existed when the motor was rotating one way and I reversed voltage to make it rotating the other way immediatelly (at that moment it worked in 2nd and 4th quadrant). Now when I want to change direction, I first look at the speed of the motor (I have encoder connected to the shaft) - if it is rotating the other way I brake it first by switching on both low side fets.

Now the worst spikes are gone.

Use a boost converter to get 6V for the motor supply.  The diode in it will prevent the braking spikes getting back onto USB Vbus, and it will be far more tolerant of low Vbus caused by low host 5V rail, worn connectors or long cables.

I'd still put a 6.8V Zener across the output to dump the breaking energy though.

I will think about that. After the modification of driving algorithm I still see spikes on the Vm - they are short and they are appearing when the current path (high side fet, motor, low side fet) is interrupted by switching fets off. Obviously these are spikes across inductive load (motor winding) when it is switched off. 470 uF bulk cap eliminates them, but such a high capacitance on USB is out of specs. That boost converter would work to eliminate these spikes... or anything that can isolate USB and Vm.

EDIT: I think a good solution for me would be some load switch with reverse current protection that can withstand at least 10 V on output. Would be nice, if it also has current limit adjustable to 700 mA...
« Last Edit: February 07, 2019, 12:19:15 pm by gaminn »
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: DC motor driver problems
« Reply #10 on: February 07, 2019, 12:55:47 pm »
470uF is not out of USB spec, if you use a suitable soft-start circuitry, to pre-charge the cap. (I'd use a high side PMOS switch and a resistor crossing it).
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3857
  • Country: nl
Re: DC motor driver problems
« Reply #11 on: February 07, 2019, 01:17:53 pm »
It seems you went through quite a learning curve in only just a few hours.

Big capacitors directly on the USB bus are bad because of very high surge currents through the connector at the moment they are not properly mated yet.
Just take a regular power supply with banana cables and put it's output voltage directly to a big cap. Currents can be so high that a (very small part) of the metal melts and the banana plug welds to the capaitor wire.

On the other hand. Big buffer caps are good for motor drivers.

A simple option is to add a small P-channel MOSfet in the 5V USB line and switch it very slowly with an RC on the gate. Just extending the charge time of the bulk Elco to 10ms or so makes a significant difference, but ideally you should keep the charge current within the USB spec. If this MOSfet switch is under uC controll you can also turn it on only after the connectors are properly mated. With these precautions you can easily put extremely big capactiors on an USB bus.

Or you put a resistor between the Raw USB input and your buffer elco's (Few 100 Ohm) and turn the MOSfet on to short that resistor once your Bus voltage has risen far enough. (See ADC below).

A big bulk capacitor also flattens the voltage peaks when the motor is braked.
Your motor has an encoder, and apparently you are already monitoring it's speed. With a properly implemented PID control there will be no more high current spikes or abrupt braking, and no need to add more hardware to mitigate this.

But during testing, or when the PID controller fails and the brake energy is so high that it can be problematic a very common way is to add a brake resistor with a (MOSfet) switch over the Bulk capacitor.
These brake resistors are very common with high power 3-phase inverters of multiple kW.
Just typing "brake resistor" into Ali gives a whole lot of hits:
https://www.aliexpress.com/wholesale?SearchText=brake+resistor

With a small motor a beefy Zener is good enough.
Other options can be based on a TL431, a power transistor and a resistor, or you can measure the bus voltage with the ADC of your uC and turn on the brake resistor if needed in software.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8789
  • Country: fi
Re: DC motor driver problems
« Reply #12 on: February 07, 2019, 01:41:03 pm »
As others have explained, your motor driver is working as a boost converter, converting the low motor back-EMF voltage to your 5V bus voltage. With little load on the 5V bus, it starts to rise.

The right and easy way to deal with this is to sense the DC bus voltage with your microcontroller (or whatever is driving the signals), for example by connecting a resistor divider to the ADC input, if available, or just any comparator circuit.

When you detect over-voltage (e.g., over 5.5V), disable the motor driver EN signal: this stops the regeneration and lets the motor coast freely.

Adding some electrolytic capacitance on the DC bus slows down the voltage rise so that the requirements for your safety circuit reaction speed are relaxed. The combination of high-capacitance, high-ESR (i.e., electrolytic), and small-capacitance, low-ESR, low-inductance (i.e., ceramic) local bypassing, is highly recommendable anyway.

There is still one caveat: if there is an external force that drives the motor quickly enough (actually quicker than it would rotate with your 5V supply at 100%!) - then it will still generate voltage which gets to your DC link through the freewheeling diodes. Often this is not a problem since it doesn't happen with just inertia, but bear this in mind if the user is capable of rotating the motor quickly. Very relevant in vehicles that may go downhill, for example.
 

Offline gaminnTopic starter

  • Frequent Contributor
  • **
  • Posts: 339
  • Country: 00
Re: DC motor driver problems
« Reply #13 on: February 07, 2019, 06:12:58 pm »
A simple option is to add a small P-channel MOSfet in the 5V USB line and switch it very slowly with an RC on the gate. Just extending the charge time of the bulk Elco to 10ms or so makes a significant difference, but ideally you should keep the charge current within the USB spec. If this MOSfet switch is under uC controll you can also turn it on only after the connectors are properly mated. With these precautions you can easily put extremely big capactiors on an USB bus.

I will probably do it this way as this solution seems to be the cheapest and from what I tested I can see it helps enough.

When you detect over-voltage (e.g., over 5.5V), disable the motor driver EN signal: this stops the regeneration and lets the motor coast freely.

This is not possible - I can't leave motor out of control. My device then wouldn't work as intended. I just have to eliminate the overvoltage, it can't happen

There is still one caveat: if there is an external force that drives the motor quickly enough (actually quicker than it would rotate with your 5V supply at 100%!) - then it will still generate voltage which gets to your DC link through the freewheeling diodes. Often this is not a problem since it doesn't happen with just inertia, but bear this in mind if the user is capable of rotating the motor quickly. Very relevant in vehicles that may go downhill, for example.

Fortunately, this can't happen during normal operation of my device.

 

Offline VanitarNordic

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: 00
Re: DC motor driver problems
« Reply #14 on: July 17, 2019, 09:11:55 am »
try to build this circuit

« Last Edit: July 17, 2019, 12:10:05 pm by VanitarNordic »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf