Need help with motor control!

Hey I'm pretty new with the arduino board and been trying to get to D/C motors to run forward, backward, etc. Now I don't know why but the two motors aren't doing what I want them too and I now think it could be a wiring issue, however the schematic I have isn't descriptive enough and can't tell were the motor shield connects with the arduino and what pins it uses. It's a Dev-09815 or a "ardumotor". I would like any information on the design or were I can find a good schematic of the motor shield.

Sounds like you want this schematic:

The product web site says:

Control for motor attached to OUT1/2 is connected to digital line 12 (direction A) and digital line 3 (PWM A).

Control for motor attached to OUT3/4 is connected to digital line 13 (direction B) and digital line 11 (PWM B).

So to get the first motor to turn (the OUT1/2 outputs) set D3 high and D12 controls its direction (1, turn one way, 0, turn the other way). To run the motor at lower current use analogWrite() on D3 to generate a PWM waveform.

Same goes for the second motor except it's with pins 11 (enable and/or PWM) and 13 (direction).

--
Need a custom shield? Let us design and build one for you.

Be aware that not all DC motors are created equal.
If your motors are fitted with permanent magnet pole pieces then reversing the power leads will reverse the motor rotation.
However if your motor has wound pole pieces, when you reverse the power connections you are reversing both pole and armature windings, which results in the motor rotating in the original direction.
If you need to reverse a wound pole motor you need access to either the pole windings or the armature windings (preferably the pole windings)
jack

Hey guys thanks for the help but the motors still don't work. I think my code (below)(I got the example sketch from sparkfun.com) is missing something. I don't know what and were ever I go or examples I look up tell me the same thing or nothing at all about it. I would appreciate a reliable website to look up or an example code.

int pwm_a = 10; //PWM control for motor outputs 1 and 2 is on digital pin 10
int pwm_b = 11; //PWM control for motor outputs 3 and 4 is on digital pin 11
int dir_a = 12; //direction control for motor outputs 1 and 2 is on digital pin 12
int dir_b = 3; //direction control for motor outputs 3 and 4 is on digital pin 3

void setup()
{
pinMode(pwm_a, OUTPUT); //Set control pins to be outputs
pinMode(pwm_b, OUTPUT);
pinMode(dir_a, OUTPUT);
pinMode(dir_b, OUTPUT);

analogWrite(pwm_a, 100); //set both motors to run at (100/255 = 39)% duty cycle (slow)
analogWrite(pwm_b, 100);
}

void loop()

{
digitalWrite(dir_a, LOW); //Run motor in reverse
digitalWrite(dir_b, HIGH);//Run motor forward

delay(1000);

analogWrite(pwm_a, 100);//motor speed 100/255
analogWrite(pwm_b, 100);

delay(1000);

digitalWrite(dir_a, HIGH);//Run motor in reverse
digitalWrite(dir_b, LOW);//Run motor forward

delay(1000);

analogWrite(pwm_a, 153);//motor speed 153/255
analogWrite(pwm_b, 153);

delay(1000);
}

Frankly that sketch should work. How do you have the motors wired up? That shield doesn't come with any connectors as far as I know. What did you solder where? A diagram of how you hooked things up would help.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Well the problem is that I already had that schematic and the arduino main board schematic which were just to confusing. If you look at them they don't properly mark their pins. Also I didn't use a "quick Shield". The one I got you soldered on and could attach it to the arduino. This is the motor shield I used.

I understand, but my question is how you wired up the power (where did you wire to on the shield?), how did you wire up the motors, etc. etc.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

OK, well I attached motor B to pins 11 and 3, and motor A to pins 10 and 12. The power goes through the motor shield at the side.

No, that's not correct. Pins 3, 11, 10, and 12 go from the Arduino to the motor driver. The output of the motor driver (terminals labelled 'A' and 'B' near the front of the board) is where the motor must connect.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Yes I know that, what I meant was that those pins go to the H-Bridge and then to the motors. Now the problem is the motor schematic doesn't tell you which port the pins are on. On their schematic all they say is pins 3, 10, 11, and 13. It doesn't tell you Pin three on port D (D3), or port
C (C3). I need to know the port their on, that is the problem here.

You don't have to worry about Port D, Port C, etc. if you are using the sketch you showed yesterday. The analogWrite() and digitalWrite() functions automatically map pin numbers (3, 10, 11, etc.) into the right pins of the right ports.

--
Need a custom shield? Let us design and build one for you.

OK now the problem is on the two schematics(arduino, and motor shield) aren't labeled the same way and need to know where the arduino and motor shield connect.

Did you solder header pins onto your motor shield? If so, you should be able to just plug in your shield onto your Arduino and the pins will connect in the right way.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

OK the problem is I need a schematic to tell me specifically which port on the atmega controls which pins on the motor shield.