Android+Arduino RC Car

The previous attempt was in shambles due to the lack of proper products. This time, I got myself a Sainsmart L293D motor driver (actually a cloned version of the ever so popular Adafruit L293D driver) and a handy four wheel drive chassis. Hereupon, the only adjustment required was the use of analog pins as digital pins. This is the consequence of the motor driver using up all the digital pins and leaving no pins for the Bluetooth shield. I also hooked up the Arduino to a USB power bank.

Tools used: ~ Arduino Uno ~ 4WD Chassis ~ SainSmart motor driver (L293D) ~ Sunkee 30ft Bluetooth Module ~ Anker 15000 mAh power bank

Arduino

//Project: Android RC Car
//Author: Ayush Subedi

#include <AFMotor.h> //import Adafruit Motor library
#include <SoftwareSerial.h>// import the serial library
SoftwareSerial newPorts(15, 17); // RX =15= A1, TX=17=A3  
AF_DCMotor motor1(1, MOTOR12_1KHZ); // create motor #1, 1KHz pwm
AF_DCMotor motor2(2, MOTOR12_1KHZ); // create motor #2, 1KHz pwm
AF_DCMotor motor3(3, MOTOR34_1KHZ); // create motor #3, 1KHz pwm
AF_DCMotor motor4(4, MOTOR34_1KHZ); // create motor #4, 1KHz pwm

void setup() {
  newPorts.begin(9600);           
  motor1.setSpeed(255);     // set the speed to 200/255
  motor2.setSpeed(255);     // set the speed to 200/255
  motor3.setSpeed(255);     // set the speed to 200/255
  motor4.setSpeed(255);     // set the speed to 200/255
}

void loop() {  
    while (newPorts.available() > 0)
  {
    char ch = newPorts.read();
    newPorts.println(newPorts.read());  
    executeReceivedCommand(ch);
  } 
}

void executeReceivedCommand(char command)
{
  switch (command)
  {
    //Forward
  case '0':
    motor1.run(FORWARD);     
    motor2.run(FORWARD);
    motor3.run(FORWARD);
    motor4.run(FORWARD);  
  break;
    
    //Reverse
  case '1':
    motor1.run(BACKWARD);     
    motor2.run(BACKWARD);
    motor3.run(BACKWARD);
    motor4.run(BACKWARD);
   
  break;     

    //Left : skid steering
    case '3':
    motor1.run(FORWARD);
    motor4.run(FORWARD);
    motor2.run(RELEASE);
    motor3.run(RELEASE);
  break;
  
    //Right : skid steering
    case '4':
    motor2.run(FORWARD);
    motor3.run(FORWARD);
    motor1.run(RELEASE);
    motor4.run(RELEASE);
  break;

     //Stall
  case '2':
    motor1.run(RELEASE);      
    motor2.run(RELEASE);
    motor3.run(RELEASE);
    motor4.run(RELEASE);    
  break;
  }
}

In a nutshell, the Android device sends Char type to Arduino which is used to rotate the motors to maneuver towards a desired direction.

Forward: 0 Reverse: 1 Stop: 2 Left: 3 Right: 4

The car turns left and right by implementing skid steering.

Pictures and Video: