BrendonShaw
Posts: 89
Joined: Sat Jun 30, 2012 7:53 am

L293 dc motor - quick switch from forward to reverse problem

Fri Jul 25, 2014 6:54 am

i am working on a four motor chassis project and use two l293d motor drivers IC's. I have used them before, without any problems and checks everything is hook up correctly.

The problem seems to be when I switch the motor driver from forward direction to reverse direction, I am getting a high current/voltage dip which is resetting the Arduino. I was wondering if any one else has experienced the same problem and how to fix it.

I need to review the circuit, may be switching the motor is causing a temporary short and this is resetting the complete board. So adding some didoes in-line with the motors would eliminate this condition.

Also how can I test the current/voltage during this motor switch condition, would a scope on the supply pins show the dip in voltage?

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: L293 dc motor - quick switch from forward to reverse pro

Fri Jul 25, 2014 7:19 am

a motor's load is dependand on a few factors, when a motor is already turning it needs less current to maintain the spin than was needed to start it going. reversing an existing spin is a larger load and takes more current.

I would suggest that you transition through a brief stop command before reversing.
Doug.
Building Management Systems Engineer.

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: L293 dc motor - quick switch from forward to reverse pro

Fri Jul 25, 2014 8:06 am

The L293D chips contain the back-EMF diode, so that's not the problem.

Your motor is causing a voltage dip due to the high load, as BMSDoug says. Making more gentle changes in direction will help.

Maybe try putting the arduino and the motor controller on separate power leads. That is, one set of wires from the battery to the arduino, another totally separate pair all the way to the motor driver. That way the voltage dip might be more confined to the motor driver's part of the circuit.

Another possibility is a large capacitor (few thousand microfarads or larger, rated at the battery voltage) placed either near the arduino or at the battery connectors. This will either reduce the dip on the battery or directly at the arduino's supply.

Yes a scope on the voltage at the controller (and other points) should show you the voltage, but how you'd trigger it I don't know. (You might need a storage scope?) If so you should notice a difference after trying the things we've suggested.

PiGraham
Posts: 3665
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: L293 dc motor - quick switch from forward to reverse pro

Fri Jul 25, 2014 9:07 am

Inertia prevents instant reverse and trying to do that will cause high currents.
As already suggested separating the power to motors from the control system will avoid the reset. The simplest option is to use separate batteries.
You could limit the motor current. This could be a current liming PSU to supply the motor driver, or a current limiting ESC or a software conrtolled PWM profile to ramp up the reverse power.
You could stop before reversing, but you will stop quicker by applying reverse drive.
You could put a capacitor after a diode on the power to your controller that will supply enough energy to hold the voltage up during reverses. Supercaps are a possibility.
Another option could be a micro UPS (interruptible power supply) for the Arduino.

User avatar
Burngate
Posts: 6050
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: L293 dc motor - quick switch from forward to reverse pro

Fri Jul 25, 2014 12:01 pm

If you're wanting an electrical analogy, you can consider the moving mass as a charged capacitor, across the motor-winding and in series with its resistance.
Trying to reverse the motion is then just trying to discharge that capacitor and charge it up the other way. Naturally, a large current will flow.

Putting it into stop before reversing allows the charge to dissipate through the chip, without pulling the power supply down.

rgrbic
Posts: 128
Joined: Thu Jun 12, 2014 1:07 pm
Contact: Website

Re: L293 dc motor - quick switch from forward to reverse pro

Fri Jul 25, 2014 6:45 pm

Trying to reverse it by reversing power supply connection will require additional energy which will be drawn from power supply. Did you consider motor braking by putting the resistor across it which will dissipate the mechanical energy?
At 127.0.0.1
Twitter: @rgrbic
IoT-projects.com

Duane Degn
Posts: 55
Joined: Thu Jul 10, 2014 6:30 am
Location: Idaho, USA

Re: L293 dc motor - quick switch from forward to reverse pro

Fri Jul 25, 2014 6:59 pm

BrendonShaw wrote:Also how can I test the current/voltage during this motor switch condition, would a scope on the supply pins show the dip in voltage?
Yes, I scope would likely show the dip in voltage.

You don't need a short to cause this problem. Many of the suggestions already given should help.

Can you tell us more about your set up? What motors are you using (preferably with links). What sort of battery?
Is there a reason you want a quick change in direction? Ramping the speed as others have suggested will usually increase the life of a motor/gearbox while at the same time (probably) solving the reset issue.

I personally have several 4WD robots but I use big LiPo packs with them and I also ramp the speed of the motors.

Return to “Automation, sensing and robotics”