edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
ashraf_minhaj
Published © MIT

LulaBot: Arduino Rolling Robot!

A two-wheeled, Arduino-based robot that rolls around.

IntermediateFull instructions provided4,962
LulaBot: Arduino Rolling Robot!

Things used in this project

Hardware components

SparkFun Electronics Arduino Pro Mini 328 - 5V/16MHz
×1
Dual H-Bridge motor drivers L293D
Texas Instruments Dual H-Bridge motor drivers L293D
×1
Dual H-Bridge motor drivers L298
SparkFun Electronics Dual H-Bridge motor drivers L298
Use any 1 of the motor drivers that suits you
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1

Software apps and online services

Arduino IDE
Arduino IDE
arduino rc car

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Circuit Diagram

circuit with l298n

more detailed circuit

Code

Code

C/C++
/****LulBot***/

/* Arduino Rolling robot
 *  by Ashraf Minhaj
 *  mail me at [email protected]
 *  tutorial- ashrafminhajfb.blogspot.com
 */

//Declare the arduino pins

int lm1 = 10; //declare 1st motor pins
int lm2 = 9;

int rm1 = 8;   //right motor pins
int rm2 = 7;


void setup()
{
  //initlize the mode of the pins
   pinMode(lm1,OUTPUT);
   pinMode(lm2,OUTPUT);
   pinMode(rm1,OUTPUT);
   pinMode(rm2,OUTPUT);

   //set the serial communication rate
  Serial.begin(9600);
}

void loop()
{
  //check whether arduino is reciving signal or not 
  while(Serial.available() == 0);
  char val = Serial.read() ;//reads the signal
  Serial.print(val);

  /*********For Forward motion*********/
  
  if (val == 'F')
  {
    Serial.println("FORWARD");
    digitalWrite(lm1,HIGH);  
    digitalWrite(rm1,HIGH);
    digitalWrite(lm2,LOW);       
    digitalWrite(rm2,LOW);
    
  }

 
    /*********For Backward Motion*********/
  else if(val == 'B')
  {
    Serial.println("BACK");
    digitalWrite(lm2,HIGH);    
    digitalWrite(rm2,HIGH);
    digitalWrite(lm1,LOW);      
    digitalWrite(rm1,LOW);
  
  }
   /*********Right*********/
  else if(val == 'R')
  {
    Serial.println("RIGHT");
    digitalWrite(lm1,HIGH);  
    digitalWrite(rm2,HIGH);
    digitalWrite(lm2,LOW);       
    digitalWrite(rm1,LOW);
  }
   /*********Left*********/
  else if(val == 'L')
  {
    Serial.println("LEFT");
    digitalWrite(lm2,HIGH);  
    digitalWrite(rm1,HIGH);
    digitalWrite(lm1,LOW);       
    digitalWrite(rm2,LOW);
  
  }

  
  /*********STOP*********/
  else
  {
    Serial.println("No data or Invalid!!!");
    digitalWrite(lm1,LOW);  
    digitalWrite(rm1,LOW);
    digitalWrite(lm2,LOW);       
    digitalWrite(rm2,LOW);

  }
  
}

Credits

ashraf_minhaj
5 projects • 84 followers
Love to kill Soft things with Python and C++, Hard things with Soldering Iron.

Comments