When I use the adafruit motor shield for the DC motor party, the programme uploads, but the shield fails to work, and its power light doesn't turn on, and the motor doesn't work. What is the problem in this case?
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html
If you are using an adafruit example, please post a link to this example.
Thanks .. Tom... ![]()
Hi,
I think the sketch would help to thanks, how are you supposed to control the motor, and link to shield specs/example.
Thanks Tom.... ![]()
TomGeorge:
Hi,
I think the sketch would help to thanks, how are you supposed to control the motor, and link to shield specs/example.Thanks Tom....
This is what the sketch looks like and it's supposed to work, but the light on the shield doesn't switch on
/*
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control
For use with the Adafruit Motor Shield v2
----> Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit [v2.3] : ID 1438 : Adafruit Industries, Unique & fun DIY electronics and kits
*/
#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();
// 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);
}
Hi,
Does the shield need a separate supply for the motors, this is usually the case.
Also;
Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html
Tom....... ![]()
TomGeorge:
Hi,
Does the shield need a separate supply for the motors, this is usually the case.
Also;
Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.htmlTom.......
I posted the sketch and the jpeg picture of how it was plugged in and powered.
Hi,
If you read the schematic, you will find the Green LED is powered by the motor powersupply which is connected to the terminal pair marked MOTOR POWER.
The motors do not run of the arduino supply, it cannot supply enough current.
Tom.... ![]()
TomGeorge:
The motors do not run of the arduino supply, it cannot supply enough current.
It looks like the shield can take power from the Arduino's Vin line.
It's hard to tell in the photo but I think the jumper needed to power the motor from the Arduino is in place. If an appropriate supply is connected to the Arduino's barrel jack, it should be able to power the motor.
The shield (wisely) doesn't include an option to power motors from the USB connection.
