Motor shield v2.3

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
Albr
 
Posts: 7
Joined: Thu Oct 30, 2014 12:55 pm

Motor shield v2.3

Post by Albr »

Actually I'm working with the motor shield V2.3, but I have a problem tor run the DC motor. I'm suplying the shield with a 7,4V battery and i want to run a DC motor of 3-6V.
the servomotors runs perfectly but the Motors not. I don't know whats happening.

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

Re: Motor shield v2.3

Post by adafruit_support_bill »

Please post photos of the front and back of the shield and the electrical specifications for the motor you are using.

User avatar
Albr
 
Posts: 7
Joined: Thu Oct 30, 2014 12:55 pm

Re: Motor shield v2.3

Post by Albr »

Front of the shield
Front of the shield
20141106_212001.jpg (276.65 KiB) Viewed 487 times
Back of the shield
Back of the shield
20141106_212020.jpg (240.77 KiB) Viewed 487 times

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

Re: Motor shield v2.3

Post by adafruit_support_bill »

Please post the electrical specifications for your motors - and show us how they are wired up.

Also post the code you are using to test.

User avatar
Albr
 
Posts: 7
Joined: Thu Oct 30, 2014 12:55 pm

Re: Motor shield v2.3

Post by Albr »

General specifications
Typical operating voltage: 3 V
Gear ratio options: 11.6, 18.0 :1
Free-run motor shaft speed @ 3V: 9400 rpm1
Free-run current @ 3V: 150 mA2
Stall current @ 3V: 2700 mA
Motor shaft stall torque @ 3V: 0.97 oz·in3

Arduino code:
#include <AFMotor.h>

AF_DCMotor motor(4);

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

// turn on motor
motor.setSpeed(200);

motor.run(RELEASE);
}

void loop() {
uint8_t i;

Serial.print("tick");

motor.run(FORWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}

Serial.print("tock");

motor.run(BACKWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}


Serial.print("tech");
motor.run(RELEASE);
delay(1000);
}

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

Re: Motor shield v2.3

Post by adafruit_support_bill »

Code: Select all

#include <AFMotor.h>
The AFMotor library is for the V1 motor shield. You need to use the V2 motor shield library.
https://github.com/adafruit/Adafruit_Mo ... V2_Library

User avatar
Albr
 
Posts: 7
Joined: Thu Oct 30, 2014 12:55 pm

Re: Motor shield v2.3

Post by Albr »

when I put this code:

Code: Select all

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x60); 
// 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);
int bluetoothRX= 0;
int bluetoothTX= 1;

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);
}
the program says to me this:
sketch_nov08a.ino:3:45: error: utility/Adafruit_PWMServoDriver.h: No such file or directory
sketch_nov08a:6: error: 'Adafruit_MotorShield' does not name a type
sketch_nov08a:11: error: expected constructor, destructor, or type conversion before '*' token
sketch_nov08a.ino: In function 'void setup()':
sketch_nov08a:21: error: 'AFMS' was not declared in this scope
sketch_nov08a:25: error: 'myMotor' was not declared in this scope
sketch_nov08a:26: error: 'FORWARD' was not declared in this scope
sketch_nov08a:28: error: 'RELEASE' was not declared in this scope
sketch_nov08a.ino: In function 'void loop()':
sketch_nov08a:36: error: 'myMotor' was not declared in this scope
sketch_nov08a:36: error: 'FORWARD' was not declared in this scope
sketch_nov08a:48: error: 'BACKWARD' was not declared in this scope
sketch_nov08a:59: error: 'RELEASE' was not declared in this scope
Last edited by adafruit_support_bill on Sat Nov 08, 2014 1:07 pm, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.

User avatar
Albr
 
Posts: 7
Joined: Thu Oct 30, 2014 12:55 pm

Re: Motor shield v2.3

Post by Albr »

20141108_171238.jpg
20141108_171238.jpg (190.24 KiB) Viewed 464 times

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

Re: Motor shield v2.3

Post by adafruit_support_bill »

sketch_nov08a.ino:3:45: error: utility/Adafruit_PWMServoDriver.h: No such file or directory
You have to install the complete library - including all sub-folders.
Follow the instructions here for installing libraries.
http://learn.adafruit.com/adafruit-all- ... nstall-use

User avatar
Albr
 
Posts: 7
Joined: Thu Oct 30, 2014 12:55 pm

Re: Motor shield v2.3

Post by Albr »

Sorry but now the computer doesn't recognize the bluetooth shield, and i don't touch the bluetooth for anything.

User avatar
Albr
 
Posts: 7
Joined: Thu Oct 30, 2014 12:55 pm

Re: Motor shield v2.3

Post by Albr »

Sorry but now the computer doesn't recognize the bluetooth shield, and i don't touch the bluetooth for anything.

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

Re: Motor shield v2.3

Post by adafruit_support_bill »

Since this is not related to the original topic, please start a new thread. Be sure to include important information like what boards you are using and what operating system you use on your computer.

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

Return to “Arduino Shields from Adafruit”