afghanistan

fi all. i'm deployed to afghan rightr now. the internet service we're using over here is administrated by the army and has some serious pain in the ass restrictions. mostly video and free/shareware sites and some random blocked pages.
so, i tried downloading the pin layout for the arduino motorshield rev 3 but got blocked. can anyone please post the pin numbers and locations here for me.
specifically, the number for both the screwblock pins. i've got my 2 motors plugged into them but when i run the code only one engages. when i switch the wires around, the other one runs but not the first. i know i could just write a simple sketch and and see whether its pin 12 or pin 13 thats invalid. except for writing code for all the pins one at a time i don't have a clue.

thanksall,
-ed

Is this the link you are trying to access...
http://arduino.cc/it/Main/ArduinoMotorShieldR3

the internet service we're using over here is administrated by the army and has some serious pain in the ass restrictions.

It may not be your side of the network that is blocking access. There is at least one computer on your side that is under the control of spambot. I cannot speak for the other moderators but I've blocked several Afghanistan military IP addresses to curtail the spam.

A0 SNS0
A1 SNS1
A2
A3
A4
A5

D0
D1
D2
D3 PWMA
D4
D5
D6
D7

D8 BRAKEB
D9 BRAKEA
D10
D11 PWMB
D12 DIRA
D13 DIRB
GND
AREF
SDA
SCL

OUT5
GND
D5
+5

OUT6
GND
D6
+5

IN2
GND
A2
+5

IN3
GND
A3
+5

TWI-IN
GND
+5
SDA
SCL

TWI-OUT
GND
+5
SDA
SCL

Hope that's what you need.

crossroads, thank you.
sorry but some of that don't make sense.
out 5,6- are these for powering motors also? do they have different power restrictions? if possible, should d12,13 be used instead?
in 2,3- these are for reading voltage input, correct?
twi-out- i have no idea what that is.
does d12,13 just switch they're + and - to change direction?
will m12,13 also work. i know you didn't write that, but i see it in alot of other sketches.
just learning, how does the pwm's and d12,13 connect together? do i need to use a breadboard? how does a segment of the code look for combing these four, say just forward and then a left face for example.
thanks again for your reply.
thanksall.
-ed

The motors are powered from the L298 on the shield.
PWMA/DIRA/BRAKEA control the A pins.
PWMB/DIRB/BRAKEB control the B pins.

I don't know what the other terminal blocks are for.
The signals there are just connected to the Arduino underneath, and are not capable of driving motors.

You need to read up on the L298.
PWM drives the Enable pin.
DIRA drives the In1 pin.
DIRA is inverted (DIRA/) & drives the In2 pin.
DIRA/ is mixed with BRAKEA;
so if BRAKEA is High, the In2 input is DIRA/ inverted for normal operation.
if BRAKEA is LOW, In2 can only be HIGH, and if DIR is HIGH, both Motor lines are driven HIGH or LOW together and thus no the motor sees no power.

Does this help? I’ve attached a screenshot of the schematic of the R3.

crossroads and tom carpenter, thanks again. i dont need to worry about the brake control rite now. the platform the motors are on has some self-braking gizmo on the shaft connecter that relaeses whenever power is applied-kinda like airbrakes.
thanks for describing the pins and for the schematic. though i was hoping youd be able to tell me how the pwma+b and the dira+b are physically connected together. i have 2 motors with only pos. and neg. wires on them. i'm not sure how to wire the circuit with dir and pwn to the motors with the wires from the motors running into the d12,13 blocks. aren't d3,11 limited to around 40mA?

On the top left of the schematic, there are 4 outputs marked Out0 to Out 3. These relate to the Screw Terminal on the Sheild.

The screw terminals are marked ‘+’ and ‘-’ for each motor (Two groups, motor A and motor B). Connect the red lead one one motor to one of the +, and the black lead to the corresponding -.

The motors are not driven by the Arduino, but by the L298 chip. The PWM and Dir pins are already wired to the control pins of the L298.

thanks for responding again tom carpenter!
so i don't need to actually connect d3,11 to d12,13? ok. thats what was throwing me off. i guess i was just misunderstanding the tutorials and such. do have another question though. here is a small, simple sketch i wrote up. it's working fine except either d12 or d13(don't know which is which-is d12 the one closest to the reset button or d13) isn't working. one motor is running fine and when i switch the other motor to the scewblock the other motor works ok.the screwblock thats working is "A", closest to the Vin/GND screwblocks. any ideas?
thaksagain
-ed

//rc to robot sketch by ed
//

int rM = 12;
int lM = 13;

void setup()
{
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
}
void loop()
{
//forward
;digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
analogWrite(12,255);
analogWrite(13,255);
delay(500)

//turn right
;digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
analogWrite(12,0);
analogWrite(13,255);
delay(500);

//forward
digitalWrite(12,255);
digitalWrite(13,255);
analogWrite(12,255);
analogWrite(13,255);
delay(500);

//turn left
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
analogWrite(12,255);
analogWrite(13,0);
delay(500);

//reverse
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
analogWrite(12,0);
analogWrite(13,0);
delay(500);

//180 degree turn
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
analogWrite(12,255);
analogWrite(13,0);
delay(500);
}

//end

You need to be calling analogWrite() for pins 3 and 11, not 12 and 13.

Basically, 12 and 13 control the direction (forward or back) for motors A and B respectively. Then you have 3 and 11 which and the PWM pins and control the speed of the motor (using analogWrite()), again for A and B respectively.

Here is an example

//give the pins a name for easy reading (nothing wrong with the way you had it, its just harder to read)
const byte DirA 12;
const byte DirB 13;
const byte PWMA 3;
const byte PWMB 11;
void setup()
{
  pinMode(DirA ,OUTPUT); //Set them all to outputs.
  pinMode(DirB ,OUTPUT);
  pinMode(PWMA ,OUTPUT);
  pinMode(PWMB ,OUTPUT);
}
void loop()
{
  //forward
  digitalWrite(DirA ,HIGH);
  digitalWrite(DirB ,HIGH); //both to forward
  analogWrite(PWMA ,255);
  analogWrite(PWMB ,255); //both at full speed
  delay(500)
  
  //turn right
  digitalWrite(DirA ,HIGH);
  digitalWrite(DirB ,HIGH); //both to forward
  analogWrite(PWMA ,0); //right motor stopped
  analogWrite(PWMB ,255); //left at full speed
  delay(500);
  
  //forward
  digitalWrite(DirA ,HIGH);
  digitalWrite(DirB ,HIGH); //both to forward
  analogWrite(PWMA ,255);
  analogWrite(PWMB ,255); //both at full speed
  delay(500);
  
  //turn left
  digitalWrite(DirA ,HIGH);
  digitalWrite(DirB ,HIGH); //both to forward
  analogWrite(PWMA ,255); //right to full speed
  analogWrite(PWMB ,0); //left motor stopped
  delay(500);
  
  //reverse
  digitalWrite(DirA ,LOW);
  digitalWrite(DirB ,LOW); //both to reverse
  analogWrite(PWMA ,255);
  analogWrite(PWMB ,255); //both at full speed
  delay(500);
  
  //180 degree turn
  digitalWrite(DirA ,HIGH);
  digitalWrite(DirB ,LOW); //opposite directions to spin on the spot
  analogWrite(PWMA ,255);
  analogWrite(PWMB ,255); //both at full speed
  delay(500);
}

wow. tom carpenter thank you for showing me that. i can't believe i showed what an idiot i am-repeatedly!
will try and see how that goes tomorrow. one last question again.
this last time i tried to run the basic example led fade while my uno+motorshield were still connected to the motors/platform.when i plugged int he usb and uploaded the sketch and waited to see how that would go.no reason, just wastin time. anyhow 2 of the 3 AA's !literally! exploded. does the Vin/GND/GND next to the analog pins need to be connected to the screwblock Vin,GND?
thanks sorry for the trouble and the advice is appreciated.
thanksall.
-ed

I'm also a US Army veteran (formerly stationed in Iraq. There is a reason they block certain things. Especially with electronics. Not all reasons we need to understand or agree with. But don't get yourself or especially him into trouble.

teslaiaint- i'm from ohio too. down by chillicothe. wheres ontario at?
do you know is there any robotics clubs or arduino workshops in ohio where i can get some hands-on instruction?
thakyou
-ed

anyone/tom carpenter- thanks for the reply.
1-let me this right. D12+D3 are wired together when using screwblock A. D13+D11 are wired together when using screwblock B. but all four stand alone when pining into them individually and then do the same thing. am i correct in this?

2-here is my sketch

int motor = 12;
int pwm = 3;
void setup()
{
pinMode(motor,OUTPUT);
pinMode(pwm,OUTPUT);
}
void loop()
{
digitalWrite(motor,HIGH);
analogWrite(pwm,255);
delay(1000);

digitalWrite(motor,LOW);
analogWrite(pwm,255);
delay(1000);
}

when i run this same sketch but substitute D12 for D13 and D3 for D11 the motor just continuously drives in one direction. i have switched motors and get the same result. is there a short in my board or did i mess up my sketch again? here is the sketch crossroads wrote for me(thanks you!)

//give the pins a name for easy reading (nothing wrong with the way you had it, its just harder to read DirA = 12;
int DirA = 12;
int DirB = 13;
int PWMA = 3;
int PWMB = 11;
void setup()
{
pinMode(DirA ,OUTPUT); //Set them all to outputs.
pinMode(DirB ,OUTPUT);
pinMode(PWMA ,OUTPUT);
pinMode(PWMB ,OUTPUT);
}
void loop()
{
//forward
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500)

//turn right
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,0); //right motor stopped
analogWrite(PWMB ,255); //left at full speed
delay(500);

//forward
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500);

//turn left
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,255); //right to full speed
analogWrite(PWMB ,0); //left motor stopped
delay(500);

//reverse
;digitalWrite(DirA ,LOW);
digitalWrite(DirB ,LOW); //both to reverse
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500);

//180 degree turn
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,LOW); //opposite directions to spin on the spot
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500);
}

//end

i know this sketch is good cause it was written by a pro, but i get the same result with either D13 or D11 not functioning correctly and switching in a new motor to check. any ideas?
thanksall
-ed

sigworth1103:
1-let me this right. D12+D3 are wired together when using screwblock A. D13+D11 are wired together when using screwblock B. but all four stand alone when pining into them individually and then do the same thing. am i correct in this?

The digital pins (D12,D3,D13,D11) aren't wired to the screwblock at all, neither are they wired together. The are wired to the IC in the centre of the shield (the L298). The IC then uses the four signals to drive two "H-Bridges", the outputs of which are connected to the motors.
Simplified H-Bridge:

(1) If "High-Side Left" and "Low-Side Right" are on, current flows one way through the motor (forward).
(2) If "High-Side Right" and "Low-Side Left" are on, current flows one way through the motor (backward).
If none are closed the motor is stopped.
The PWM pin is always connected by the IC to two of the switches (either pair (1) or pair(2)). The Dir pin selects which pair are connected.

The L298 has two of these H-Bridges (one for each motor), and hence has two sets of PWM and Dir pins. The IC is necessary as if you tried to drive the motor directly from the Arduino (without an H-Bridge) you would destroy it.

tom carpenter-
thanks for clearing that up for me.
but that dosen't explain why the B screwblock isn't working correctly.
i don't know.
thanks-
-ed