I have an Arduino Uno, and i'm using the Adafruit Motor Shield V2.
I connected a DC motor to it, and tried to run it via the "DCMotor test" example sketch provided with the AF library, but it doesn't work.
I tried to power the motor directly from the batteries cables and it works, but once properly connected to the shield it won't work.
Moreover the serial monitor prints this:
I checked all the solderings and they seem all ok. It is just like Arduino cannot communicate with the shield.
the code i'm using is this:
#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);
}
I tried to power the motor directly from the batteries cables and it works, but once properly connected to the shield it won't work.
If you are posting code from the Adafruit website to complain that your circuit doesn't work and you give us absolutely NO information about the motors the power supply voltage or how you connected it to the shield, I don't see how we are supposed to help you. You have provide NO DATA.
1- Motor specs (link the motors or datasheet)
2- What voltage are you using to power the shield ?
3- Post a photo of your wiring to the shield. (or at least a photo of a hand drawn schematic showing how you connected everything)
4- State whether you HAVE or HAVE NOT looked at the schematic for the Adafruit motor shield.
5-State whether you ARE or ARE NOT aware of the purpose of the jumper on the shield and how to use it.
These are the specs of the motor: TT Geared Motor with Back Shaft (180rpm 6v L Shape) - DFRobot
I am using 5 AA Batteries (1.5V 3A) in parallel as power supply for the shield.
These are the pictures of the connections and solderings (with the example code i am testing only the motor on port M1)
The ceramic capacitor i am using on the motor has a capacity of 0.1uF
The Arduino should be able to run the sketch without the "motor shield", so you should be able to see proper Serial Monitor data.
If that gives indication of proper function and then goes into the tank with the "motor shield" attached, that's telling you something.
I am using 5 AA Batteries (1.5V 3A) in parallel as power supply for the shield.
Why ?
The motor's rated voltage is 6V, NOT 1.5V.
you should have the AA batteries in series parallel. (two batteries in series , x 2 for a total of 4 batteries.(or 3 series pairs for a total of 6 batteries. Either way 1.5 V is too low because you lose that much across the devices in the shield.
Operating Voltage Range: 3~7.5V
**Rated Voltage: 6V **
There is nothing unusual about it not working if you are powering the shield with 1.5 V. What ever made you think it would work with such a low motor power voltage ?
Ops!! I'm sorry i obviously meant in series (as you can see in the picture)!
The picture doesn't provide enough detail to ascertain the output voltage. 7.5V should work. I don't know why it doesn't.
Have you measured the voltage on the motors when you run the code ?