How to connect Arduino to Bluetooth HC-05 module:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4UqffOpScW11ssH92LtSuJMXOxoZEiVP91ByS1tpLz8xrWhP6kjiKOCMdiKIYxdd-qsx7FnKaLnD3g53FDcHUPOfEEChEyUHl59qskxIuomf57NSKs3EgyF_2P42XYT-WDlp_oiKjNKrV/s1600/ArduinoNanoFront_3_sm.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDrZWMOVeQW_mC3xXoInPumfH_SvsVRLXkv8aQd258hdOaTRl838RvQbZ7I_i9vVqOo445eFZEEDjoQ41_oym8AnR19SxXfzeBv59L6GgV2NwxpFoMlNyGqu1Dhk9q_m3IcOpqE_HFvf-1/s1600/mpEJ5_4d4UVGrFoLVe0MFqA.jpg)
HC-05 is not visible for Android by default - because of "secure device class" of "1f00"
AT+CLASS? 1f00
We will set the Class to "1":
AT+CLASS=1
and the Role to "Slave"
AT+ROLE?
AT+ROLE=0
1.1. Connect Arduino to Bluetooth HC-05 according to the layout:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjw7GoZqlk5ilhi0l075oEHzgt6b4d1cPBXCnJ0g_DDTJ3al3ygs_2-GeUXcZ4iMVOBoE9LEbREkApWSS-69Wgb11xXOwr7t8LlYXgLp5K_khztjCIH3lWE8J_rcVGsOnypzV-gHqVB8SU/s1600/arduino_bt_bb.jpg)
1.2. Do not supply the power yet
1.3. Connect the HC-05 "key" pin (1st pin from the left) to Arduino "VCC" pin
1.4. Power On HC-05 (connect Arduino to USB)
1.5.1 Connect on 38400, 8n1
or
1.5.2 Load the Arduino test sketch:
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(5, 4); // RX | TX
void setup()
{
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command more
//38400?
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}
1.7. Open Arduino Serial Monitor (Tools > Serial Monitor) and run the AT commands:
>+NAME:HC-05
Default HC-05 pin is 1234
Let me know if you have any questions.
References:
http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/?ALLSTEPS
http://byron76.blogspot.com/2011/09/hc05-firmware.html
No comments:
Post a Comment