Wednesday 7 September 2016

Modify The HC-05 Bluetooth Module Defaults Using AT Commands

 http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/?ALLSTEPS

Heed the warning here. Although it may work, it is not advisable to connect directly the 5V Arduino to the 3.3V module. Use the simple voltage divider. To be even safer, disable the pullup resistors in the default Arduino library.

Modify The HC-05 Bluetooth Module Defaults Using AT Commands

by in technologyarduino
Picture of Modify The HC-05 Bluetooth Module Defaults Using AT Commands
UPDATES
September 4, 2013: Featured on Hackaday.com http://goo.gl/qxvWkd
September 1, 2013: Featured on DangerousPrototypes.com http://goo.gl/K4kH9g

INTRODUCTION

In this guide, I will explain how to use Arduino to change the settings of the ubiquitous HC-05 Bluetooth module using the AT command set. The HC-05 comes with a rich set of AT commands to perform various tasks such as changing the module's default settings including changing the pass code, the device name, and the baud rate. But the process of switching the HC-05 into AT command mode for first time users of the module is not straight forward and the docs takes short cuts. There are a couple of ways to do this. I have picked the one I think is the easiest  I will do my best to illustrate the process in simple to follow steps. You can find the full set of AT commands in the attached datasheet.


BACKGROUND

The HC-05 Bluetooth module and its siblings are by far the most popular and inexpensive Bluetooth modules used for RF communications by microcontroller hackers. It costs less than MYR 40.57 ( MYR 40.57 ( $10)) on ebay and it's easy to implement. I have published two guides based on the HC-05 Bluetooth module.  The first guide explains how to use the HC-05 with the Arduino. The second is an Android app that simplifies controlling Arduino from your smart phone over Bluetooth using the HC-05. In both cases, the default settings for the HC-05 were fine.

In the process of using the HC-05 for a project, I ran into a situation where I needed to change the defaults for the module. For example, the default baud rate on the HC-05 is 9600. That's slow for high-speed transmission. The HC-05 can go as high as 1382400 baud rate according to the HC-05 reference. Also, the HC-05 has a default device name of HC-05. Having two or more of those devices in the same area can be confusing. You can use an AT command to change the device name. Also, the pin code default is 1234. You may wish to change that for some projects to ensure basic security.

After spending some time searching the web I realized many people are having a hard time changing the default settings for the HC-05. Switching the HC-05 from data transmission mode to configuration mode, to send AT commands to the HC-05, involves a few wiring and software acrobatics.  Add to the mix all the variations of the HC Bluetooth module family and the various vendor settings and you get the picture.

This guide only covers the HC-05 module with the breakout board.

WARNING

The HC-05 is a 3.3V system but the breakout board offers current limiting resistors for some protection. While it's not advisable to keep the HC-05 connected to the 5V Arduino Uno pins, for this short exercise I decided to skip the voltage dividers which I use to drop 5V to 3.3V. I advise you to use voltage dividers whenever you connect the HC-05 pins to  5V pins such as the Arduino Uno. If you skip the voltage divider, do so at your own risk.

Step 1: Components & Wiring

Picture of Components & Wiring
HC-05-bluetooth-(3).jpg
I have tested this guide with the following:

PARTS
WIRING
  • HC-05 GND --- Arduino GND Pin
  • HC-05 VCC (5V) --- Arduino 5V
  • HC-05 TX --- Arduino Pin 10 (soft RX)
  • HC-05 RX --- Arduino Pin11 (soft TX)
  • HC-05 Key (PIN 34) --- Arduino Pin 9

Advertisement

Step 2: The Arduino Code for HC-05 Command Mode

Picture of The Arduino Code for HC-05 Command Mode
This Arduino program (HC_05.ino) does two things. It takes the AT commands you enter from the Arduino IDE Serial Monitor and sends those commands to the HC-05. The program then reads the output of the HC-05 and displays it on the Arduino IDE Serial Monitor. You can also use a terminal emulator such as Tera Term instead of the Arduino Serial Monitor.

The Arduino communicates with the HC-05 using the SoftwareSerial ports while the Arduino communicates with the user via the Serial Monitor.


/*

AUTHOR: Hazim Bitar (techbitar)
DATE: Aug 29, 2013
LICENSE: Public domain (use at your own risk)
CONTACT: techbitar at gmail dot com (techbitar.com)

*/


#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

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());
}

Step 3: Steps To Switch The HC-05 Into Command Mode

Picture of Steps To Switch The HC-05 Into Command Mode
For the HC-05 module to switch to AT command mode, the HC-05 pin 34 (often referred to as the Key pin) needs to pulled HIGH but in a certain order of events explained below. When the HC-05 enters the AT command mode, it will communicate at 38400 baud rate. Follow these steps in the stated order to switch to the HC-05 to AT command mode.

  1. Wire the HC-05 and Arduino Uno per instructions.
  2. BEFORE YOU CONNECT THE ARDUINO TO THE USB remove the VCC (power) red wire from the HC-05 so it's not getting any power from the Arduino. All other wires are still connected.
  3. Now connect the Arduino Uno to the USB cable extended from your PC.
  4. Make sure the HC-05 module is NOT PAIRED with any other Bluetooth device.
  5. Re-connect the Arduino Uno 5V wire to the HC-05's VCC (5V power) pin.
  6. The HC-05 LED will blink on and off at about 2 second intervals. Now the HC-05 is in AT command mode ready to accept commands to change configuration and settings.
  7. To test if everything is wired correctly,  open the Serial Monitor from the Arduino IDE and type "AT" and click SEND. You should see an "OK"
  8. If you don't see an "OK" check your wiring.

Step 4: Example HC-05 AT Commands

You can send  AT Commands to the HC-05 from the Arduino IDE Serial Monitor while the Arduino is running the attached Arduino program.

I have listed a few popular AT commands that will change the HC-05 device name, pass code, and speed. You will find a full set of AT commands from the attached HC-05 reference PDF file.

(remove double quotes from AT command)
  • To return HC-05 to mfg. default settings: "AT+ORGL"
  • To get version of your HC-05 enter: "AT+VERSION?"
  • To change device name from the default HC-05 to let's say MYBLUE enter: "AT+NAME=MYBLUE"
  • To change default security code from 1234 to 2987 enter: "AT+PSWD=2987"
  • To change HC-05 baud rate from default 9600 to 115200, 1 stop bit, 0 parity enter: "AT+UART=115200,1,0"

Post a comment
Be nice! We have a be nice comment policy.
Please be positive and constructive.
a month ago
Hi, instead of your pinout I have:
state, rxd, txd, gnd, vcc, en
Is the "en" pin seme as "key" pin? The "state" and "en" pins haven't got pins to connect to breadboard (there are only 4 pins, but other 2 are marked amd seem like they're ready to be soldered to pins, they have holes).
Sorry for my english and thanks for answer!
22 days ago
u got output using that bluetooth module ?
12 days ago
when connected tx-rx,rx-tx,gnd-gnd,vcc-5v, starts blinking. when trying to connect, ligts without blinking. But phone says something like couldn´t connect and bluetooth starts blinking again.
16 days ago
Hi, I'm working with the arduino Due and SoftwareSerial doesn't work. I'm not that great with the coding, so could you help me out?
7 months ago
I connected hc05 module with arduino uno board with connections as-
G
HC-05 GND --- Arduino GND Pin
HC-05 VCC (5V) --- Arduino 5V
HC-05 TX --- Arduino Pin 10 (soft RX)
HC-05 RX --- Arduino Pin11 (soft TX)
HC-05 Key (PIN 34) --- Arduino Pin 9
After connecting i m getting rapid blinking of led on hc 05 module but unable to connect with any app on ios neither AT command is getting any response on serial port.
Suggest how to connect hc05 with arduino uno and how to use it on ios mobile app
7 months ago
If it has a small button above the EN/KEY/WAKE UP pin, disconnected Vcc, press and hold that button, connect Vcc and it the LED in the module should blink slowly and allow you to enter AT codes.
Regards,
17 days ago
This worked for me too. Also, after getting the LED to blink slowly, press the Reset button on the Arduino. Exact steps that seem to always work:
1. Unplug power from HC-05
2. Upload sketch from this Instructable
3. Hold in HC-05 button
4. Reconnect power to HC-05 (wait until LED blinks slowly)
5. Press Arduino reset button
6. Open Serial Monitor
7. Make sure "Both NL & CR" is selected
8. Type AT commands
We had 3 people in a workshop this evening and when everyone followed this procedure it always worked.
6 months ago
that worked perfectly
thanks
6 months ago
pin 34 cannot be connected directly to Arduino PIN 9, use level converter from 5 volts to 3.3 and vice versa or simply use two 1 K ohm resistors between PIN 9 and VSS and connect pin 34 inbetween
5 months ago
Instead of getting an OK after typing AT in the serial monitor, I am getting the following output. Please someone tell me the reason
a month ago
that my be due to mismatch of buad rate
4 months ago
//Correction :
#include<SoftwareSerial.h>
SoftwareSerial BTSerial(10,11);
String HC05_Responce="";
void setup(){
pinMode(9,OUTPUT);
digitalWrite(9,HIGH);
Serial.begin(9600);
Serial.println("Enter AT command:");
BTSerial.begin(38400);
}
void loop(){
if(BTSerial.available())
Serial.write(BTSerial.read());
if(Serial.available())
BTSerial.write(Serial.read());
}
5 months ago
HELLO KJOHARI21
Instead of no line ending drop the menu down and select "Both NL & CR"
and try again.
cheers ;)
5 months ago
HiKjohari21, il think you have to select "both line feed and carriage return" in the serial monitor and it will work.
Regards.
2 months ago
If there is anyone still struggling out there, I made another instructable detailing how to use this modules in master, and slave mode. It is meant to explain how to get each model into AT mode, and then, to get them working with code.
http://www.instructables.com/id/Arduino-Bluetooth-Master-and-Slave-Using-Any-HC-05/
3 months ago
Hello to everyone.I have make a bleutooth robot which i can control it via android(tablet) and i have a problem with the code.I want from the robot to stop when connection lost or bluetooth disconnected.Now when the connection lost the robot go ahead and falls on the objects.How to add this line on the code?Can you help me please?The STATE pin of HC-05 when is HIGH is connected and when is LOW is disconnected.I put this on my code but it doesn't stop.Thank you for your time

The bluetooth that i use is HC-05

My code:

#include <Servo.h>

Servo SERVO_1; // Initialize Servo1

// Motor Control Variables
int PWM1 = 9;
int ENABLE1 = 8;
int PWM2 = 5;
int ENABLE2 = 7;
int PWM3 = 3;
int ENABLE3 = 4;
int PWM4 = 6;
int ENABLE4 = 12;
int STATE=2;


void setup() {
SERVO_1.attach(10);
Serial.begin(9600);
pinMode(ENABLE1, OUTPUT); //Δήλωση όλων των μεταβλητών ως έξοδος
pinMode(ENABLE2, OUTPUT); //Δήλωση όλων των μεταβλητών ως έξοδος
pinMode(ENABLE3, OUTPUT); //Δήλωση όλων των μεταβλητών ως έξοδος
pinMode(ENABLE4, OUTPUT); //Δήλωση όλων των μεταβλητών ως έξοδος
pinMode(STATE, INPUT);
}

void loop() {

if(digitalRead(STATE)== HIGH)

// see if there's incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
int incomingByte = Serial.read();
// action depending on the instruction
// as well as sending a confirmation back to the app
switch (incomingByte) {
case 'F':
moveForward();
Serial.println("Going forward");
break;
case 'L' : // Case 'L' is received,
SERVO_1.write (180); // Στρίψε Αριστερά.
SERVO_1.attach(10);
break;
case 'N':
turnright();
Serial.println("Turning right");
break;
case 'M':
turnleft();
Serial.println("Turning left");
break;
case 'O' : // Case 'L' is received,
SERVO_1.write (0); // Στρίψε Αριστερά.
SERVO_1.attach(10);
break;
case 'B':
moveBackward();
Serial.println("Going forward");
break;
case 'P':
SERVO_1.write(90); // Στρίψε Αριστερά.
SERVO_1.attach(10);
break;
case 'S':
moveNone();
Serial.println("Stopping");
break;
default:
// if nothing matches, do nothing
break;
}
}
}

void moveForward() {
// turn the driving motor on to go forwards at set speed
digitalWrite(ENABLE1, HIGH);
digitalWrite(ENABLE2, HIGH);
digitalWrite(ENABLE3, HIGH);
digitalWrite(ENABLE4, HIGH);
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
analogWrite(PWM3, 255);
analogWrite(PWM4, 255);

}

void moveBackward() {
// turn the driving motor on to go backwards at set speed
digitalWrite(ENABLE1, LOW);
digitalWrite(ENABLE2, LOW);
digitalWrite(ENABLE3, LOW);
digitalWrite(ENABLE4, LOW);
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
analogWrite(PWM3, 255);
analogWrite(PWM4, 255);
}
void turnright() {
digitalWrite(ENABLE1, HIGH);
digitalWrite(ENABLE2, HIGH);
digitalWrite(ENABLE3, LOW);
digitalWrite(ENABLE4, LOW);
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
analogWrite(PWM3, 255);
analogWrite(PWM4, 255);
}

void turnleft() {
digitalWrite(ENABLE1, LOW);
digitalWrite(ENABLE2, LOW);
digitalWrite(ENABLE3, HIGH);
digitalWrite(ENABLE4, HIGH);
analogWrite(PWM1, 255);
analogWrite(PWM2, 255);
analogWrite(PWM3, 255);
analogWrite(PWM4, 255);
}
void moveNone() {
// turn the driving motor off
digitalWrite(ENABLE1, 0);
digitalWrite(ENABLE2, 0);
digitalWrite(ENABLE3, 0);
digitalWrite(ENABLE4, 0);
analogWrite(PWM1, 0);
analogWrite(PWM2, 0);
analogWrite(PWM3, 0);
analogWrite(PWM4, 0);
SERVO_1.detach();
}
KatV1 made it!
3 months ago
Thanks a lot!
4 months ago
I'm encountering a problem :
I've plug my HC-05 through arduino uno, on the serial monitor it say "ready for AT commands".
Then i wrote "AT" in the monitor but no OK answer
What Should I do ??
Thanks
4 months ago
IM HAVING THE SAME PROBLEM
4 months ago
i want to connect HC 05 with RX65N (100 pin). i made pin 34 high HC 05 entering in command mode but it is not responding back
which register has to be connected between vcc and pin34
5 months ago
My HC-05 is already blinking slowly (every 2s), but when I send 'AT' from serial monitor, I get nothing. I use the same code in this instructable. Someone, please help me.
JohnC34 made it!
5 months ago
An enjoyable come across by chance on Youtube so later on in the day I worked through most of the instructable.
5 months ago
What should I do if I receive some unreadable character
Plzz reply
6 months ago
hi I just have to get data from the pin 7 of Arduino do I need to configure the hc05 ?
plzz help me the coding too
6 months ago
do i have to change the default AT setting on bluetooth to make it work with my android
6 months ago
hi there
can we connect more than 4 hc-05 in slave and one hc-05 module in master
6 months ago
Hi, thank you for this instractable...
I am very glad to explore HC05 Bluetooth.
my HC05 module doesn't have a connection to the KEY pin instead I have an ENABLE pin and a small tactile switch that is not connected to any pin.
so; I took a wire from pin 34 and put it in-between two serially connected 1 K Ohm resistors between PIN 9 " Arduino" and VSS.
put 3 new lines in the Arduino sketch and my sketch is as follow:
///////////////
#include "SoftwareSerial.h"
SoftwareSerial BTSerial(10, 11);
void setup() {
pinMode(8, OUTPUT); digitalWrite(8, LOW);
// connected to the VCC of the Bluetooth module

pinMode(9, OUTPUT); digitalWrite(9, HIGH);

Serial.begin(9600);

delay(1000);

Serial.println("Enter AT command mode");
digitalWrite(8, HIGH);
BTSerial.begin(38400);
}
void loop() {
if (BTSerial.available()) Serial.write(BTSerial.read());
if (Serial.available()) BTSerial.write(Serial.read());
}
/////////////////
I have one idea for this instractable; that is not to play with the wire manually; instead let Arduino do the connection for you...
and this work very well every time i upload a new sketch
7 months ago
can anyone please tell me how can i change data rate in Hc-05?
and how to change the class of device? what will happen if i change the class? whether it would affect the data rate or something?
7 months ago
AT+CLASS=<Param>
a year ago
can u please tell me how to change my pin or password for my hc-05??
7 months ago
To show your password do AT+ PSWD?
And to have it changed do AT+PSWD=<Param>
Regards,
7 months ago
To show your password do AT+ PSWD?
And to have it changed do AT+PSWD=<Param>
Regards,
7 months ago
To show your password do AT+ PSWD?
And to have it changed do AT+PSWD=<Param>
Regards,
7 months ago
To show your password do AT+ PSWD?
And to have it changed do AT+PSWD=<Param>
Regards,
7 months ago
Connect Hc-05 to the Serial Monitor. then Convert the HC-05 into AT command mode. then type AT+PSWD? then press enter button(\r\n). it will reply PSWD="XXXX", then Put AT+PSWD=password. then password will set as a password.
8 months ago
Once it is in full AT mode send "AT+PSWD=0000" (without quotes) and don't forget to be sending the Newline and Carriage return characters after each command...
7 months ago
hi, if u having trouble in making into AT mode of HC-05 (ZS-040)(especiall if one having en/wakeup up pin instead of key pin). Follow they bellow procedure
Power off HC-05 module.
Press and hold small button above EN pin.
Power on and keep pressing small button.
Small LED should start to blink slowly about once every 2 seconds.
for more info visit below site:
http://abratukhin.blogspot.in/2015/04/connect-atmega328-with-hc-05-zs-040.html
7 months ago
Hi, what should I do if I don't have a button above the EN pin?
7 months ago
hi, if u having trouble in making into AT mode of HC-05 (ZS-040)(especiall if one having en/wakeup up pin instead of key pin). Follow they bellow procedure
Power off HC-05 module.
Press and hold small button above EN pin.
Power on and keep pressing small button.
Small LED should start to blink slowly about once every 2 seconds.
for more info visit below site:
http://abratukhin.blogspot.in/2015/04/connect-atmega328-with-hc-05-zs-040.html
a year ago
I have followed this tutorial and others on the internet and am getting the board into AT mode and my board is responding however it is responding in absolute gibberish for example I type AT with both NL & CR on and a baud rate of 9600 on the serial monitor and I get result of ϧ†…ÿ or some other variation of the same code I have tried and tested playing around with different baud rates I have several different hc-05 they all give me the same I have connected the RX, TX in the schematic the way it is labelled and reversed and I am still getting no luck can anyone give me some helpful information I don't have ausb ttl converter and would prefer not to wait for one, any help would be appreciated.
Thanks in advance, Chris.
8 months ago
Hi, the fix for this is to put the module into AT mode with the user-defined baud rate, which by default is 9600. To do this, pull pin 34 high AFTER power-up instead of before. You won't have any indication of the mode change, i.e the led will continue blinking quickly whereas in the 38400 baud AT mode the led starts blinking slowly, on 2s, off 2s. I have posted an answer with code + additional info at http://forum.arduino.cc/index.php?topic=302827.msg2561221#msg2561221
8 months ago
Thank you for the link. After reading some of the suggestions I was able to get my HC-05 into AT mode just by holding the button while powering on. The LED went to the long blink and all AT commands functioned properly.
a year ago
I am getting the same thing. Instead of the "OK" response I get "ϧ†…" plus two unprintable characters. Sending commands seems to work but I never really know since I don't get an understandable response.
9 months ago
i had try it but in serial monitor shows like xxxxxxx€ø.
also i had change all baud rates nothing happens.. im using hc-05
9 months ago
hi there, i paired up 2 hc05 master "1" and slave "0" doing this
AT commands
//SLAVE = 98d3:31:2093cb AT+ROLE=0
//MASTER= 98d3:32:204d2a AT+ROLE=1
//AT+BIND=98d3,31,2093cb
//AT+BIND=98d3,32,204d2a
The end im left with paired modules that can talk to one another now i set this in AT+UART=9600.0.0 or 38400,0,0 im not sure now but it worked out fine now in the sketch i was doing all this in terminal obvsly using the terminal baud rate which was
as follow
include SoftwareSerial.h
SoftwareSerial mySerial(10, 11); RX, TX
void setup
{ Serial.begin(38400);
pinMode(9, OUTPUT);
digitalWrite(9, HIGH);
Serial.println("Enter AT commands:");
mySerial.begin(38400);
}
so my problem is that when i try to take the 2 talking modules to use in another project im not sure but they dont communicate no more "after uploading new sketch" am i suppose to use the same baud rate as in the sketch (38400); or should i be using the baud that i set this 2 up to begin with when i did the whole AT+UART=9600.0.0 or 38400,0,0 ???
i was assuming what i have now when they were talking was a wireless RS232/terminal right? if so then all i have to do is make sure in the loop of what ever other program i go to use this modules on that they talk to that SoftwareSerial mySerial or something like this
void loop()
{
if (mySerial.available())
mySerial.write("Variable or Array here");
10 months ago
didnt had success with this setup. Seems like I couldnt work out the right combination of baud rate and return characters (which are 38400 and cr+lf for my cz-hc-05). However, I hooked up the hc-05 directly to my usb ftdi dongle and it worked perfectly with a random serial terminal program. (had a 3.3 voltage regulator for the key pin but dont know if thats necessary).
2 years ago
Dear Hazim, thank you for this very useful application. I have an EN pin instead of KEY pin on my HC05 and it does not seem to be connected to PIO11 (Pin34) (I have checked it with an AVO. Do you think short circuiting the EN pin with Pin34 will solve the problem?
My second question is, how can I pair the HC05 connected to an Arduino uno with an HC06 connected to an ATTiny 85?
Cheers.
2 years ago
Dear friend,
In my Hc-05 have tiny push button to put AT mode.
what i doing to put configure mode
1) disconnect power pin.
2) press the tiny push button
3) same time connect the power.
Done.
10 months ago
:D I always wonder about that button
LordL duwageM a year ago
Thanks. This was very helpful. Have been trying and suspected that the pushbutton had something to do with it.
daniel.kral.37 sühab 2 years ago
EN pin should be the same as KEY pin. The default baud rate in AT command mode is different for different devices. My HC05 had it set at 9600. Try setting different baud rate and see if that solves the problem.
asadsalehhayat sühab 2 years ago
Same problem. Do you got the solution???
Having same problem. Did u get any solution..?
Pratt_ 10 months ago
My hc-05 module responds to all AT commands & also connects to my android device but doesnt respond to commands.
Please help me to solve this issue
Thank you
B33_L33 a year ago
Hello!
Everybody who is not able to get into AT-mode with this Tutorial should check if they have a HC-05 (ZS-040) Bluetooth Module. If so, check out Martyn Currey's tutorial: http://www.martyncurrey.com/arduino-with-hc-05-blu... With this tutorial I was finally able to access AT-mode :-D.
GerardoH4 B33_L33 11 months ago
Thanks, Martyn Currey's tutorial worked just fine for me.
KodomoY 11 months ago
According to the AT-cmd spec
Param2:stop bit:
0----1 bit
1----2 bits

  • To change HC-05 baud rate from default 9600 to 115200, 1 stop bit, 0 parity enter: "AT+UART=115200,1,0"

    should enter AT+UART=115200,0,0
BallscrewBob a year ago
If the HC05 is 3.3V could I just not use the 3.3V supply from the arduino itself ?
bharat24 a year ago
In my Bluetooth module it has wake up pin instead of key pin what to do plzz solve
TheKoobay. made it! bharat24 a year ago
hi, you can my older post
Wakeup pin is a pin that works for you configure the AT-Command setting, the previous post I already give an example and program.
[ HC-05 ] ___________ [ ARDUINO ]
vcc ------------------------- pin7(Arduino)
gnd ------------------------ gnd (Arduino)
txd ------------------------- pinA0 (Arduino)
rxd ------------------------- pinA1 (Arduino)
wakeup/ en/ key ------ pin8 (Arduino)
gnuarm a year ago
I tried using an HC-05 module with Putty on my windows 8 PC. When I
hit enter on a command I get the response I expect, but it repeats
indefinitely until I hit another key. I switched to Terraterm and that
program doesn't have the same problem. Any idea what is going on? I can
use Teraterm for the time being, but I'd like to know what is up with
Putty so I can trust it for other projects.
gnuarm gnuarm a year ago
I switched to another terminal program, Terraterm and it worked better. But when I try to talk to it from a Raspberry Pi using the same USB dongle it doesn't work at all. I find this very frustrating. Sometimes it works, sometimes it doesn't and the way it fails to work is very different. I've tried two different modules which give the same results.
Ultimately I want to control this device from a small, MCU eval board. Before I do that I want to be able to control it from my computers using a terminal emulator.
TheKoobay. a year ago
hii,,
Because not all of hc-05 can be configured, I recommend you use the HC-05 as it is drawn.
Follow the instructions and programs,
We are using your circuit connections and a well Arduino code. But the AT commands are not working in 38400 baud rate. And if we upload some other code to Arduino, the HC-05 will not even turn ON. Can you please help me in this....
If you still wasn't able to solve this, there's a button on the Bluetooth module. press that button until it blinks like per 2 seconds and there you have it.
Been solving this for days...
mohamedS15 a year ago
Can I remove pin Check !!
I mean pairing with module but without from fixed address but without entering "1234"
AndrzejK2 a year ago
It doesn't working. My BT module don't want to be in config. mode...
MiloslavN a year ago
To all having strange characters in serial monitor:
As I read in the comments, it happens on linux only (also using linux) but with newest arduino ide (1.6.1) this problem dissapeared.
GeroS1 MiloslavN a year ago
Thanks a lot. Your post helped me resolve the issue I was facing. Finally clear text in the terminal.
Thanks bro!
I donwload arduino IDE 1.6.1 and re-upload the code and its works!!
hi All! i'm using FB155BC as the bluetooth module. i had a response "OK" by typing AT but i got "ERROR" by typing AT+BTRSSI? .
i use Arduino 1.0.6.
could somebody help me?
thanks
Whether you go through the tutorial above?
Can you please tell me in advance when your configuration details, because this is related to the program and the bluetooth module. In order to find an appropriate answer

Explain to when you before entering the AT-command?
TheKoobay. TheKoobay. a year ago
Orang Indonesia,
Hi TheKoobay,
orang indonesia?
yes i am!
so it did works with my configuration. i'm using hyperterminal instead of Serial Monitor in Arduino. Finally i got the AT+BTRSSI value in slave mode, but not in master mode. In master mode (FB155BC), i can't connect it with my smartphone.
So know i'm working on it.
Regards
Smartphones can not connect, if HC-05 be set as "master" !!!
Try to change the HC-05 as a "slave", now you try to connect with your smarphone.

You can restart the Configuration HC-05 "AT + ORGL" and "AT + RESET"
Greetings Indo, Jakarta
MiloslavN a year ago
To all receiving nothing when typing "AT":
I had the same issue but then I tried to type "AT+RESET" (no response but led started blinking faster) and then I checked SoftwareSerial library documentation and I used wrong pin for Rx on my Leonardo. Pin you use for receiving has to support change interrupts. Check documentation: http://arduino.cc/en/Reference/softwareSerial for more informations.
shankar.makal 2 years ago
Can any one help me, wireless communication between Hc05 ,problem:I am able to send the data till 0.62 voltage equivalent digital is 127. After 0.63 it is -128 ,0.64 it is -126 ,0.65 it is -124 and so on........
StephanT 2 years ago
hello,
is it possible to change Module Bluetooth adress with AT Commands or is there another way to change it?
fcfelix 2 years ago
Hi, very usefull ible.
I have one question. Is it possible to configure the HC-05 through AT commands to be seen as a keyboard/gamepad/mouse? According to the command ref pdf (appendix 2) you posted, there is such functionality. The question is if this would sufice, or a firmare flashing would be needed for it.
fansblink 2 years ago
HC-05 bluetooth why I did not respond to anything when I type AT? please help, I want to change the name and passwordnyaa
Lo Fi Robot fansblink 2 years ago
Hey, this instructable is missing one thing. To communicate Arduino with HC-05 you have to set line ending box in Arduino Serial Monitor to "Both NL and CR"
Hope it helps.
WhizzWr 3 years ago
One IMPORTANT thing, Newline feed (\n) and Carriage return (\r) are needed on every AT command entered. So if you're using Arduino's serial monitor make sure you select "Both NL and CR" on the dropdown.
banajimenez WhizzWr 2 years ago
Thank Youuuu!!!
thekevinshen WhizzWr 2 years ago
WOW! THANK YOU for sharing this! I have been stuck on this tutorial for 3 days now, never being able to display any response in my serial monitor from the HC-05. I even bought another HC-05, thinking that my original was defective. You rock :)
JeffW3 WhizzWr 2 years ago
Thanks for this!
shanX WhizzWr 2 years ago
THANKS!! THAT WAS NEEDED :) :)
prmccafferty 2 years ago
Hello,
I have a CZ-HC-05 Bluetooth module that I've wired to an Arduino UNO Rev3 per the instructions on this website. I have successfully gotten the LED to blink slowly (2 seconds on, 2 seconds off) indicating to me that I'm in AT command mode. However, when I open the serial monitor and type AT I don't get an OK response from the HC-05. I copied and pasted the code from this website into the Arduino IDE so I'm certain it's correct. My serial monitor is set to 9600 to match the serial port baud rate. I also set the serial port to Both NL & CR. I have tried typing AT\n\r as well and still no response from the HC-05. Can anyone help me?
Same Problem, no response, have you got it?
zootalaws prmccafferty 2 years ago
The default rate for the BT module is 38400.
elias47 2 years ago
hello, thanks for everything you done.
my broblem is the HC 05 is not responding after verifying the wiring the code every thing many times, so could you tell me what could be the problem ???
thanks again .
returner 2 years ago
Hi, i have a question and i hope you guys can help me with this. how does the arduino actually know actually know which data it is going to send or receive? in which part of the code does it do that? i want to make two arduinos one having a HC05 as a master sending data over to a HC06 slave on two different laptops. I hope you can answer me.
dnwagner 2 years ago
I've been searching and searching and I have not been able to find your sketch for this tutorial. (PS: Im new to BT and Arduino)...one week ago I thought a "sketch" was just a basic drawing of something...but now it also means Arduino code too. :-)
saggafarsyad 2 years ago
Hello, I'm having a problem. I followed all the instruction and can enter AT command mode. I entered "AT" but it returns like this. The same goes "AT+VERSION?". I try other commands like "AT+NAME=MYBLUE" but HC-05 name doesn't change. What is wrong in this case?
maebelyn.mallanao 2 years ago
I have already configured my HC-05 as a master. I would like to communicate it with an android app where in this app will be used as the slave. I followed the instruction wherein i configured it at master using AT command. I would like to test if I can send data using HC-05 to android app so i run the program with the same code including BTSerial.write("test") at the last if statement hoping this data willl be send to my app, but it fail to do so. What can I do to test it? Thanks
asadsalehhayat 2 years ago
I tried this tutorial with hc-05, with my arduino MEGA R3, but when i sent AT, the monitor didn't show anything. My module has EN instead of KEY. I soldered wire with Pin34 and gave it 5v But still sam problem.
Had the same problem today, look at for nice tutorial.
(keep in mind those options in serial monitor in arduino ide)
http://arduinofy.blogspot.com.au/2013/10/tutorial-...
Also it seems that my module communicates ok both ways while in AT mode, and when in normal mode it only sends data to phone. the data i send from phone gets lost some ware, strange.. same issues anyone?
Hi. You need to finish the command with a terminator : AT /r/n or AT ENTER
For somme reasons , it's not the same on the hc-06 .
nicroche dani.tutoriel 2 years ago
I've chimed in late. Does "finish the command..." deal with the differences needed for HC-06? Are you saying that 6 days asadsalehhayat is using a HC-06 and not a HC-05? Other than the terminator, is dealing with a HC-06 the same as a HC-05? Thanks...
asadsalehhayat nicroche 2 years ago
I'm using an HC05

1 comment:

  1. If it doesnt work for you or you get nothing after sending AT commands in the serial monitor, make sure you are using the correct pins for your arduino board. I noticed that not all can receive data. I have an Arduino mega and am using pins 50,51 for RX , TX and 52 for the HC-05 pin 34 (key) to pull it high

    ReplyDelete