Interfacing HC-05(Bluetooth) with RC controller app
Hardware Required
- Bluetooth Module HC-05
- ARDUINO UNO
- Connecting Wires
- ANDROID Phone
- 4 LEDs
Software Used
- ARDUINO Bluetooth RC Car
About ARDUINO
Arduino is a popular open-source development board for engineers and makers to develop electronics projects in an easy way. It consists of both a physical programmable development board (based on AVR series of microcontrollers) and a piece of software or IDE which runs on your computer and used to write and upload the code to the microcontroller board.
About Bluetooth
In today’s world Bluetooth has become very popular and almost every device like mobile phone, laptop, and cars infotainment system uses Bluetooth for wireless communication. Bluetooth is not only used to transfer data but also to control another Bluetooth devices wirelessly, like using Bluetooth headset you can hear the song wirelessly from your mobile phone or can use car audio system to play the songs from your mobile. Bluetooth is a wireless technology that works on the frequency of 2.4GHz. Normal Bluetooth signal is in range of 10 meter radius. Bluetooth is most commonly used wireless technology in embedded projects provided that the range of communication is limited. Bluetooth has added advantage of its low power consumption and low cost operation. It is generally used for interfacing microcontrollers with Smart Phones by using Bluetooth applications.
Tutorial ABOUT
This tutorial is about interfacing Bluetooth(HC-05) with the software ARDUINO Bluetooth RC CAR and glowing 4 LEDs
Connections
· VCC to VCC on ARDUINO board
· GND to GND on ARDUINO board
· RXD to TXD on ARDUINO board
· TXD to RXD on ARDUINO board
Overview of the software
First we need to go to settings of the android phone and then pair with the name of the device and then enter the password 1234. Next we need to open the software and then after clicking the settings we need to click Connect TO CAR and then click on the name of the device of your bluetooth.
CODE
char a = ' ' ;
void setup()
{
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
Serial.begin(9600);// Used to initialize Serial Communication
a = Serial.read();
}
void loop()
{
a = Serial.read();
if (( ( a ) == ('F') ))
{
digitalWrite(8,HIGH);
}
if (( ( a ) == ('B') ))
{
digitalWrite(9,HIGH);
}
if (( ( a ) == ('L') ))
{
digitalWrite(10,HIGH);
}
if (( ( a ) == ('R') ))
{
digitalWrite(11,HIGH);
}
if (( ( a ) == ('S') ))
{
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
}
Explanation of the code
char a = ' ' ; This command above setup is used to define a character variable name a
In the entire code it is written that if a == 'S'; This means if the value of a is S then something should happen according to what you want to code.
In the Software that we are using there is a value given to every button, so while programming the basic logic we'll use is that if the variable that we are using is equal to the value of button then something should happen according to the code(like LED should blink).
Values of each button
Forward - F
Back - B
Left - L
Right - R
Forward Left - G
Forward Right - I
BACK LEFT - H
BACK RIGHT - J
STOP - S
Front Lights ON - W(upper case)
Front Lights Off - w(lower case)
Back Lights ON - U(upper case)
Back Lights Off - u(lower case)
Horn On - V(upper case)
Horn Off - v(lower case)
Extra On - X(upper case)
Extra off - x(lower case)
Speed 0 - 0(zero)
Speed 10 - 1
Speed 20 - 2
Speed 30 - 3
Speed 40 - 4
Speed 50 - 5
Speed 60 - 6
Speed 70 - 7
Speed 80 - 8
Speed 90 - 9
Speed 100 - q
Stop All - D
No comments:
Post a Comment