Easier Approach to Electronic Projects

Basic Programmed Robot


This page will lead you to step in to robotics, and show you how to make your First Robot Completely programmed by arduino :) Believe me, making robot with arduino is really a piece of cake only if once you have a complete understanding of things…
 
I just tried to make it as simple as possible, and show you how actually you just tell your robot what to do using Arduino. So you just need following part list
 

 Parts Required:

   1.   Arduino
   2.   L298 H-bridge IC
   3.   Two Powerful DC motors
   4.   Two nine volt batteries
   5.   One battery Clip
   6.   one 2.2mm jack – 9v Battery Clip for powering Arduino(See)
   7.   Small perfboard
Isn’t that parts list too simple for your first robot ?? 😀 That was actually my goal :) make things easy and encourage learners 😉
 
 
Pin 2 and 3 are to be connected to Motor 1
Pin 10 and 12 are to be connected to Motor 2
For more information regarding this IC please hit the link IC Pin Configuration                            

Bread board Arrangement: 

L298 IC construction and it’s Pin Diagram is too weird & very irritating :p lol you are lucky that you got a Breadboard Arrangement..

 

The bad part of DC motors is that, they dont come with any gears :( you gotta find and attach it with some strong sticky liquid on tires 😉
 and Your tires must have a good grip, like rubber or something. I got these tires from my old toy :p
Further I encased all of the stuf in this my Wallet case :p which is not a good idea 
at all.. Because this case was of hard paper and it is not reliable and not proper to carry the weight of both 9v batteries and motors. So my Robot was not properly moving straight, but slight with a direction due to dis-Allignement of the motors :( I just tried to test my circuit, was eager to play it so just start building it with this hard paper wallet case :p I will suggest you to build it with something else which is strong and also light 😉
Well, still it is most simplest robot I think you will find on internet and a best one to start with. Best part of this robot is that it can be further advanced by adding LDRs or other sensors easily. This is the Basic building block in the field of your robotics 😉    Enjoy !!!
 

CODING:
Actually one thing is very important to keep in mind, First Connect all pins and then program, Because your code’s movement functions(e.g moveForward, mvoveBackward, turnRight…) will be different from mine.. It depends on connections.
May be you swap the leads 5-6 / 9-10 with the IC’s Inputs 1-2 / 3-4..
              Or Swap the Motor’s pins with IC’s outputs 1-2 / 3-4
 
So once you have programmed, then make your movement functions.. Here is the code which will help you how to do so.
 
void setup() {                
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
}

void loop() { //Right now this loop will act the robot as a petroling from one point to another :)
  moveForward();
  delay(5000);
  turnAround();
}

//—————Movement Functions, Above this line that is the main text—————-
void moveForward() {
  digitalWrite(9, LOW);   
  digitalWrite(10, HIGH);   
  digitalWrite(5, LOW);  
  digitalWrite(6, HIGH); 
}

void moveBackward() {
  digitalWrite(5, HIGH);   
  digitalWrite(6, LOW);   
  digitalWrite(9, HIGH);   
  digitalWrite(10, LOW);
}
 
void turnLeft() {
  digitalWrite(9, LOW);   
  digitalWrite(10, HIGH);   
  digitalWrite(5, HIGH);   
  digitalWrite(6, LOW);
}

void turnRight() {
  digitalWrite(5, LOW);   
  digitalWrite(6, HIGH);    
  digitalWrite(9, HIGH);   
  digitalWrite(10, LOW);
}

void turnAround() {
  turnRight();   
  delay(2300);
}

Read more:
5v Supply to arduino using 7805 Voltage regulator
Power Supplies for Arduino

Arduino needs 5v voltage supply to run, There are various ways to feed it. I have shown three approaches here. 1....

Sitemap

Below is the Tree map of all Projects(Pages) and Posts on my site. http://www.eeweb.com/ EEWeb.com is an Electrical Engineering News,Resources and...

Flashing Railroad lights (2)
Flashing Rail road Lights

  This project flashes two LEDs alternatively with equal intervals of time so they act like a Model Railroad lights...

Close