Motor doesn't run continuously

by aardbot on Sun Nov 15, 2009 1:43 am

Hello. I'm running into some problems with my motor shield. The motor doesn't run continuously as it should, it pulses anywhere from 250ms to 2 seconds but in my sketch, I am telling it to go forward for 3 seconds.

Code: Select all | TOGGLE FULL SIZE
#include <AFMotor.h>
AF_DCMotor motor(4, MOTOR12_64KHZ);

void setup() {
  Serial.begin(9600);
  Serial.println("Motor test!");
  motor.setSpeed(200);
}

void loop() {
  Serial.println("forward");
  motor.run(FORWARD);
  delay(3000);

  Serial.println("release");
  motor.run(RELEASE);
  delay(1000);
}


I tried putting a 0.1uF capacitor between the motor leads as suggested in posts: viewtopic.php?f=31&t=12012 and viewtopic.php?f=31&t=10290 but it doesn't make a difference. If I touch the capacitors, it makes it spin a bit longer initially but still not to 3 seconds and eventually it goes back to the short pulses. Could my finger tips be holding a charge? Stranger still is when I try to measure the voltage across the motor leads, the motor will run for the full 3 seconds initially but eventually it will also go back to the short pulses after testing for about 10-15 seconds.

I'm using a separate power source for the motor shield connected to EXT_PWR. I tried 7.2V, 9V, 12V at 350mA and 1A with no difference.

A couple of more observations:
- When I set the frequency to MOTOR12_1KHZ, the motor doesn't even pulse. This happens on M1 and M4 even though M4 is only suppose to run at MOTOR12_1KHZ.
- I tested it out on an Arduino Mega and Duemilanove with no difference.
- The Arduino itself doesn't appear to be resetting since the setup() messages are not repeating, just the messages within loop()
- A servo connected to the shield is working correctly
- The L293D feels a bit warm but not hot after testing for about 2-3 minutes. Is this normal?


The motor didn't come with any specs except the input voltage should be 3-12V. I purchased it from robotshop.ca as part of the DFRobot 4WD Arduino Mobile Platform, (http://www.robotshop.ca/dfrobot-4wd-ard ... orm-3.html). I think it is a Solarbotics GM2 which free runs at 52mA and stalls at 600mA which is within the specs of the motorshield.

Anyways, I'm lost as what I should do next. Any help would be appreciated. Thanks.
aardbot
 
Posts: 5
Joined: Fri Nov 13, 2009 8:52 pm
Location: Singapore

Re: Motor doesn't run continuously

by adafruit on Sun Nov 15, 2009 3:32 pm

interesting. it sounds like the board is fine. but lets try to debug it a little. first off, set the speed to 255. then dont call release ever. what happens?
User avatar
adafruit
 
Posts: 11642
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Motor doesn't run continuously

by aardbot on Sun Nov 15, 2009 7:38 pm

Setting the speed to 255 with and without the motor.run(RELEASE) statement made no difference.

I used IC sockets for the 3 chips without realizing there could be a heat issue (viewtopic.php?f=31&t=13169). Could the L293D be blown? Would the green LED on the shield even turn on if one of the chip was burnt? I ordered some spare L293Ds and heatsinks just in case.

If I was to piggyback two L293D's onto an IC socket would a heatsink still be required? Would a single heatsink on the top IC be sufficient?

Thanks for your help.
aardbot
 
Posts: 5
Joined: Fri Nov 13, 2009 8:52 pm
Location: Singapore

Re: Motor doesn't run continuously

by adafruit on Sun Nov 15, 2009 8:10 pm

hmm. its inclear. it doesnt -sound- like its overheating but it does have internal protection. sockets shouldnt matter to much. if you dont ever 'release' does it turn on and off ever few seconds or...?
User avatar
adafruit
 
Posts: 11642
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Motor doesn't run continuously

by aardbot on Mon Nov 16, 2009 4:14 am

It doesn't make a difference whether I have the release statement or not. The motor runs for about a second and then dies. The motor starts again after the delay(3000) has completed due to loop().

As mentioned in my first post, when I measured the voltage across the motor leads, the motor would run longer but eventually stops. The speed at that time was 200. Now, with the speed at 255 and no release, when I measure the voltage, it would run continuously longer, 2-3 seconds (maybe even 4 seconds) before stopping. The voltage across the motor leads measures around 7V with 9V to EXT_PWR and speed=255.
aardbot
 
Posts: 5
Joined: Fri Nov 13, 2009 8:52 pm
Location: Singapore

Re: Motor doesn't run continuously

by adafruit_support_bill on Mon Nov 16, 2009 6:10 am

Can you measure the current the motor is drawing when it runs?

If you are pulling enough current to trip the internal protection in 2-3 seconds, the outside of the chip won't have time to get real hot.
User avatar
adafruit_support_bill
 
Posts: 28090
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor doesn't run continuously

by aardbot on Mon Nov 16, 2009 9:21 am

I'm still pretty new with all this motor stuff so I'm not sure if I'm measuring the current correctly. This is what I did...

With a 100 ohm resistor on a breadboard connected between one motor lead and one terminal on M1, I measured the voltage across the resistor which was 7.6V. Using Ohm's Law, that worked out to 76mA which seems plausible except my motor wouldn't run. Thinking the resistance might be too high, I got rid of the resistor and tried measuring the current directly (with the DMM between the motor and M1) but the motor still wouldn't run though this time I can feel the motor pulse weakly every so often. Then, I tried using a 22 ohm resistor and guess what? The motor ran continuously! The voltage across the 22 ohm was 4.9V (i.e. 223mA) which seems a bit high but at least it's running. So, I removed the resistor and now the motor is connected directly to M1 via the breadboard and the motor still runs continuously. Great, it finally works I thought to myself, but now comes the part that really confuses me. I got rid of the breadboard, reconnected the motor leads directly to M1 and the motor reverts back to my original problem. Arrrrg! :cry:

So, now I'm really confused.
aardbot
 
Posts: 5
Joined: Fri Nov 13, 2009 8:52 pm
Location: Singapore

Re: Motor doesn't run continuously

by adafruit on Mon Nov 16, 2009 9:28 am

unfortunately we're not motor-experts to this extent, so we're not sure whats going on :( the only thing we remember is geared motors often need a cap across the leads. you could try contacting the motor or kit maker and say you're trying to drive it with a L293D (which is basically what the motor shield 'comes down to') and see if they have any hints?
User avatar
adafruit
 
Posts: 11642
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Motor doesn't run continuously

by adafruit_support_bill on Mon Nov 16, 2009 9:56 am

Does the voltage drop when the motor stops? This would indicate that the chip is shutting down. If not, you may be looking at a sticky gear-train. Sometimes these respond to a little light lube.
User avatar
adafruit_support_bill
 
Posts: 28090
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor doesn't run continuously

by aardbot on Mon Nov 16, 2009 8:07 pm

Guess what? It works! :D But I didn't do anything different! :?

I was about to measure the voltage drop as arduwino suggested and everything seemed to be working properly now. I suppose I should be happy but I have this nagging feeling the next time I try it again or when I try it with the other motors, the same problem is going to show up again. Maybe it was a sticky gear-train that finally loosened after all this testing.

Thanks adafruit and arduwino for your help. I'll post a followup if I ever confirm what the problem was.
aardbot
 
Posts: 5
Joined: Fri Nov 13, 2009 8:52 pm
Location: Singapore

Re: Motor doesn't run continuously

by scott.metoyer on Thu Mar 25, 2010 10:50 pm

I ran into this same problem with the DFRobot 4WD Arduino Mobile Platform.

My solution was .1uF caps across all four motors. Once I did this, the motors ran much more consistently (although still not 100%). I also noticed that the stall current for the yellow motors that come with this base can be as high as 2.5 amps (at 12 volts). Running them at 3 volts produces a way more manageable 120mA no-load current, although the stall is still 1.5 amps.

If I run the motors ~3 volts, and with the addition of the caps, I get near-perfect performance. I've posted a quick review of the mobile platform that talks about this and a few other issues I had with it on my blog:

http://www.scottmetoyer.com/archives/dfrobot-4wd-arduino-mobile-platform/

Hopefully it helps someone out.
scott.metoyer
 
Posts: 1
Joined: Thu Mar 18, 2010 10:37 pm

Re: Motor doesn't run continuously

by wgheller on Sat Jan 12, 2013 1:48 pm

I'm experiencing a similar problem with the motors running continuously. They rotate maybe 1 degree and immediately stop with each motor4.run command (code is below).

Components:
    DFRobot 4WD kit
    Adafruit Motor Shield (came pre-assembled from AdaFriut) - I've used it successfully on other projects
    Arduino Uno v3 used it successfully on other projects.
    I have the .1uF capacitors soldered across the motor terminals.

I'm powering the arduino separately from the motor shield.
motor shield is powered by 5 rechargeable batteries. I get about 6.7v at the Ext Pwr input on the shield.
With the code running and the motor unattached to the shield, I see about 6.5v at the M4 motor terminals. With the motor attached I barely see any voltage there but it does spike when the motor.run command is executed.

When I attach the motors directly to the 6.71v power source then run perfectly well.

Any suggestions on what I can try next to isolate this problem?
Scott, I left a similar request for assistance on your blog as well.

Thank you!

Code: Select all | TOGGLE FULL SIZE
 #include <AFMotor.h>

    AF_DCMotor motor4(4, MOTOR34_8KHZ); // I've tried using all combinations of the second parameter and the behavior is the same regardless of the value used.

    void setup() {
      Serial.begin(9600);           
      Serial.println("Motor test!");
      motor4.setSpeed(255);     
}

void loop() {
    Serial.print("Forward");
    motor4.run(FORWARD);     
    delay(10000);
    Serial.print("Release");
    motor4.run(RELEASE);
    delay(1000);
    Serial.print("Backward");
    motor4.run(BACKWARD);     
    delay(10000);
    Serial.print("Release");
    motor4.run(RELEASE);
    delay(1000);
}
wgheller
 
Posts: 3
Joined: Sat Nov 24, 2012 4:05 pm

Re: Motor doesn't run continuously

by adafruit_support_rick on Sat Jan 12, 2013 2:12 pm

Where did you buy your motor shield? Can you post a picture of it?
User avatar
adafruit_support_rick
 
Posts: 10875
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Motor doesn't run continuously

by wgheller on Sun Feb 03, 2013 1:38 pm

Sorry for the delayed reply.
I purchased it from Adafruit via Amazon.
It came pre-assembled.
Attachments
photo (4).JPG
Motor Shield From Top
photo (4).JPG (659.34 KiB) Viewed 1221 times
photo (2).JPG
Motor Shield From Below
photo (2).JPG (758.75 KiB) Viewed 1221 times
wgheller
 
Posts: 3
Joined: Sat Nov 24, 2012 4:05 pm

Re: Motor doesn't run continuously

by adafruit_support_bill on Mon Feb 04, 2013 5:50 am

Adafruit does not sell preassembled shields on Amazon. This is not an Adafruit shield. You should contact the vendor for technical support.
User avatar
adafruit_support_bill
 
Posts: 28090
Joined: Sat Feb 07, 2009 9:11 am