0

Motor shield V2 issues--motor won't run despite arduino code
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Motor shield V2 issues--motor won't run despite arduino code

by Aub on Tue Dec 05, 2017 12:26 am

So the motor won't run when I activate the DC motor software test. I've made sure that:
The test code says it's uploading correctly, but nothing happens.
My power source is 4 AA batteries in series wired to the terminal on the board and the arduino board is USB powered.
I do have the DC brush motor connected to M1
The green LED is brightly lit.

Is there something I missed?

Aub
 
Posts: 6
Joined: Sun Dec 03, 2017 8:30 pm

Re: Motor shield V2 issues--motor won't run despite arduino

by adafruit_support_bill on Tue Dec 05, 2017 7:01 am

We need a little more information to assist you. Please post:
* Photos showing your soldering and connections.
* Electrical specifications for your motor.
* The code you are using.

adafruit_support_bill
 
Posts: 63471
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor shield V2 issues--motor won't run despite arduino

by Aub on Tue Dec 05, 2017 5:51 pm

Sorry for the late reply I was at school.
Image
[img]https://i.imgur.com/NG9gIQu.jpg/img]
Yeah, I didn't solder them I used hot glue to keep the wires in place. Sorry I know that's not ideal, but I made sure all the wires/pins were in contact.

I am using the test code for DC motors.
Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
// You can also make another motor on port M2
//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);

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

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
 
  // Set the speed to start, from 0 (off) to 255 (max speed)
  myMotor->setSpeed(150);
  myMotor->run(FORWARD);
  // turn on motor
  myMotor->run(RELEASE);
}

void loop() {
  uint8_t i;
 
  Serial.print("tick");

  myMotor->run(FORWARD);
  for (i=0; i<255; i++) {
    myMotor->setSpeed(i); 
    delay(10);
  }
  for (i=255; i!=0; i--) {
    myMotor->setSpeed(i); 
    delay(10);
  }
 
  Serial.print("tock");

  myMotor->run(BACKWARD);
  for (i=0; i<255; i++) {
    myMotor->setSpeed(i); 
    delay(10);
  }
  for (i=255; i!=0; i--) {
    myMotor->setSpeed(i); 
    delay(10);
  }

  Serial.print("tech");
  myMotor->run(RELEASE);
  delay(1000);
}


I'm a little lacking on electrical specifications for the motors since I snagged them from a pile from a class. I know that DC motors attended to run off 1.5V-3V don't work with the shield, but I normally run these motors off a 9V battery, so I don't think they're 1.5-3V. I do know that they are DC brush motors.

Aub
 
Posts: 6
Joined: Sun Dec 03, 2017 8:30 pm

Re: Motor shield V2 issues--motor won't run despite arduino

by adafruit_support_bill on Tue Dec 05, 2017 6:00 pm

Yeah, I didn't solder them I used hot glue to keep the wires in place. Sorry I know that's not ideal,

It is more than 'not ideal'. It is pretty much guaranteed not to work. You need to solder those connections to assure reliable electrical contact.

adafruit_support_bill
 
Posts: 63471
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor shield V2 issues--motor won't run despite arduino

by Aub on Wed Dec 06, 2017 10:56 pm

yeah surprise surprise, I soldered it and it works now... XD. Thanks.

Aub
 
Posts: 6
Joined: Sun Dec 03, 2017 8:30 pm

Re: Motor shield V2 issues--motor won't run despite arduino

by adafruit_support_bill on Thu Dec 07, 2017 7:07 am

Good to hear. Thanks for the follow-up.

adafruit_support_bill
 
Posts: 63471
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.