Redha Aouadja
Published © GPL3+

Beautiful Bluetooth Controlled Car

Unlike any other car project

IntermediateFull instructions provided1,216
Beautiful Bluetooth Controlled Car

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
9V battery (generic)
9V battery (generic)
×1
AA Batteries
AA Batteries
×5
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×2
Any RC car
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

the basic montage

It is easier than it seems ! dont worry :)

schematic

Code

the code for using the HC-05

C/C++
It is simple and very basic
//this is by using the HC-05
#include<SoftwareSerial.h> 
int bluetoothTx = 2;
int bluetoothRx = 3;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

int flights =4; //front lights of the car
int rlights = 5; //rear lights
int spot = 9; //optional big led at the top

int front = 11; //motors go forward
int back = 10; //motors go backwrads
int left = 13; //wheels turn left
int right = 12; //wheels turn right
char command ;


void setup() { //define the inputs and the outputs

  pinMode(front, OUTPUT);
  pinMode(back, OUTPUT);
  pinMode(left, OUTPUT);
  pinMode(right, OUTPUT);
  pinMode(flights, OUTPUT);
  pinMode(rlights, OUTPUT);
 
  Serial.begin(9600);
  
  bluetooth.begin(9600);

}

void loop() {

  get_command();

  Serial.println(command); // to show the actual user commands

do_action(command); //the function of all controls
  
  
  
 
}

void get_command (){
    while (bluetooth.available() <= 0) {
    }
    command = bluetooth.read();
      do_action(command);
  }
  
 void do_action(char act){
  switch (act) { //those cases are optimsed to work with arduino car remote app
      case 'F':  //moving the Car Forward
  
        digitalWrite(back, LOW);
        digitalWrite(front, HIGH);
        digitalWrite(left, LOW);
        digitalWrite(right, LOW);
       
        break;
      case 'B':  //moving the Car Backward
        digitalWrite(front, LOW);
        digitalWrite(back, HIGH);
        digitalWrite(left, LOW);
        digitalWrite(right, LOW);

        break;
      case 'L':  //moving the Car Left
        digitalWrite(front, LOW);
        digitalWrite(left, HIGH);
        digitalWrite(right, LOW);
        digitalWrite(back, LOW);


        break;
      case 'R':   //moving the Car Right
        digitalWrite(front, LOW);
        digitalWrite(right, HIGH);
        digitalWrite(back, LOW);
        digitalWrite(left, LOW);
     

        break;
      case 'S':   //Stop
        
        digitalWrite(front, LOW);
        digitalWrite(back, LOW);
        digitalWrite(left, LOW);
        digitalWrite(right, LOW);

        break;
      case 'I':  //moving Forward right
        digitalWrite(back, LOW);
        digitalWrite(front, HIGH);
        digitalWrite(left, LOW);
        digitalWrite(right, HIGH);
        break;
      case 'J':  //moving  backward right
        digitalWrite(front, LOW);
        digitalWrite(back, HIGH);
        digitalWrite(left, LOW);
        digitalWrite(right, HIGH);
        break;
      case 'G':  //moving Car Forward left
        digitalWrite(back, LOW);
        digitalWrite(front, HIGH);
        digitalWrite(right, LOW);
        digitalWrite(left, HIGH);

        break;
      case 'H':  //moving the Car backward left
        digitalWrite(front, LOW);
        digitalWrite(back, HIGH);
        digitalWrite(right, LOW);
        digitalWrite(left, HIGH);
        break;
        case 'W' : //turning on the lights
        digitalWrite(flights, HIGH);
        digitalWrite(rlights, HIGH);
        break;
        case 'w' : //turning off the lights
        digitalWrite(flights, LOW);
        digitalWrite(rlights, LOW);
        break;
        case 'U' : //turning on all the big led light
        digitalWrite(spot, HIGH);
        break;
        case 'u' : //turning it off
        digitalWrite(spot, LOW);
        break;
      default : break;
  }
  }

Credits

Redha Aouadja

Redha Aouadja

2 projects • 2 followers
We can create magic !

Comments