Introduction: Make a Robot With Arduino for Beginners



Step 1: Materials Needed

  1. Tamiya Track and Wheel Set Assembly ($7.95 at Pololu)
  2. Tamiya 70168 Double Gearbox Kit ($9.25 at Pololu)
  3. L298N Dual H Bridge ($3.65 at Amazon and might be much lower at ebay)
  4. 4AA Battery Holder (used from broken electronics)
  5. 200mm Female and Male Jumper Cables ($2.60 at Amazon)
  6. Universal Tamiya plate ($7.77 at Amazon)
  7. Arduino Uno or its clone

Note: Universal Tamiya Plate is optional. That is you can use wood in place of it. But, for convince I've used the plate.

Step 2: Procedure

  1. Assemble the gear motor as described in the manual. For this project I've used 114.7:1 gear ratio
  2. Mount the double gear motor onto the Tamiya plate
  3. Connect the 6V battery holder (+) to the L298N +12V port and (-) to the GND using jumper cables
  4. Connect the arduino GND to the L298N GND
  5. Finally, connect the motors to the L298N two side output ports
  6. Follow my drawing for circuitry for further clarity
  7. Connect the pins of L298N to Arduino as the following:

Right side

Pin1 --------------------------------- 3 of Arduino (PMW pin)

Pin 2 --------------------------------- 6

Pin 3 --------------------------------- 4

Pin 4 --------------------------------- 13

Pin 5 --------------------------------- 12

Pin 6----------------------------------- 9 (PMW pin)

Note: Don't worry about the polarity of the motor connection because we can change it through the code

Step 3: Code

First of all, download the Arduino Software from their website. Then copy and paste the following code:

void setup(){
 Serial.begin(9600);
 //right motor
 pinMode(3,OUTPUT);
 pinMode(6,OUTPUT);
 pinMode(4,OUTPUT);//pwm
 //left motor
 pinMode(13,OUTPUT);
 pinMode(12,OUTPUT);
 pinMode(9,OUTPUT);//pwm
 
}
void loop()
{
  int Racerspeed=80;
  int ReverseSpeed=60;
  //forward
 digitalWrite(6,HIGH);
 delay(100);
 digitalWrite(4,LOW);
 analogWrite(3,Racerspeed);//right motor</p><p> digitalWrite(13,HIGH);
 delay(100);
 digitalWrite(12,LOW);
 analogWrite(9,Racerspeed);// left motor 
 
 delay(4000);
 //reverse
 
 digitalWrite(6,LOW);
 delay(100);
 digitalWrite(4,HIGH);
 analogWrite(3,ReverseSpeed);</p><p> digitalWrite(13,LOW);
 delay(100);
 digitalWrite(12,HIGH);
 analogWrite(9,ReverseSpeed);// left motor</p><p> delay(5000);</p><p> //stop
 digitalWrite(6,LOW);
 delay(100);
 digitalWrite(4,LOW);
 analogWrite(3,0);// right motor</p><p> digitalWrite(13,LOW);
 delay(100);
 digitalWrite(12,LOW);
 analogWrite(9,0);// left motor</p><p> delay(5000);
  
 //turnleft
 digitalWrite(13,LOW); //changed this (7/12/2015)
 delay(100);
 digitalWrite(12,HIGH);
 analogWrite(9,30);// left motor</p><p> digitalWrite(6,HIGH);
 delay(100);
 digitalWrite(4,LOW);
 analogWrite(3,120);//right motor</p><p>  delay(1000);
 
}

Step 4: Future Updates

Yes! You saw it right there are more updates coming for this robot. Some of them are as follows:

1) Adding ON/OFF switch

2) Controlling it with IR remote

3) Adding distance sensor

Stay tuned, and happy making robots!

Any donations will be used for future projects, thank you!

Donate

Comments

author
SpecialRobotBuilders (author)2015-08-11

Love this! Thanks for posting. I have a couple of questions. First, are you running the arduino and the motor controller off of the same set of batteries? Second, how did you connect the tiny Tamiya motor connections to the motor controller? I was hoping for a solderless connector but can't seem to find any that fit.

author

Yes, I'm running arduino and motor controller with same set of batteries. I soldered them to a wire. This is the most convenient way to connect them.

author
ZackC1 (author)saimouli2015-08-26

what is gnd?

author
saimouli (author)ZackC12015-08-26

Ground, connect that to the negative terminal of the battery

author

Thank you for the information.

author
tomatoskins (author)2015-07-17

This looks like a lot of fun! Thanks for sharing!

author
saimouli (author)tomatoskins2015-07-17

You are welcome!

author
pmaheshwari3 (author)saimouli2015-08-22

Can we get all the parts and set in india??

author
saimouli (author)pmaheshwari32015-08-23

Yes I think so, but maybe with different name. You need to some research.

About This Instructable

4,700views

81favorites

License:

More by saimouli:Control robot with a TV remoteMake a Robot With Arduino for Beginners
Add instructable to: