tayyabrafiqkehar
Published © GPL3+

Arduino Bluetooth car

This project is Arduino Bluetooth car basically it connect with your smart phone with help of Bluetooth. you can easily control it.

BeginnerProtip2,691
Arduino Bluetooth car

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
1Sheeld Motor driver L298N
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
DC Motor, 12 V
DC Motor, 12 V
×2
jamper wires
×1
Battery Holder, 18650 x 2
Battery Holder, 18650 x 2
×1
18650 battery
×1

Software apps and online services

arduino rc car

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Arduino Bluetooth Controlled Car diagram

Follow the diagram

Code

Arduino Bluetooth Controlled Car Code

Arduino
#include<SoftwareSerial.h>
SoftwareSerial bluetooth(10,11);
char data;
int a=150,b=150;
void setup() {
  Serial.begin(115200);
  bluetooth.begin(9600);
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
}
void loop() {
  if(bluetooth.available()){
  data=bluetooth.read();
  Serial.println(data);
}  
  if(data=='F'){forward();}
  if(data=='B'){backward();}
  if(data=='L'){left();}
  if(data=='R'){right();}
  if(data=='S'){stop();}
}
void forward(){
  digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
  analogWrite(4,a);
  
  digitalWrite(5,HIGH);
  digitalWrite(6,LOW);
  analogWrite(7,b);
  }
void backward(){
  digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
  analogWrite(4,a);
  
  digitalWrite(5,LOW);
  digitalWrite(6,HIGH);
  analogWrite(7,b);
  }
void right(){
 digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
  analogWrite(4,a);
  
  digitalWrite(5,LOW);
  digitalWrite(6,HIGH);
  analogWrite(7,b);
  }
void left(){
  digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
  analogWrite(4,a);
  
  digitalWrite(5,HIGH);
  digitalWrite(6,LOW);
  analogWrite(7,b);
  }
void stop(){
 digitalWrite(2,LOW);
  digitalWrite(3,LOW);
  analogWrite(4,0);
  
  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  analogWrite(7,0);
  }

Credits

tayyabrafiqkehar

tayyabrafiqkehar

1 project • 0 followers

Comments