Menu Close

Configure Bluetooth Module HC-05 with AT Mode

This tutorial explains how to configure the HC-05 Bluetooth Module with AT Commands. 

1. Introduction:

A widely available bluetooth module HC-05 has capability to enable your project with bluetooth. 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 and the device name.

It has got one LED, Which shows its state. If it is blinking that means it is not connected. If it is staying in glowing condition that means it is connected. There is a pin STATE that is connected to this state LED. You may use this pin in your project to determine the state of BT module. This module look like this –

A widely available bluetooth module HC-05 has capability to enable your project with bluetooth. 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 and the device name.

It has got one LED, Which shows its state. If it is blinking that means it is not connected. If it is staying in glowing condition that means it is connected. There is a pin STATE that is connected to this state LED. You may use this pin in your project to determine the state of BT module. This module look like this –

S.No.ItemQuantity
1Arduino 1
2Bluetooth Module HC-05 1
3Male to Female Jumper Wires 4

3. Building Circuit

Before making the connection make sure to unplug the power source from Arduino UNO. Make following circuit with the help of above mentioned components

4. Configure with AT Mode:

After the connection, If you Plug the power source, you will see the HC-05 power on with short rapid blink, which is standard pairing mode of module.

For At Mode, you need to plug the power source while holding down the reset button on the module. The long slow blinks shows that we are in AT Command mode.

 5. Programming:

After configured this in AT Mode, upload the following code:

You may download this code (Arduino Sketch) from here.

//RoboIndia Code for HC-05 with AT Mode
//https://www.roboindia.com/tutorials

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(5, 6); // RX | TX

void setup()
{
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);       // HC-05 default speed in AT command more
}

void loop()
{
  if (BTSerial.available())    // read from HC-05 and send to Arduino Serial Monitor
  Serial.write(BTSerial.read());

  if (Serial.available())     // Keep reading from Arduino Serial Monitor and send to HC-05
  BTSerial.write(Serial.read());
}

6. Changing Codes:

You will find a full set of AT commands from here.

Open the serial monitor. Be sure that the baud rate are set to 9600 and Both NL & CR are selected.

If you send AT from serial monitor, OK will appear on the screen. Now you can change the name or password of the module, check address, version

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

3 Comments

Leave a Reply