Step 9: Wire motors to motor shield

This is much more complicated than you would imagine.

Wire positive on the right motor to the negative terminal for motor A.
Wire negative on the right motor to the positive terminal for motor A.

Wire positive on the left motor to the positive terminal for motor B.
Wire negative on the left motor to the negative terminal for motor B.

If anyone believes these are wrong, please notify me. I am quite sure that I'm correct, but there is a chance that I lost track of which wire is which.
<p>muy bueno y facil de utilizar.</p>
very nice' but can we use a ultrasonic sensor in place of the SHARP sensor????????????
<p>can we use this module and normal male to female wires to connect it to the bread board?</p><p><a href="http://www.ebay.in/itm/Ultrasonic-Distance-Module-HC-SR04-Arduino-ARM-and-other-MCU-/141472357785?pt=IN_Toys_Games_School_Stuff&hash=item20f068dd99" rel="nofollow">http://www.ebay.in/itm/Ultrasonic-Distance-Module-HC-SR04-Arduino-ARM-and-other-MCU-/141472357785?pt=IN_Toys_Games_School_Stuff&amp;hash=item20f068dd99</a></p>
<p>can u pleast tell me the connections for this motor shield?</p><p><a href="http://www.ebay.com/itm/L293D-Motor-Drive-Shield-Expansion-Board-For-Arduino-Duemilanove-Mega-UNO-/221541254774?pt=LH_DefaultDomain_0&hash=item3394e34676" rel="nofollow">http://www.ebay.com/itm/L293D-Motor-Drive-Shield-Expansion-Board-For-Arduino-Duemilanove-Mega-UNO-/221541254774?pt=LH_DefaultDomain_0&amp;hash=item3394e34676</a></p><p>i would appreciate if u show the connections using a diagram </p>
<p>I'm having trouble installing the library.</p><p>I downloaded the zip file and imported the library, but when I put it in the sketch it only shows the .h file and gives me the error message: <br><br>core.a(main.cpp.o): In function `main': <br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\ard... undefined reference to `setup' <br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\ard... undefined reference to `loop' <br><br>The four &quot;example&quot; files show up in the sketchbook, but each opens in a new window. They individually verify, but when copy/pasting them together I get error messages. <br><br>I can't seem to import the .cpp file at all, and when I try to drag and drop it I get the same error message.</p>
does arduino uno r3 work
hey <br>i also wannna do a similar stuff. i want to design a robot for surveillance where the robot will be fully autonomous and it wil move for point A to point B autonomously. <br>i want u to help me in designing the autonomous motion planning system to go form one given place to the other using sensors n stuff...i m stuck pls help <br> <br>i have bought the rover system from here just for making prototype of the actual system since i got it at a good price... <br>http://danuc.com/index.php?main_page=index&amp;cPath=6 <br>http://danuc.com/index.php?main_page=index&amp;cPath=4 <br>http://danuc.com/index.php?main_page=index&amp;cPath=1 <br>http://danuc.com/index.php?main_page=index&amp;cPath=7 <br>http://danuc.com/index.php?main_page=product_info&amp;cPath=8&amp;products_id=52 <br> <br>pls reply
my brother would approve of your username, he has the same problem with his name.
Very nice tutorial. Simple and to-the-point. Thanks!
Glad I could help!
Hello Guys! <br> <br>Could i use Motorshields from this Collection? <br> <br>http://www.amazon.de/s/ref=nb_sb_noss?url=search-alias%3Daps&amp;field-keywords=Arduino+Motor+Shield+R3 <br> <br> <br>?? I cannot buy the Motorshield R3 on Amazon.US, because i dont have VISA or a Mastercard.
Yes, you could.
add a bluetooth slave to this to make it even better! cheap remote control car your android phone! I need to spend more time getting the ultrasonic sensor to work on my code. <br>Use BlueTerm from google play to control it. <br> <br>#include //motor shield <br>#include //Software Serial Port <br>#include // android link bluetooth <br>#define RxD 6 // BT com these are backwards on the shield <br>#define TxD 2 //BT com backwards on BT shield, jumpers <br>#define trigPin A4 //sensor trig to analog 4 <br>#define echoPin A5 //sensor echo to analog 5 <br>#define objLED A3 // set obsticle indicator led to analog 3 <br> <br>AF_DCMotor lmotor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm <br>AF_DCMotor rmotor(1, MOTOR12_64KHZ); // sets the left motor to port 1 <br> <br> <br> <br>SoftwareSerial blueToothSerial(RxD,TxD); <br> <br>void setup() <br>{ <br> Serial.begin(38400); // set up Serial library at 9600 bps <br> pinMode(RxD, INPUT); //set pin 6 to BT in <br> pinMode(TxD, OUTPUT); //set pin 2 to BT out <br> pinMode(trigPin, OUTPUT); //sets ultrasonic sensor <br> pinMode(echoPin, INPUT); <br> pinMode(objLED, OUTPUT); <br> setupBlueToothConnection(); // <br> rmotor.setSpeed(200); // set the RIGHT motot speed to 220 from 0 to 255 <br> lmotor.setSpeed(200); // set the Left motor speed to 200 from 0 to 255 <br>} <br> <br> <br>void loop() <br>{ <br> //get distance before collision <br> float duration, distance; <br> digitalWrite(trigPin, HIGH); <br> delayMicroseconds(1000); <br> digitalWrite(trigPin, LOW); <br> duration = pulseIn(echoPin, HIGH); <br> distance = (duration/2) / 29.1; <br> Serial.println(distance); <br> //end distance <br> <br> //recieve and execute comands via bluetooth <br> char recvChar; <br> <br> if(blueToothSerial.available())//check if there's any data sent from the remote bluetooth shield <br> { <br> recvChar = blueToothSerial.read(); <br> switch(recvChar) <br> { <br> case 'w': //forward <br> blueToothSerial.println(&quot;forward&quot;); <br> rmotor.run(FORWARD); <br> lmotor.run(FORWARD); <br> if(distance &lt;= 10 &amp;&amp; distance &gt;=1) // stop motor if distance is less than or equal to 10 cm <br> { <br> avoidObject(); <br> } <br> break; <br> <br> <br> case 's': //backwards <br> blueToothSerial.println(&quot;reverse&quot;); <br> rmotor.run(BACKWARD); <br> lmotor.run(BACKWARD); <br> break; <br> <br> case 'e': // stop <br> blueToothSerial.println(&quot;stopping&quot;); <br> rmotor.run(RELEASE); <br> lmotor.run(RELEASE); <br> break; <br> <br> case 'a': // turn left <br> blueToothSerial.println(&quot;turning left&quot;); <br> lmotor.run(FORWARD); <br> rmotor.run(BACKWARD); <br> break; <br> <br> case 'd': //turn right <br> blueToothSerial.println(&quot;turning right&quot;); <br> lmotor.run(BACKWARD); <br> rmotor.run(FORWARD); <br> break; <br> <br> }//end switch case <br> <br> <br> <br> } // end BT com <br> } // end loop <br> <br>void avoidObject() <br>{ <br> <br> digitalWrite(objLED,HIGH); <br> rmotor.run(RELEASE); <br> lmotor.run(RELEASE); <br> //delay(20); <br> rmotor.run(BACKWARD); <br> lmotor.run(BACKWARD); <br> delay(100); <br>} <br> <br>void setupBlueToothConnection() <br>{ <br> blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400 <br> blueToothSerial.print(&quot;\r\n+STWMOD=0\r\n&quot;); //set the bluetooth work in slave mode <br> blueToothSerial.print(&quot;\r\n+STNA=SeeedBTSlave\r\n&quot;); //set the bluetooth name as &quot;SeeedBTSlave&quot; <br> blueToothSerial.print(&quot;\r\n+STOAUT=1\r\n&quot;); // Permit Paired device to connect me <br> blueToothSerial.print(&quot;\r\n+STAUTO=0\r\n&quot;); // Auto-connection should be forbidden here <br> delay(2000); // This delay is required. <br> blueToothSerial.print(&quot;\r\n+INQ=1\r\n&quot;); //make the slave bluetooth inquirable <br> Serial.println(&quot;The slave bluetooth is inquirable!&quot;); <br> delay(2000); // This delay is required. <br> blueToothSerial.flush(); <br>}
The motor shield you are using has a relativly high current demand. One standard nine volt battery cannot supply that current. With my shield, I was needing power supplys with at leaste 800ma, and settled on using a 1600mah battery for all projects using that shield. Did the 9v battery actually drive the shield?
Yes, it works just fine for me.
Interesting. Your motors must not have a very large current consumption then.
Great tutorial, and just at the right time for me. My next project is to be a robot just like this. Thanks for the helping hand
<br>http://www.netetrader.com --- <br> <br>free shipping <br>competitive price <br>any size available <br>accept the paypal <br> <br>Air jordan(1-24)shoes $33 <br> <br>Nike shox(R4,NZ,OZ,TL1,TL 2,TL3) $35 <br> <br>Handbags(Coach lv fendi d&amp;g) $35 <br> <br>Tshirts (ed hardy,lacoste) $16 <br> <br>Jean(True Religion,ed hardy,coogi) $30 <br> <br>Sunglasses(Oakey, coach,gucci,Armaini) $16 <br> <br>New era cap $15 <br> <br>Bikini (Ed hardy) $25 <br> <br>--- http://www.mineokmalls.com
(If you're going to glue your battery in place, best make sure it's rechargeable...?)
I didn't think that through very much, thanks for pointing that out. I think even if they were rechargeable, it would be difficult to recharge them while they're glued on. I suppose velcro, or some sort of holder would the best way to solve that problem.
You can get clips for the terminals, and clips for the actual battery - I'm guessing most folk will go that way. <br> <br>Since I have your attention, it would be nice to see a video of Carduino on the move...?
Video is soon to be posted.

About This Instructable


102 favorites


Bio: I am a human being that enjoys to build things. I also say GNU/Linux instead of just Linux. Yeah, I'm that kind of ...
More by alecnotalex: TouchPass: RFID Password Entry TiltKey- Write by Tilting RFI-DJ: MP3 Playing RFID Thing
Add instructable to: