How to Set AT mode for HC-05 Bluetooth module
Hello friends in this post we will see how we can set AT mode for HC-05 Bluetooth module.
So basically AT mode means Attention mode, In AT mode we use AT commands to configure the Bluetooth module. like baud rate, mode, role, password setting pairing setting etc.
Once you change any setting in AT mode it we be there whenever you use that module it will not reset while power off, you need to go again in AT mode to change it.
So let see how we can set AT mode for BT module.
Component require
- Any Arduino board (I am using Arduino Nano)
- HC-05 or HC-06 Bluetooth module
- bread board
- some jumper wires
Wiring diagram to set AT mode for HC-05 Bluetooth module.
So first we will do the wiring as showing in the above circuit diagram.
D10 of Arduino to TX of BT module
D11 of Arduino to RX of BT module
5V of Arduino to 5V of BT module
GND of Arduino to GND of BT module
After completing the wiring time to upload the code to Arduino
Arduino code for HC-05 AT mode
#include <SoftwareSerial.h> //SoftwareSerial BTSerial(5, 6); // RX | TX SoftwareSerial BTSerial(10, 11); // 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()); }
After uploading the code we have to keep pressed the small button at the bottom of HC-05 Bluetooth module while applying power to the module.
So for this what we have done, I removed the USB cable from the Arduino and keep button pressed and re plugging the USB to Arduino and the you will notice the light pattern on BT module change it will continue glow for long time it means we successfully entered in AT mode of HC-05 Bluetooth module.
After Successfully entering in AT mode time to sent AT commands to the BT module
so open the Serial Monitor and set baud rate to 9600 and set Both NL & CR
In begging you receive a massage Enter AT commands:
Then type AT and press enter, if you receive OK means everything is ok and you are ready to go.
Now here you can change the default values of HC-05 BT module like
Suppose I want to change the default name of Bluetooth module From HC-05 to MY-BT
So first I will check what is the current name of may BT module so send the below command in Serial Monitor and press enter
AT+NAME?
the you will receive the current name of your BT module like
+NAME:HC-05
Now I like to change name from HC-05 to MY-BT so I will type and enter
AT+NAME=MY-BT
After pressing enter if you receive OK means your BT module name is change successfully.
In this way you can change another settings also please refer the full list of AT Commands from the link below
http://www.linotux.ch/arduino/HC-0305_serial_module_AT_commamd_set_201104_revised.pdf