Chandran N
Published © GPL3+

Bluetooth Controlled Bot (Using Adafruit L293D Motor Driver)

A robot which is controlled by an HC-05 module and receives commands using a Bluetooth terminal app.

BeginnerShowcase (no instructions)2 hours6,663
Bluetooth Controlled Bot (Using Adafruit L293D Motor Driver)

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Adafruit L 293 D motor driver
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
DC motor (generic)
×2

Software apps and online services

Arduino IDE
Arduino IDE
Bluetooth Terminal

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Code

Code implemented for the bot

Arduino
Again reiterating,this code works only if you are using the Adafruit L 293 D motor shield and have followed the instructions in the video and imported the library.
char j;
String iS="";
#include<AFMotor.h>//Follow instructions in the video to understand how to import the same(All credit on how to use the same goes to the creator of the video)
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
void setup()    
{
 motor1.setSpeed(200);//Can be set from 0-255
 motor2.setSpeed(200);//Can be set from 0-255
 Serial.begin(9600);           
}
void loop()
{
  if(Serial.available()){
  while(Serial.available())
    {
      char iC = (char)Serial.read();
      iS += iC;       
    }
    Serial.println(i);
    while (Serial.available() > 0)  
    { j = Serial.read() ; }      
    if(iS == "f"){  //To move forward      
      motor1.run(FORWARD);
      motor2.run(FORWARD);
    }else if(iS == "b"){ //To move backward 
      motor1.run(BACKWARD);
      motor2.run(BACKWARD);
    }
    else if(iS == "l"){  //To move left
      motor1.run(FORWARD);
      motor2.run(RELEASE);
    }
    else if(iS == "r"){//To move right 
      motor1.run(RELEASE);
      motor2.run(FORWARD);
    }
    else if(iS == "s"){  //To stop
      motor1.run(RELEASE);
      motor2.run(RELEASE);
    }
    iS = "";
  }
}

Credits

Chandran N

Chandran N

5 projects • 15 followers
I am a student at NITK Surathkal pursuing Mechanical Engineering.I am interested in Robotics,Arduino,IoT,Automobiles and Astronomy.
Thanks to MasterTech.

Comments