radio shack motor shield docs

I just bought an Arduino motor shield at Radio Shack but I can't locate the docs or example code for this on the arduino site

Maybe you should ask Radio Shack for the documentation. They took your money. They should provide documentation.

You can read some of the review comments at the below link for possible help.

PaulS:
Maybe you should ask Radio Shack for the documentation. They took your money. They should provide documentation.

Actually this is an Arduino product, and radio shack is just re-selling it. So Arduino is responsible and they should have documentation for their products including example code.
If Arduino is going to sell electronics for prototyping they need to provide documentation, otherwise it is false advertisement and a complete waste of time to offer the product for sale.

So Arduino is responsible and they should have documentation for their products

You mean like this:

What example code do you need?

i have tryed http://arduino.cc/en/Main/ArduinoMotorShieldR3 but it dose not have example code do drive a dc moter

but it dose not have example code do drive a dc moter

What code do you need? Set the direction pin HIGH to go one way. Set it LOW to go the other way. Set the speed using analogWrite() with some value between 0 (slowest) and 255 (fastest).

I have to agree with the OP (Legoaceking) here. If Arduino is going to release reference schematics, then they should be putting simple code examples in the web pages for those reference schematics.

Legoaceking:

Here's the basics.

The Motor shield will drive 2 brushed DC motors. There are 2 control signals per motor. The control signals are DIRECTION and SPEED.

DIRECTION is a digital output port set to "1" for one direction, and "0" for the other. SPEED is also a digital output port, but it's special. It's set to high only for a percentage of the time. That percentage is set by a function called analogWrite().

analogWrite() doesn't actually output an analog signal. What it does is set up a digital output bit to be high for a percentage of the total time. For more info, check the reference info here: Arduino - Home PRO TIP: Googling "Arduino Reference" will get you right to it.

The Arduino motor shield uses 4 digital output ports to control the 2 motors. They are assigned to these ports:

Motor A:
Direction: port 13
Speed: port 3

Motor B:
Direction: port 12
Speed: port 11

Why they chose these ports I'll never know. They directly interfere with the primary communication channel of the Arduino... the SPI system. This is the system that ALL the major communication shields use. As such, you cannot use the motor shield along with a WiFly shield, a USB Host shield, an Ethernet shield, or a micro-SD shield. All of these use digital ports 10, 11, 12, and 13. Which are the digital ports used by the SPI system.

So. To use the motor shield to run a motor, you set a direction and a speed by setting the ports for that motor.

Like this:

First. Set the pin mode of the ports you need to use.

For Motor A:
pinMode(13,OUTPUT);
pinMode(3,OUTPUT);

For Motor B:
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);

To set motor A to 50% speed going in direction 1:
digitalWrite(13,1);
analogWrite(3,128);

Hmm. Which direction is "Direction 1"? Try it and see! If it's the wrong way, just reverse the motor wires.

To set motor A at zero speed: (The direction port really doesn't matter with 0 speed.)
digitalWrite(13,1);
analogWrite(3,0);

To set motor A at max speed:
digitalWrite(13,1);
analogWrite(3,255);

As you can see, the range of the speed you can set is 0 to 255.

To set motor B at zero speed: (The direction port really doesn't matter with 0 speed.)
digitalWrite(12,1);
analogWrite(11,0);

To set motor B at max speed:
digitalWrite(12,1);
analogWrite(11,255);

PaulS:

So Arduino is responsible and they should have documentation for their products

You mean like this:
http://arduino.cc/en/Main/ArduinoMotorShieldR3

What example code do you need?

Perhaps something like this? Motor Shield - Arduino motor/stepper/servo control
with code that is maintained like this: GitHub - adafruit/Adafruit-Motor-Shield-library: Adafruit Motor shield V1 firmware with basic Microstepping support. Works with all Arduinos and the Mega
with information on how to install Arduino Libraires for those of us who might not have done it before or ... since it was changed, and most likely will change again. Like this: Arduino Hacks

So I guess the moral of the story for me is, I should have just purchased the Adafruit one, and I do suggest that for all of those people out there that have mistakenly purchased the Arduino Motor Shield r3 thinking that it was going to be of quality work, or at least comparable to what Adafruit has on the market.

Hopefully the documentation will come, and if not hopefully they will provide some vehicle for the community to develop for it, ie. Wiki

I too just purchased a motor shield R3 from Radio Shack. If I had bothered to research the unit, I would have bought the Adafrut unit. But alas RS is walking distance and timing was important. It is going back today and I am ordering an Adafrut unit. I think the R4 was designed for a specific project and not for general use. Looking forward to hearing anyone else's experience with this or any other Arduino products purchased from RS. The store personnel are clueless as far as technical questions are concerned. Radio Shack take note,
hire technically competent people if your are going to serve the electronics hobby market.

Radio Shack take note, hire technically competent people if your are going to serve the electronics hobby market.

In the electronics hobby market today, you are generally expected to know what you are doing, not necessarily depend on the person behind the counter. If you don't understand what you are going to buy, then don't buy. It is amazing that radio shack still carrys any electronic hobby parts.

It is amazing that radio shack still carrys any electronic hobby parts.

I think Radio Shack is trying to get back into the hobby/electronics filed. They aren't doing so well selling phones. The problem is that at the store level, the employees know how to sell phones, If you can get their attention at all. As much as I'd like to see the venture with Arduino succeed, I doubt that it will.

Does anybody know if the Radio Shack "Arduino Motor Shield R3" board has TWI/I2C control or is it just a pass through connection? If it does: How might one find the I2C ID for this device?

The TWI is a pass through, as do analog pins 2 and 3, 0 and 1 are used by the current sense amps on the Motor3 board. The pin destination is in the silkscreen by the applicable connector.

BTW the link to the docs should have been on the customer reviews page at Radioshack, as I took the effort to post it in a review after I bought mine. Late in the day I bought mine Arduino finally got the reference pages online for the motor3.

The store personnel are clueless as far as technical questions are concerned.

Nothing new there, even for consumer products.

Radio Shack take note, hire technically competent people if your are going to serve the electronics hobby market.

Nah. Don't make them do that; they'll just get rid of their "hobby" parts instead.

I think I'm inclined to agree that the Arduino Motor Shield should have better support from the Arduino team, including a library that comes with the distribution...

Since I could not find a good sketch for this shield I thought I would try to make one and by way, My first contribution to the Arduino society.

So for those whom might need a demo sketch:

//----------------------------------------------------------------------
/*
This is an unofficial demo sketch for using the Official
'Arduino Motor Shield R3' and used as a unipolar/bipolar
stepper driver.

By Duane Bishop Jan-7-2012
This code is public domain.

Prerequisites:

Official Aruino Motor Shield R3 or a pin compatible clone.
(Clones are assumed to be based on L298 driver chip.)

An Arduino Uno, Decimillia, Mega, or clone that can use
the Motor Shield.

Read the product info page at:

Correct wiring knowledge for your stepper motor.
A good guide can be found at:

Know how many steps our motor has.
(If unknown, spin stepper shaft by hand, count detents per
revolution multiply by two and you'll have the correct number
of steps for that model of stepper.)
*/

// How many steps does your stepper have?
int numberOfSteps=200;

// How many milliamps would you like to send to your stepper?
int milliAmps=100; // Per coil.

//Optional
boolean heatsink=false; // If you have one mounted, set to true.

// Import the stepper library.
#include <Stepper.h>

// Label our pins:
int coilA=12; // Coil-A directional pin.
int coilB=13; // Coil-B directional pin.
int coilApower=3; // PWM is used for Coil-A current control.
int coilBpower=11; // PWM is used for Coil-B current control.
int coilAsens=A0; // Used to monitor current draw of Coil-A
int coilBsens=A1; // Used to monitor current draw of Coil-A

// Define some variables we'll need.
int currentOfCoilA;
int currentOfCoilB;

// We'll need a function to derive how many milliamps we're using.
int getMilliamps(int sensingPin)
{
/*
Arduino references 0~5 volts as value of 0~1023
But our Motor Control Shield references its load from 0~3.3 volts.
We need to scale these two ranges so we can make use of it.
So: 1024/5=204.8 per volt. times that by 3.3 we get 675.84

However:
analogRead(); doesn't do decimals so it will only read a maximum
of 675 (at 2 Amps) on our coil sensing pins.
*/

int milliSens=0;
long sensingTotal=0;

while(milliSens <=255) // Gather readings over whole PWM cycle.
{
sensingTotal=sensingTotal + analogRead(sensingPin);
milliSens++;
}

int sensingAvg=sensingTotal/256; // Average the readings
int milliLoad=map(sensingAvg,0,675,0,2000); //Translate to milliamps
return(milliLoad); //Return the result.
}

void setCoilPower(int power)
{
int tempVal=0;
while(getMilliamps(coilAsens) < power)
{
tempVal++;
analogWrite(coilApower,tempVal);
}
Serial.print("Setting coilApower=");
Serial.print(tempVal);

tempVal=0;
while(getMilliamps(coilBsens) < power)
{
tempVal++;
analogWrite(coilBpower,tempVal);
}
Serial.print(" and coilBpower=");
Serial.println(tempVal);
Serial.println("");
}

// Now we'll make our stepper funtion.
Stepper ourStepperFunction(numberOfSteps,coilA,coilB);

void setup()
{
// Set our pinModes.
pinMode(coilA,OUTPUT);
pinMode(coilB,OUTPUT);
pinMode(coilApower,OUTPUT);
pinMode(coilBpower,OUTPUT);
pinMode(coilAsens,INPUT);
pinMode(coilBsens,INPUT);

// Set the speed of our stepper.
// (Faster = less torque. 100 is very slow, but very reliable.)
ourStepperFunction.setSpeed(25);

Serial.begin(9600); // Open you serial monitor to view results.
// Sanity check.
if(milliAmps > 2000)
{
Serial.println("milliAmps: Set WAY TOO HIGH!!");
Serial.println("milliAmps: You'll SMOKE your Motor Controller!!");
Serial.println("Bailing out. Mayday! Mayday!");
while(milliAmps); // Stay here do not pass.
}else{
if(milliAmps >= 1000 && heatsink != true)
{
Serial.println("milliAmps: Set too high for stock Motor Shield!");
Serial.println("milliamps:Install heatsink and set 'heatsink=true'");
Serial.println("Bailing out.");
while(milliAmps); // Stay here do not pass.
}else{
Serial.println("milliamps: OK.");
delay(500);
Serial.print("Ramping power up to: ");
Serial.print(milliAmps);
Serial.println(" milliAmps for each coil.");
setCoilPower(milliAmps);
Serial.println("Your stepper should now be turning one revolution");
Serial.println(" in each direction. If not, check your wires.");
Serial.println(" It the stepper/driver is hot, lower your milliAmps.");
}
}
}

void loop()
{
ourStepperFunction.step(numberOfSteps);
delay(500);
ourStepperFunction.step(-numberOfSteps);
}

PaulS:

but it dose not have example code do drive a dc moter

What code do you need? Set the direction pin HIGH to go one way. Set it LOW to go the other way. Set the speed using analogWrite() with some value between 0 (slowest) and 255 (fastest).

Hey Paul, It Does not work as you described! Some examples would be helpfull!

PaulS:

but it dose not have example code do drive a dc moter

What code do you need? Set the direction pin HIGH to go one way. Set it LOW to go the other way. Set the speed using analogWrite() with some value between 0 (slowest) and 255 (fastest).

Hey Paul, It does not work as you described! Some examples (that work) would be helpfull!!

How are you connecting your motor? Both wires from the motor have to go to the same pair of terminals A or B. Meaning there is an A+ and an A-, a B+ and a B-.