mohammadsohail0008
Published © GPL3+

Android Mobile Controlled Bluetooth RC Car

Android controlled car

IntermediateFull instructions provided5,207
Android Mobile Controlled Bluetooth RC Car

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
L293D motor driver Adafruit
×1
DC Motor, 12 V
DC Motor, 12 V
×4
Maker Essentials - Micro-motors & Grippy Wheels
Pimoroni Maker Essentials - Micro-motors & Grippy Wheels
×4
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
5 mm LED: Red
5 mm LED: Red
×2
High Brightness LED, White
High Brightness LED, White
×2
Jumper wires (generic)
Jumper wires (generic)
×1
Battery Holder, 18650 x 2
Battery Holder, 18650 x 2
×1
18650 battery x 2
×1
Android device
Android device
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Acrylic sheet

Story

Read more

Schematics

Circuit Diagram

Code

Code

Arduino
// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //
// Smartphone controlled Robot //
// By MOHD SOHAIL //

#include <AFMotor.h>

AF_DCMotor motor1(1, MOTOR12_1KHZ); 
AF_DCMotor motor2(2, MOTOR12_1KHZ); 
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);

int whiteled = A5;
int redled = A4;

char command; 

void setup() 
{       
  Serial.begin(9600); 
  pinMode(whiteled, OUTPUT);
  pinMode(redled, OUTPUT); 
}

void loop(){
  if(Serial.available() > 0){ 
    command = Serial.read(); 
    Stop(); 

    switch(command){
    case 'F':  
      forward();
      break;
    case 'B':  
       back();
      break;
    case 'L':  
      left();
      break;
    case 'R':
      right();
      break;
      case 'S':
      Stop();
      break;
    case 'a':
      on();
      break;
    case 'b':
      off();
      break;
    }
  } 
}

void forward()
{
  motor1.setSpeed(150); //Define maximum velocity
  motor1.run(FORWARD); //rotate the motor clockwise
  motor2.setSpeed(150); //Define maximum velocity
  motor2.run(FORWARD); //rotate the motor clockwise
  motor3.setSpeed(150);//Define maximum velocity
  motor3.run(FORWARD); //rotate the motor clockwise
  motor4.setSpeed(150);//Define maximum velocity
  motor4.run(FORWARD);
  digitalWrite(redled , LOW);//rotate the motor clockwise
}

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

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

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

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
  digitalWrite(redled , LOW);
}

void on()
{
  digitalWrite(whiteled , HIGH);
}

void off()
{
  digitalWrite(whiteled , LOW);
}

Credits

mohammadsohail0008

mohammadsohail0008

42 projects • 31 followers

Comments