Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
JANAK13
Published © GPL3+

Bluetooth Controlled Car

This project shows how you can build a car which can be controlled by your smartphone using an android application via Bluetooth.

IntermediateFull instructions provided70,927
Bluetooth Controlled Car

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
12 V 200 rpm DC Motor
×2
L293D Motor Drive Shield for Arduino Uno
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

The circuit

These are the connections. Connect 12v power source to the motor driver shield. Please note that the schematic does not include the external power source.

Code

The code

C/C++
This code has to uploaded on Arduino Uno
#include <AFMotor.h>

AF_DCMotor motor1(1);  //motor1 is the left motor
AF_DCMotor motor2(2);  //motor2 is the right motor

int val;
void setup()
{
  Serial.begin(9600); 
 
  motor1.setSpeed(255); //motor speed is set
  motor2.setSpeed(255);
  Stop();
}


void loop() {
 
bt=Serial.read();

if(val=='1')  //when the bluetooth module recieves 1 the car moves forward
{
 forward(); 
}

if(val=='2')  //when the bluetooth module recieves 2 the car moves backward
{
 backward(); 
}

if(val=='3') //when the bluetooth module recieves 3 the car moves left
{
 left(); 
}

if(val=='4')  //when the bluetooth module recieves 4 the car moves right
{
 right(); 
}

if(val=='5') //when the bluetooth module recieves 5 the car stops
{
 Stop(); 
}

}
void forward()
{
     motor1.run(FORWARD);
  motor2.run(FORWARD);
}

void backward()
{
     motor1.run(BACKWARD);
  motor2.run(BACKWARD);
}
void left()
{
  motor1.run(BACKWARD);
  motor2.run(FORWARD);
}
void right()
{
  motor1.run(FORWARD);
  motor2.run(BACKWARD);
}
void Stop()
{
  motor1.run(RELEASE);
  motor2.run(RELEASE);
}

Credits

JANAK13
6 projects • 44 followers

Comments