Karkhana Makerspace
4 min readDec 3, 2018

HOW TO ENABLE AND USE AT COMMANDS OF HC-05 USING ARDUINO

HC-05 is a Bluetooth module that is the easiest and economical way to go wireless(BLUETOOTH), working on a particular project.

What if we could possibly change the default settings of HC-05 of our own wish?

And yes, it is possible certainly!!

This post walks you through the AT commands of a Bluetooth module. Through AT Commands, you can change the ROLE (i.e. MASTER/SLAVE) of the module, NAME, PASSWORD, ETC. So, the HC-05 Bluetooth module basically has two work modes-

(i)Automatic Connection work mode and

(ii)Order-Responsive work mode.

When the module is at the Automatic Connection work mode, it will follow the default settings that were set lastly to transmit the data automatically without any changes. When the module is at the Order-Response work mode, the user can send the AT command to the module to set the control parameters and sent control order.

SETTING UP THE MODULE TO GET THROUGH THE AT MODE-

COMPONENTS REQUIRED

1. Arduino Uno

2. HC-05 Bluetooth module

3. Jumper Wires

Components

CONNECTIONS

The HC-05 comes with 6 pins in total. Out of which we would use 5.(i)KEY(ii)RX (iii)TX (iv)VCC (v)GND

(i)The KEY pin of the HC-05 should be connected to 3.3v supply of the Arduino so as to provide a voltage to the reset switch of the module.

(ii)RX pin must be connected to the RX pin of the Arduino itself i.e. PIN no 0

(iii)TX pin should be connected to the TX pin of the Arduino.

REMEMBER- Not to alter the RX pin to the TX pin or vice versa. The pins are altered only when DATA needs to be transferred from the Arduino to some externally connected device, but here, no device is interfaced with the Arduino other than the HC-05 and hence, the RX and TX pins shouldn’t be altered.

(iv)VCC of the HC-05 should be connected to 5V supply from the Arduino board to power on the Bluetooth module.

(v)Finally, the GND is connected.

Henceforth, the power to Arduino can be provided.

But, beforehand, the Arduino needs to bypass the boot-loader function of Atmega328. For this connect the Arduino to PC & just upload an empty sketch

— — — — — — — — –

void setup()

{

}

void loop()

{

}

— — — — — — — — –

This enables the Arduino board to function just as a medium by overpassing the boot-loader for the HC-05.

TURNING ON AT MODE ON HC-05 MODULE

Once the connections are done, when power to Arduino is about to be given, the KEY pin’s jumper wire should be removed and then the power is provided to the Arduino. At that very time, the switch on the HC-05 must be kept pressed while connecting the wire back to 3.3V of Arduino. This enables the HC-05 to go through the Order Responsive Work mode where AT commands are read and default settings are modified accordingly.

The Status LED starts blinking slowly (once per 2 secs). This indicates that the module has entered the command mode at the BAUD RATE 38400.

Serial Monitor of the Arduino can be used to feed AT commands to the module.

At the bottom of the SERIAL monitor ensure that “Both NL & CR” is selected. This will feed /r/n after each command. Generally, while using Arduino, the println() statement(), appends both carriage return and newline .

HC 05 module needs a CARRIAGE RETURN & LINE FEED after each command .

Now open the Serial monitor of Arduino with settings BOTH NL & CR, Baud Rate 38400

Type in AT & click on Send.

You should get an OK response from the module.

AT COMMANDS

Underneath are some AT commands for reference —

LOOK BACK!!

Quite a few times many AT commands do not respond to the commands that are fed in by us. That is due to the MODE of the HC-05 module.

As the module has 2 modes Partial AT mode and Full AT mode.

Some of the commands of AT are not functional in Partial AT mode, but some commands do run well and return the resulting parameters that they are commanded to.

Now, to run of the rest AT commands that do not run on Partial AT mode, firstly repeat the same step as above. The only change to switch the module from Partial to Full AT mode is the switch that was released when the wire was connected to the 3.3V, now for switching it to Full AT mode, the switch must not be left unpressed, and wire should be connected now without letting the switch go. At last, the module now is in its Full AT mode. Without leaving the switch, now send the AT commands, that were not executing in Partial AT mode.

Author: Aman Rishav

Karkhana Makerspace
Visit now : karkhana.club

Karkhana Makerspace

We are a bunch of tech enthusiast who loves to make things and figure out creative hacks from other stuffs.