0

Motor shield cutting out
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Motor shield cutting out

by johnpark on Wed Mar 25, 2009 2:28 pm

I'm scratching my head over this. I've got a motor shield powering an HO train as seen here:
http://www.youtube.com/watch?v=OAfjMWR0J_w
I'm set up with a 9V for the Arduino (Duemilanove) power, and the rail voltage (around 12V, but variable with the track transformer) fed into the EXT terminals on the motor shield. The shield's power jumper is off, so I should be getting the optimal logic vs. motor power supply, right?
I'm running the sample sketch which loops up to 255 and back to zero forward, then does it in reverse, pauses, repeats. This works perfectly fine with little DC motors, so I think the shield's health. On the train it works pretty well, but sometimes it cuts off voltage to the motor as it reaches top speed. It seems like the Arduino is not being reset, and the power LED on the motor shield remains lit. If I wait a few seconds it seems to resume normal operation.
I've read these forums and Limor's advice, so I doubled up on M3 & M4 in case current draw was too high (I measured it at ~400 mA). This seems to have improved things a lot, but there are still cases where it behaves erratically, cutting power as it approaches top speed.
I'm planning to piggyback another h-bridge chip on there tonight, and switch the cruddy little transformer out for a regulated supply, but wonder if anyone can offer additional suggestions.
Thanks,
John

johnpark
 
Posts: 24
Joined: Wed Mar 25, 2009 2:15 pm

Re: Motor shield cutting out

by adafruit on Wed Mar 25, 2009 6:01 pm

your power settings sound good
try the piggyback chip trick, id say

adafruit
 
Posts: 12131
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Motor shield cutting out

by macegr on Wed Mar 25, 2009 6:06 pm

Are you absolutely certain the Arduino is not being reset? A pause of a few seconds then resuming normal operation does bring to mind an unexpected reset issue. Also, have you soldered a small capacitor across the motor terminals to reduce the noise coming back through the power leads?

You may also be running into thermal shutdown. 400mA is close enough to the 600mA maximum that you may be seeing thermal shutdown if no heatsinking is used. And under what conditions did you measure the motor current? If you measure it while the train is actually moving and pulling a load, that would be accurate...if you did a bench test the measurement is probably low.
macetech LLC - http://www.macetech.com
User avatar
macegr
 
Posts: 292
Joined: Fri Apr 04, 2008 4:46 pm

Re: Motor shield cutting out

by johnpark on Wed Mar 25, 2009 7:54 pm

Limor, I'll piggyback that on tonight. I'm thinking it would be super freaky looking to do a tower of them, 12 chips high :)

Macegr, first of all, you're a ninja. You thought I wouldn't notice?
My only reason so far for thinking it isn't a reset is that I watched for the lights to flash on the Arduino and they didn't. I probably could use a more failproof method, huh?

I haven't added a capacitor across the motor. Any recommendation on type and size?

Nothing feels hot to the touch, so I guessed it wasn't thermal shutdown. I measured under load, by slowing the powered wheels to a crawl, letting them go, etc.

So, here's what I'll try next: piggybacked h-bridge, capacitor across the motor terminals, regulated power supply, Barry White with the Quiet Storm on the HiFi.
-John

johnpark
 
Posts: 24
Joined: Wed Mar 25, 2009 2:15 pm

Re: Motor shield cutting out

by macegr on Wed Mar 25, 2009 8:27 pm

Hmm, .01uF is a decent choice.

Now it's been a while since I had to do motor driver calculations, but when an H bridge is operating, two transistors are active. Each transistor is going to drop about 1.2 volts. So for one motor, your dissipated power is 2 * 1.2V * 0.4A = 0.96 watts. The maximum junction temperature is 150C and the package dissipation is 67C/W. So at 400mA continuous, you need to maintain the L293D package at less than 86C. However, you're doing PWM...as mentioned in earlier threads in this forum, pulsing current to a DC motor can make a difference. There is a high inrush current resulting in high local heating, which takes time to dissipate through the package. And the more you switch transistors, the more they spend time in their non-saturated region, where the voltage drop on each transistor is a lot higher.

You may want to play with the motor library's frequency settings. If you have it set to a high frequency now, try something lower.
macetech LLC - http://www.macetech.com
User avatar
macegr
 
Posts: 292
Joined: Fri Apr 04, 2008 4:46 pm

Re: Motor shield cutting out

by johnpark on Wed Mar 25, 2009 9:02 pm

Thanks, I'll give the frequency a look while I'm at it.

johnpark
 
Posts: 24
Joined: Wed Mar 25, 2009 2:15 pm

Re: Motor shield cutting out

by johnpark on Thu Mar 26, 2009 12:01 am

Alright, I piggybacked the chip, which is probably good because I may move up to a larger scale locomotive with bigger current needs, but it didn't change much about this thing cutting out.
The capacitor, however, did the trick! Thank you so much for the help!

johnpark
 
Posts: 24
Joined: Wed Mar 25, 2009 2:15 pm

Re: Motor shield cutting out

by macegr on Thu Mar 26, 2009 12:14 am

Not a problem, John...keep up the good work!
macetech LLC - http://www.macetech.com
User avatar
macegr
 
Posts: 292
Joined: Fri Apr 04, 2008 4:46 pm

Re: Motor shield cutting out

by adafruit on Thu Mar 26, 2009 12:36 am

im going to put this in the FAQ!

adafruit
 
Posts: 12131
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Motor shield cutting out

by johnpark on Thu Mar 26, 2009 12:38 am

That's great Limor! Here's how my friend Tod Kurt described it:
The brushes/bushings in a DC motor kinda skip and bounce as the motor turns. makes lots of really fast on/off connections. an upstream controller might get cranky dealing with that. (a battery wouldn't care, but looks like an L293D does)

johnpark
 
Posts: 24
Joined: Wed Mar 25, 2009 2:15 pm

Re: Motor shield cutting out

by adafruit on Thu Mar 26, 2009 12:43 am

yeah unfortunately im really not a robotgeek. i know like 0 about motors and stuff :(

adafruit
 
Posts: 12131
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Motor shield cutting out

by johnpark on Thu Mar 26, 2009 12:51 am

I'm with you on that -- I'm learning trial-by-fire style as I go down the road of this current project.

johnpark
 
Posts: 24
Joined: Wed Mar 25, 2009 2:15 pm

Re: Motor shield cutting out

by johnpark on Thu Mar 26, 2009 12:59 am

I'll also add that the ultra-crappy, unregulated, spiteful transformer that I was using also seems to have contributed to the problem. I don't think the motor shield likes being starved, and this thing's voltage was dipping all over the place under load. I put a 12V lead-acid battery on there and it's much happier. Ultimately I'll use a regulated 12V power supply.

johnpark
 
Posts: 24
Joined: Wed Mar 25, 2009 2:15 pm

Re: Motor shield cutting out

by adafruit on Thu Mar 26, 2009 11:52 am

yup! it seems like powersupplies are 90% of robotics :)

adafruit
 
Posts: 12131
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Motor shield cutting out

by JBRobotDenn on Sun Aug 23, 2009 11:29 am

My son and I are working on our first robot project. We are having the same problem but this solution “almost” works. If we touch the capacitor then the motors run clean. As soon as we release the capacitor it jumps and jerks or doesn’t work at all. Any help you could provide would be great. Here are our spces.:

1- Solarbotics GM9 motors driven by a 10 Volt lithium ion external power source and running the Arduino Duemilenove off of a separate 9 Volt battery.
2- One motor is hooked up to Motor 1 and the other is connected to Motor 4.
3- The capacitors we are using are .1 uF and we have even tried .01 uF. With one .01 uF capacitor the motor will work if you touch the capacitor and if we use a .1 uF capacitor we have the same problem touch the capacitor and it works let go and it stops. We even tried 2 capacitors one .1 uF and one .01 uF and the problem still isn’t fixed. We also tried putting a 1M resistor between the capacitor terminals thinking that our bodies might be causing some resistance between the terminals this didn’t help either.
4- Here is the code we are using to test the motors with:
Code: Select all | TOGGLE FULL SIZE
#include <AFMotor.h>

AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
 
  motor.setSpeed(200);     // set the speed to 200/255
}

void loop() {
  Serial.print("tick");
 
  motor.run(FORWARD);      // turn it on going forward
  delay(1000);

  Serial.print("tock");
  motor.run(BACKWARD);     // the other way
  delay(1000);
 
  Serial.print("tack");
  motor.run(RELEASE);      // stopped
  delay(1000);
}


Thanks for any help you can provide.
JBRobotDenn
 
Posts: 3
Joined: Sun Aug 23, 2009 10:49 am

Please be positive and constructive with your questions and comments.