Motor shield question

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
daveoregon
 
Posts: 31
Joined: Fri Aug 24, 2012 3:27 pm

Motor shield question

Post by daveoregon »

Hi, My motor shield seems to be working, except for the servo. I had been hoping that the shield would allow me to run a reasonably-sized stepper (as the one from the scanner shown in the photo, loaded and able to drive the scanner "sled" along its slider bar) and DC motor (I used a dinky one from a CD player in the photo, but would like to be able to drive larger ones, and move printer carriages back and forth), but see that the 1 amp limit (at least for steady-state current) will be quite limiting.

Any advice on how to get a more "industrial" version of this board, to be able to move bigger loads without eventually frying the chips?

I noticed that the motor drivers were *not* getting warm (at least warm enough for me to sense with my finger), even though they were (I think) supplying much more than 1 amp. (My power supply indicated it was supplying more than 5 Amps at 4.5 Volts when I ran the stepper from the scanner, which was not attached to the scanner belt; i.e. the motor was under very little load.)

I'll spend some more time trying to figure why the servo was not working, I have had success driving servos straight from the Arduino in the past, but have had jitter/stability issues.

Thanks in advance for your help.

"Motor party" code is here:

Code: Select all

// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>
#include <Servo.h> 

// DC motor on M2
AF_DCMotor motor(2);
// DC hobby servo
Servo servo1;
// Stepper motor on M3+M4 48 steps per revolution
AF_Stepper stepper(48, 2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor party!");
  
  // turn on servo
  servo1.attach(9);
   
  // turn on motor #2
  motor.setSpeed(200);
  motor.run(RELEASE);
}

int i;

// Test the DC motor, stepper and servo ALL AT ONCE!
void loop() {
  motor.run(FORWARD);
  for (i=0; i<255; i++) {
    servo1.write(i);
    motor.setSpeed(i);  
    stepper.step(1, FORWARD, INTERLEAVE);
    delay(3);
 }
 
  for (i=255; i!=0; i--) {
    servo1.write(i-255);
    motor.setSpeed(i);  
    stepper.step(1, BACKWARD, INTERLEAVE);
    delay(3);
 }
 
  motor.run(BACKWARD);
  for (i=0; i<255; i++) {
    servo1.write(i);
    motor.setSpeed(i);  
    delay(3);
    stepper.step(1, FORWARD, DOUBLE);
 }
 
  for (i=255; i!=0; i--) {
    servo1.write(i-255);
    motor.setSpeed(i);  
    stepper.step(1, BACKWARD, DOUBLE);
    delay(3);
 }
}
Attachments
Here's the &quot;motor party&quot; set up
Here's the "motor party" set up
Picture1.jpg (233.2 KiB) Viewed 1657 times

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor shield question

Post by adafruit_support_bill »

See the "I Need More Power" section of this FAQ: http://forums.adafruit.com/viewtopic.php?f=31&t=26873

User avatar
daveoregon
 
Posts: 31
Joined: Fri Aug 24, 2012 3:27 pm

Re: Motor shield question

Post by daveoregon »

Motor shield can drive either the scanner bed (stepper) or CD rack (DC motor)...in the photo the latter is connected
Motor shield can drive either the scanner bed (stepper) or CD rack (DC motor)...in the photo the latter is connected
stepperAndDCmotor.jpg (143.23 KiB) Viewed 1622 times
Very good, thanks. I realize now I was mis-reading my ammeter and the current draws were much smaller: 4.5Volts & 0.65 Amps for the scanner, and 5V & 0.15-0.2Amps for the CD player DC motor. I can run the scanner sled back and forth OR run the CD rack in and out, success!

My Heathkit variable power supply (20V, 0.5A rating) is able to handle one of these at a time, but not both, at least not both consistently. I still have not succeeded in getting the servos to work, though the pins are powered, and I've tried running them alone (no stepper or DC motor at the "party").

Based on the FAQ page, I'll try powering the servos independently.

What is the maximum external voltage I can safely apply to the motor shield? As I mentioned, my variable DC power supply has a 20V, 0.5Amp rating....I usually set it at 9Volts and "get what I get" for amperage.

Thanks!
Attachments
The stepper motor on the scanner
The stepper motor on the scanner
stepper.jpg (37.49 KiB) Viewed 1622 times

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor shield question

Post by adafruit_support_bill »

I still have not succeeded in getting the servos to work,
If you post photos of the front & back of the board, we'll check for any assembly issues.
What is the maximum external voltage I can safely apply to the motor shield?
It will handle up to 25v with the stock capacitors. If you upgrade C7 & C8 to higher voltage ratings, the H-bridges will take up to 36v.

User avatar
daveoregon
 
Posts: 31
Joined: Fri Aug 24, 2012 3:27 pm

Re: Motor shield question

Post by daveoregon »

Thanks for the info and help. Attached please find images of the front and back of the shield, wired up to run a DC motor.

Any assistance/advice on what I need to get the servos working is much appreciated!
Attachments
Front of shield
Front of shield
FrontOfMotorShield.jpg (189.23 KiB) Viewed 1582 times
back of shield, photo 2
back of shield, photo 2
backOfMotorShield2.jpg (63.1 KiB) Viewed 1582 times
Back of shield, photo 1
Back of shield, photo 1
backOfMotorShield1.jpg (65.06 KiB) Viewed 1582 times

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor shield question

Post by adafruit_support_bill »

From what I can see, the soldering looks fine. Double check digital pins 9 and 10, as well as the servo header to be sure.
* Make sure that you have the servos connected to the right ports: Servo 2 is controlled by pin 9. Servo 1 is controlled by pin 10.
* Make sure you have the servos plugged in correctly. The signal wire (yellow or white) should be on the same side as the "SER1/SERVO2" label.
If it still doesn't work, post the code you are using.

User avatar
daveoregon
 
Posts: 31
Joined: Fri Aug 24, 2012 3:27 pm

Re: Motor shield question

Post by daveoregon »

I love this motor shield, have gotten lots of good use out of it with both steppers and DC motors....presently have an app in which I think I may have damaged the analog input pins. I have a pressure transducer which can provide a negative output voltage which I fed into A0. How negative a voltage can I put into an analog output on this board and not have trouble? Thanks.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor shield question

Post by adafruit_support_bill »

A negative voltage on an analog input will not damage the shield itself. It will damage the Atmega 328P processor on your Arduino.

According to the Atmega 328 data sheet: http://www.atmel.com/Images/doc8161.pdf
The absolute maximum range of voltages on any pin is -0.5v to 5.5v. Beyond that, "may cause permanent damage to the device"

Fortunately, unless you have one of the SMT versions of the Uno, your processor chip is replaceable for $5.95 : http://www.adafruit.com/products/123

User avatar
daveoregon
 
Posts: 31
Joined: Fri Aug 24, 2012 3:27 pm

Re: Motor shield question

Post by daveoregon »

Thanks, that worked.

Now I have a version 2.0 motor shield.

I have it mounted on an Arduino mega and when I attempt to upload code (e.g. Motor party) it takes a VERY long time and then I receive this message:

avrdude: stk500_getsync(): not in sync: resp=0x00

What's the matter?

Thanks

User avatar
daveoregon
 
Posts: 31
Joined: Fri Aug 24, 2012 3:27 pm

Re: Motor shield question

Post by daveoregon »

Thanks, I figured out, I had the board set to the wrong version of the Mega (I use the 2560)

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”