Tutorial Control LED Menggunakan Bluetooth(HC-05) Dengan Arduino dan Android
www.tutorbagus10.blogspot.com - Tutorial Control LED Menggunakan Bluetooth(HC-05) Dengan Arduino | Tutorial kali ini tentang control LED menggunakan modul HC-05.
Modul HC-05 adalah modul komunikasi wireless yang banyak digunakan saat ini. Modul HC-05 ini menggunakan frekuensi 2.4Ghz. Pada tutorial ini menggunakan modul HC-05 ini sebagai alat komunikasi antara user dan Arduino serta 3 LED yang berfungsi sebagai output.
Spesifikasi Modul Bluetooth HC-05
- Bluetooth protocal: Bluetooth Specification v2.0+EDR
- Frequency: 2.4GHz ISM band
- Modulation: GFSK(Gaussian Frequency Shift Keying)
- Emission power: ?4dBm, Class 2
- Sensitivity: ?-84dBm at 0.1% BER
- Speed: Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps
- Security: Authentication and encryption
- Profiles: Bluetooth serial port
- Power supply: +3.3VDC 50mA
- Working temperature: -20 ~ +75 Centigrade
- Dimension: 3.57cm x 1.52cm
Alat dan Bahan
- Arduino Uno
- Modul Bluetooth HC-05
- Kabel Jumper secukupnya
- Led 3 Buah
- Resistor 220 Ohm 2 Buah
- Protoboard
- Resistor 1K Ohm (optional)
- Resistor 2K2 Ohm (optional)
- Aplikasi Android, Bisa download disini
Rangkaian

Listing Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
SoftwareSerial BT(10,11); | |
int led1 = 2; | |
int led2 = 3; | |
int led3 = 4; | |
String perintah; | |
void setup() { | |
// put your setup code here, to run once: | |
BT.begin(9600); | |
Serial.begin(9600); | |
pinMode(led1, OUTPUT); | |
pinMode(led2, OUTPUT); | |
pinMode(led3, OUTPUT); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
while (BT.available()) | |
{ | |
delay(10); | |
char c = BT.read(); | |
perintah += c; | |
} | |
if(perintah.length() > 0) | |
{ | |
Serial.println(perintah); | |
if (perintah == "hidupled1"){ | |
digitalWrite(led1, HIGH); | |
} | |
else if (perintah == "hidupled2"){ | |
digitalWrite(led1, LOW); | |
} | |
else if (perintah == "hidupled2"){ | |
digitalWrite(led2, HIGH); | |
} | |
else if (perintah == "matiled2"){ | |
digitalWrite(led2, LOW); | |
} | |
else if (perintah == "hidupled3"){ | |
digitalWrite(led3, HIGH); | |
} | |
else if (perintah == "matiled3"){ | |
digitalWrite(led3, LOW); | |
} | |
perintah=""; | |
} | |
} | |
Note :
Jika masih gagal dalam percobaan coba tambah resistor 2k2 dan 1k pada pin rx HC-05 sehinggan menjadi seperti dibawah ini

Jika ingin membuat program Androidnya silahkan ikuti tutorialnya disini
Post a Comment