Arduino Bluetooth Controlled Car Project Report

November 13, 2017 | Author: Syed Adil Javed | Category: Integer (Computer Science), Bluetooth, Arduino, Personal Identification Number, Bit Rate
Share Embed Donate


Short Description

This is our semester project report. Complete code has been provided how to control and add functions in the RC Car. Sor...

Description

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 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
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF