You are on page 1of 9

HITEC UNIVERSITY

Department of Electrical Engineering


MIT Project Report
Bluetooth Controlled RC Car
Semester: 5th

Section: B

Group Members

Ali Tariq Lodhi

13-EE (E&T)-011

Haroon Jamal

13-EE (E&T)-016

Syed Adil Javed

13-EE (E&T)-104

Submitted to

Sir Waqas Ahmed

Introduction:
RC cars are often controlled by specific radio frequencies. Rarely any toy cars are
available in market that can be controlled by modern technologies i.e. Wi-Fi, Bluetooth etc.
Using such technologies can widen the scope and use of such car and can be controlled at a
lot of platforms.
Our objective was to convert an RC car into a Bluetooth controlled car so that we can
use other platforms to control the car i.e mobiles, tablets, PCs etc. Our target involved the
following processes:
1) Designing and sketching of functions of car
2) Developing and Android app for bluetooth control
3) Establishing connections of car with Arduino MEGA 2560.
At the end, we were successfully able to implement our idea and run the RC car with
our required control and platform.

Components:
1)
2)
3)
4)
5)
6)
7)
8)
9)

Arduino MEGA 2560


HC-06 Bluetooth Module
Android app
RC car
L293D IC (H-Bridge)
LEDs
Buzzer
Breadboard
Resistors

Working of Car:
We used http://ai2.appinventor.mit.edu/, a developer platform provided by MIT
University to develop Android apps. We used the following platform inorder to develop our
own app with the functionalities we require.
The app consists of several buttons which are used to control the motor, lights and
horn of the car. Each button, when pressed generates a numerical value which is sent to
Bluetooth module via the app. Arduino receives the value and correspondingly performs the
respective action assigned with the numerical value. Similarly all the functions of car have
been controlled by this simple method.

Code:
int blight=A1;

//pin set for bluelights of police lights

int rlight=A2;

//pin set for redlights of police lights

int lind=A4;

//pin set for left indicator

int rind=A5;

//pin set for right indicator

int revlight=A9;

//pin set for reverse lights

int frolight=A10;

//pin set for front lights

int baclight=A12;

//pin set for back lights

int dimmer=A13;

//pin set for high beam

int horn=A7;

//pin set for horn

int forward=50;

//pin set for forward moving of car

int reverse=51;

//pin set for reverse moving of car

int right=46;

//pin set for right turning of car

int left=47;

//pin set for left turning of car

int c;

//variable to store the incoming values from device

int a;

//variable to be used for loops

int time= 10;

//duration of tone

int freq = 0;

//frequency for tone

void setup()
{
Serial.begin(9600);

//setting data rate 9600 bits per second for serial communication

pinMode(blight, OUTPUT);

//setting blight pin as output

pinMode(rlight, OUTPUT);

//setting rlight pin as output

pinMode(lind, OUTPUT);

//setting lind pin as output

pinMode(rind, OUTPUT);

//setting rind pin as output

pinMode(revlight, OUTPUT); //setting revlight pin as output


pinMode(frolight, OUTPUT); //setting frolight pin as output
pinMode(baclight, OUTPUT); //setting baclight pin as output

pinMode(dimmer, OUTPUT);
pinMode(horn, OUTPUT);

//setting dimmer pin as output


//setting horn pin as output

pinMode(forward, OUTPUT); //setting forward pin as output


pinMode(reverse, OUTPUT); //setting reverse pin as output
pinMode(right, OUTPUT);
pinMode(left, OUTPUT);

//setting right pin as output


//setting left pin as output

void loop()
{
a=0;

//initializing value of a.

if (Serial.available())

//checking if data is available

{
c = Serial.read();

//read the incoming data and store in variable c.

if( c == 0)
{
digitalWrite(forward,HIGH); //move car forward
digitalWrite(reverse,LOW);

//stop the reversing of car

digitalWrite(revlight,LOW); //turn off the reverse light


}
else if( c == 2)
{
digitalWrite(reverse,HIGH); //reverse the car
digitalWrite(revlight,HIGH); //turn on reverse light
digitalWrite(forward,LOW);

}
else if( c == 1)
{

//stop the forwarding of car

digitalWrite(forward,LOW); //stop the reversing of car


digitalWrite(reverse,LOW); //turn off the reverse light
digitalWrite(revlight,LOW); //stop the forwaring of car
}
else if( c == 4)
{
digitalWrite(left,HIGH);

//turn car left

digitalWrite(lind,HIGH);

//turn on left indicator

delay(400);

//delay of 400 ms

digitalWrite(lind,LOW);

//turn off left indicator

delay(400);
digitalWrite(right,LOW);

//stop the turning right of car

digitalWrite(rind,LOW);

//turn off the right indicator

}
else if( c == 5)
{
digitalWrite(left,LOW);

//stop the turning left of car

digitalWrite(lind,LOW);

//turn off left indicator

digitalWrite(right,LOW);

//stop the turning right of car

digitalWrite(rind,LOW);

//turn off right indicator

}
else if( c == 6)
{
digitalWrite(right,HIGH);

//turn car right

digitalWrite(rind,HIGH);

//turn on right indicator

delay(400);

//delay of 400ms

digitalWrite(rind,LOW);

//turn off right indicator

delay(400);
digitalWrite(left,LOW);

//stop the turning left of car

digitalWrite(lind,LOW);

//turn off left indicator

}
else if( c == 7)
{
digitalWrite(left,LOW);

//stop the turning left of car

digitalWrite(lind,LOW);

//turn off left indicator

digitalWrite(right,LOW);

//stop the turning right of car

digitalWrite(rind,LOW);

//turn off right indicator

}
else if(c == 8)
{
while(a<5)

//number of loops

{
digitalWrite(blight,HIGH); //turn on bluelights
delay(50);

//delay of 50ms

digitalWrite(blight,LOW); //turn off bluelights


delay(50);
digitalWrite(blight,HIGH);
delay(50);
digitalWrite(blight,LOW);
delay(300);

//delay of 300ms

digitalWrite(rlight,HIGH); //turn on redlights


delay(50);
digitalWrite(rlight,LOW); //turn off redlights
delay(50);
digitalWrite(rlight,HIGH);
delay(50);
digitalWrite(rlight,LOW);
delay(300);

a++;
}
}
else if(c == 9)
{
digitalWrite(blight,LOW);

//turn off bluelights

digitalWrite(rlight,LOW);

//turn on bluelights

}
else if(c == 10)
{
for (freq = 150; freq < 1800; freq += 1) //turn siren on
{
tone(horn, freq, time);
delay(1);

//horn pin,frequency,duration

//delay of 1ms

}
for (freq = 1800; freq > 150; freq -= 1)
{
tone(horn, freq, time);
delay(1);
}
}
else if(c == 11)
{
digitalWrite(horn,LOW);

//turn off siren

}
else if( c == 12)
{
while(a<5)
{

//run loops 5 times


//*Hazard lights*

digitalWrite(lind,HIGH);

//turn on right indicator

digitalWrite(rind,HIGH);

//turn on left indicator

delay(400);

//delay of 400ms

digitalWrite(lind,LOW);

//turn off left indicator

digitalWrite(rind,LOW);

//turn on right indicator

delay(400);
a++;
}
}
else if(c == 13)
{
digitalWrite(lind,LOW);

//turn off left indicator

digitalWrite(rind,LOW);

//turn off right indicator

}
else if(c == 16)
{
digitalWrite(frolight,HIGH); //turn on front lights
digitalWrite(baclight,HIGH); //turn on back lights
}
else if(c == 17)
{
digitalWrite(frolight,LOW);

//turn off front lights

digitalWrite(baclight,LOW);

//turn off back lights

}
else if(c == 14)
{
digitalWrite(horn,HIGH);
}
else if(c == 15)

//turn on the horn

{
digitalWrite(horn,LOW);

//turn off the horn

}
else if(c == 18)
{
digitalWrite(dimmer,HIGH);

//turn on high beam

}
else if(c == 19)
{
digitalWrite(dimmer,LOW);

//turn off high beam

}
}
}

Improvements:
1) Wi-Fi Shield can be used instead of Bluetooth inorder to extend the operation range of
the car.
2) Further refining and improvement in the app and code can make the functions of car
much more realistic.
3) A high power battery can be used and its safety circuit too, in order to fulfill the power
requirements of car, as the car needs so much power to run.

You might also like