Motor shield question

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

Moderators: adafruit_support_bill, adafruit

Motor shield question

Postby DaveOregon » Thu Nov 22, 2012 1:18 am

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
Picture1.jpg
Here's the "motor party" set up
Picture1.jpg (233.2 KiB) Viewed 810 times
DaveOregon
 
Posts: 19
Joined: Fri Aug 24, 2012 2:27 pm


Re: Motor shield question

Postby DaveOregon » Thu Nov 22, 2012 4:48 pm

stepperAndDCmotor.jpg
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 775 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
stepper.jpg
The stepper motor on the scanner
stepper.jpg (37.49 KiB) Viewed 775 times
DaveOregon
 
Posts: 19
Joined: Fri Aug 24, 2012 2:27 pm

Re: Motor shield question

Postby adafruit_support_bill » Fri Nov 23, 2012 6:36 am

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
adafruit_support_bill
 
Posts: 16640
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor shield question

Postby DaveOregon » Fri Nov 23, 2012 11:11 pm

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
FrontOfMotorShield.jpg
Front of shield
FrontOfMotorShield.jpg (189.23 KiB) Viewed 735 times
backOfMotorShield2.jpg
back of shield, photo 2
backOfMotorShield2.jpg (63.1 KiB) Viewed 735 times
backOfMotorShield1.jpg
Back of shield, photo 1
backOfMotorShield1.jpg (65.06 KiB) Viewed 735 times
DaveOregon
 
Posts: 19
Joined: Fri Aug 24, 2012 2:27 pm

Re: Motor shield question

Postby adafruit_support_bill » Sat Nov 24, 2012 6:52 am

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
adafruit_support_bill
 
Posts: 16640
Joined: Sat Feb 07, 2009 9:11 am


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: No registered users and 5 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [114]

Raspberry Pi[82]
 
FLORA[24]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[12]
Arduino[60]
 
NETduino[14]
 
Android[6]
 
BeagleBone[23]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[39]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[9]


 
Breakout Boards[35]
LCDs & Displays[49]
Components & Parts[70]
Batteries & Power[54]
EL Wire/Tape/Panel[52]
LEDs[112]
 
Wireless[16]
Cables[66]
 
Lasers[6]
Sensors/Parts[147]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[41]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[25]


 
Stickers[41]
 
Skill badges[55]
 
Books[26]
 
Circuit Playground[7]
 
Gift Certificates[4]