Driving DC motors with Adafruit motor shield V1.1

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
gwd
 
Posts: 12
Joined: Mon Jan 21, 2013 5:21 pm

Driving DC motors with Adafruit motor shield V1.1

Post by gwd »

How do I find or write code to run 4 small DC motors at one time?

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

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

Post by adafruit_support_bill »

We have not manufactured or sold the V1.1 shield for several years now. Where did you purchase your shield?

gwd
 
Posts: 12
Joined: Mon Jan 21, 2013 5:21 pm

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

Post by gwd »

I purgchased the Motor Shield Kit v1.1 from Makershed.com in Dec 2012

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

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

Post by adafruit_support_bill »

Hmmm. MakerShed should have the V1.2 boards. Can you post a photo of the board?

User avatar
arctic_eddie
 
Posts: 233
Joined: Tue Feb 28, 2012 6:01 pm

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

Post by arctic_eddie »

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?

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

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

Post by adafruit_support_bill »

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: 88039
Joined: Sat Feb 07, 2009 10:11 am

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

Post by adafruit_support_bill »

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);
  }
}

gwd
 
Posts: 12
Joined: Mon Jan 21, 2013 5:21 pm

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

Post by gwd »

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: 12
Joined: Mon Jan 21, 2013 5:21 pm

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

Post by gwd »

Hopefully, these pictures will post this time
P1010564.JPG
P1010564.JPG (156.5 KiB) Viewed 1491 times
P1010565.JPG
P1010565.JPG (155.5 KiB) Viewed 1491 times

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

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

Post by adafruit_support_bill »

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.

gwd
 
Posts: 12
Joined: Mon Jan 21, 2013 5:21 pm

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

Post by gwd »

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.

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

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

Post by adafruit_support_bill »

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

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

Return to “Arduino Shields from Adafruit”