Driving DC motors with Adafruit motor shield V1.1

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

Moderators: adafruit_support_bill, adafruit

Driving DC motors with Adafruit motor shield V1.1

Postby gwd » Mon Jan 28, 2013 8:58 pm

How do I find or write code to run 4 small DC motors at one time?
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 4:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

Postby adafruit_support_bill » Mon Jan 28, 2013 9:15 pm

We have not manufactured or sold the V1.1 shield for several years now. Where did you purchase your shield?
User avatar
adafruit_support_bill
 
Posts: 16642
Joined: Sat Feb 07, 2009 9:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

Postby gwd » Tue Jan 29, 2013 8:48 am

I purgchased the Motor Shield Kit v1.1 from Makershed.com in Dec 2012
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 4:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

Postby adafruit_support_bill » Tue Jan 29, 2013 8:57 am

Hmmm. MakerShed should have the V1.2 boards. Can you post a photo of the board?
User avatar
adafruit_support_bill
 
Posts: 16642
Joined: Sat Feb 07, 2009 9:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

Postby Arctic_Eddie » Tue Jan 29, 2013 9:10 am

I have a motor shield kit in my hand that I bought last year. The package says V1.1 with a web link:

http://adafruit.com/products/81

This shows a photo of your latest kit but it shows V1.0. My board is not the same as your photo and says V1.2.

What is the latest version?
Arctic_Eddie
 
Posts: 208
Joined: Tue Feb 28, 2012 5:01 pm
Location: St. Petersburg, FL

Re: Driving DC motors with Adafruit motor shield V1.1

Postby adafruit_support_bill » Tue Jan 29, 2013 9:48 am

1.2 is the latest version. It should be a blue board. Sounds like maybe the package labeling is a source of confusion. The product description should be updated too.

Thanks Arctic_Eddie!
User avatar
adafruit_support_bill
 
Posts: 16642
Joined: Sat Feb 07, 2009 9:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

Postby adafruit_support_bill » Tue Jan 29, 2013 9:54 am

Back to the original question:
How do I find or write code to run 4 small DC motors at one time?


You need to declare 4 different motors, one for each of the motor channels. Then you can command each motor by name.
Code: Select all
#include <AFMotor.h>

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");

  // turn on motor
  motor1.setSpeed(200);
  motor2.setSpeed(200);
  motor3.setSpeed(200);
  motor4.setSpeed(200);

  motor1.run(RELEASE);
  motor2.run(RELEASE);
  motor3.run(RELEASE);
  motor4.run(RELEASE);
}

void loop()
{
  uint8_t i;
 
  Serial.print("tick");
 
  motor1.run(FORWARD);
  motor2.run(BACKWARD);
  motor3.run(FORWARD);
  motor4.run(BACKWARD);
  for (i=0; i<255; i++)
  {
    motor1.setSpeed(i); 
    motor2.setSpeed(i); 
    motor3.setSpeed(i); 
    motor4.setSpeed(i); 
    delay(10);
  }
}
User avatar
adafruit_support_bill
 
Posts: 16642
Joined: Sat Feb 07, 2009 9:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

Postby gwd » Tue Jan 29, 2013 8:05 pm

My board is blue but the package says v1.1. I tried to post a picture but It did not post. I will try again. I uploaded the code that you suggested and got motors 1 and 2 to run but not motors 3 and 4. Your help is much appreciated in getting me headed in the right direction.
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 4:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

Postby gwd » Tue Jan 29, 2013 8:07 pm

Hopefully, these pictures will post this time
P1010564.JPG
P1010564.JPG (156.5 KiB) Viewed 481 times
P1010565.JPG
P1010565.JPG (155.5 KiB) Viewed 481 times
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 4:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

Postby adafruit_support_bill » Wed Jan 30, 2013 6:20 am

OK. That is a 1.2 board. The version number is printed just above the M1,M2 motor terminal block. You have the L293D for M3-M4 installed backwards. The notch needs to line up with the one on the silkscreen.
User avatar
adafruit_support_bill
 
Posts: 16642
Joined: Sat Feb 07, 2009 9:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

Postby gwd » Wed Jan 30, 2013 10:38 pm

I re-installed the L293D correctly but motors 3 & 4 still did not work . I then rotated the two to make sure it was not damaged, but I still get the same result. I really appreciate your time, suggestions and prompt replies.
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 4:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

Postby adafruit_support_bill » Thu Jan 31, 2013 6:21 am

It is hard to see in the photos, but you have a few solder joints that appear a little 'solder-starved' - including a couple of pins on that L293D. Take a close look and touch up any joints that look suspicious.

http://learn.adafruit.com/adafruit-guid ... n-problems
User avatar
adafruit_support_bill
 
Posts: 16642
Joined: Sat Feb 07, 2009 9:11 am


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: brocktane 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]
 
BeagleBone[23]
 
Android[6]
 
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]