Defence Bot
2038 5
Yuvraj Singh

Defence Bot

The aim of our project is to make a Voice + Manually Controllable Robot Car. The working is based...

Description:-

The aim of our project is to make a Voice + Manually Controllable Robot Car. The working is based on an Arduino microcontroller, motor drivers, A Bluetooth module. Arduino is open-source hardware (single-board microcontrollers and kits) used for building digital devices. The idea is to first design the Hardware of the Robot Car and then code the entire work using our previous knowledge of programming. The code will then be simulated on software (IDE) and later be interfaced with the hardware. The coordination of the control unit with a Bluetooth gadget is accomplished utilizing a Bluetooth module to catch and read the voice orders. The controlling remote is a smart android device with Bluetooth Application. We picked this as our project as robotics has become a major part of our everyday lifestyle and also has a wide scope in the engineering field. It plays a vital role in the development of new technology.

Project Used Hardware

Defence Bot Hardware

ARDUINO, L293D MOTOR DRIVER

Project Used Software

ARDUINO IDE, MIT APP INVENTORY

Project Hardware Software Selection

We have used. Arduino because it is cheap to make any type of prototype and Mit app inventory to make an app because it is easy to make the app without too much code.

Circuit Diagram

Defence Bot Circuit Diagram

 

The circuit comprises Arduino UNO Board, HC-05/HC-06 Bluetooth Module, L293D Motor Driver IC, a couple of DC Geared Motors of 250 RPM and a 9V Battery. The TX, RX pins of Arduino are associated with Rx, Tx pins of Bluetooth Module. The Bluetooth Module is provided with 5V. Essentially, the left DC engine is associated with pin no 3 and 6 of L293D and right DC engine to stick no 14 and 11 of L293D. Arduino advanced pins 2,3,4,5 are associated with L293D 2, 7, 10, 15 respectively. The L293D IC Pins 2, 5, 12, 13 are GND pins, and 9, 1, 16 is provided with 5V. Be that as it may, pin 8 of L293D is straightforwardly provided with 9V.

 

 

Code

#include <AFMotor.h>

//initial motors pin
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);

char command;

void setup()
{
  Serial.begin(9600);  //Set the baud rate to your Bluetooth module.
}

void loop(){
  if(Serial.available() > 0){
    command = Serial.read();
    Stop(); //initialize with motors stoped
    //Change pin mode only if new command is different from previous.
    //Serial.println(command);
    switch(command){
    case 'f':
      forward();
      break;
    case 'b':
       back();
      break;
    case 'l':
      left();
      break;
    case 'r':
      right();
      break;
    }
  }
}

void forward()
{
  motor1.setSpeed(255); //Define maximum velocity
  motor1.run(FORWARD); //rotate the motor clockwise
  motor2.setSpeed(255); //Define maximum velocity
  motor2.run(FORWARD); //rotate the motor clockwise
  motor3.setSpeed(255);//Define maximum velocity
  motor3.run(FORWARD); //rotate the motor clockwise
  motor4.setSpeed(255);//Define maximum velocity
  motor4.run(FORWARD); //rotate the motor clockwise
}

void back()
{
  motor1.setSpeed(255); //Define maximum velocity
  motor1.run(BACKWARD); //rotate the motor anti-clockwise
  motor2.setSpeed(255); //Define maximum velocity
  motor2.run(BACKWARD); //rotate the motor anti-clockwise
  motor3.setSpeed(255); //Define maximum velocity
  motor3.run(BACKWARD); //rotate the motor anti-clockwise
  motor4.setSpeed(255); //Define maximum velocity
  motor4.run(BACKWARD); //rotate the motor anti-clockwise
}

void left()
{
  motor1.setSpeed(255); //Define maximum velocity
  motor1.run(BACKWARD); //rotate the motor anti-clockwise
  motor2.setSpeed(255); //Define maximum velocity
  motor2.run(BACKWARD); //rotate the motor anti-clockwise
  motor3.setSpeed(255); //Define maximum velocity
  motor3.run(FORWARD);  //rotate the motor clockwise
  motor4.setSpeed(255); //Define maximum velocity
  motor4.run(FORWARD);  //rotate the motor clockwise
}

void right()
{
  motor1.setSpeed(255); //Define maximum velocity
  motor1.run(FORWARD); //rotate the motor clockwise
  motor2.setSpeed(255); //Define maximum velocity
  motor2.run(FORWARD); //rotate the motor clockwise
  motor3.setSpeed(255); //Define maximum velocity
  motor3.run(BACKWARD); //rotate the motor anti-clockwise
  motor4.setSpeed(255); //Define maximum velocity
  motor4.run(BACKWARD); //rotate the motor anti-clockwise
}

void Stop()
{
  motor1.setSpeed(0); //Define minimum velocity
  motor1.run(RELEASE); //stop the motor when release the button
  motor2.setSpeed(0); //Define minimum velocity
  motor2.run(RELEASE); //rotate the motor clockwise
  motor3.setSpeed(0); //Define minimum velocity
  motor3.run(RELEASE); //stop the motor when release the button
  motor4.setSpeed(0); //Define minimum velocity
  motor4.run(RELEASE); //stop the motor when release the button
}