#5 Arduino Mega - How to Configure HC-05 Bluetooth Module using AT Commands? | APDaga Tech

#5 Arduino Mega - How to Configure HC-05 Bluetooth Module using AT Commands? | APDaga Tech

IoT Tutorial #5 [ Arduino Mega Tutorials #5 ]
Here, I will show you can configure the HC-05 Bluetooth Module using AT (Attention) commands.

These AT commands can be used to Check and Change the Name, Password, Baud Rate for Communication of HC-05 Bluetooth Module.


Follow these steps:
  1. Connect Arduino Mega Board to Laptop and upload a Blank Sketch to the Arduino.
    (Note: Don't make any other connection to Arduino Board while uploading a blank sketch)
  2. Connect HC-05 Bluetooth Module in configuration mode:
    Arduino Mega -> BluetoothModule
    Pin0 (Rx0) -> Rx
    Pin1 (Tx0) -> Tx
    Gnd -> GND
    Vcc -> VCC(+5V)
    3.3V -> Pin 34

    Serial Communication through USB cable(Tx0 and Rx0) to
    Arduino Terminal(Desktop) is used just to cross verify.
  3. Enter into configuration mode:
    Plug out  Gnd or Vcc wire of Bluetooth (HC-05) module and Plug it back.
  4. To verify whether HC-05 is in configuration mode,
    LED on Bluetooth module must blink at a slower rate.   
  5. Open Serial Arduino serial monitor and Set Baud Rate = 38400 and select "Both NL and CR" Option
  6. Type following AT commands in given Sequence
    FORMAT:
    ---------------------------
    <Command>
    :Explanation
    --<Expected Output>
    --------------------------



    AT
    :Attention Command
    --OK
    AT +NAME
    :To Check the name of the module
    --+NAME:HC-05
    --OK
    AT +NAME=AKSHAY
    :To change name of the module to AKSHAY
    --+NAME:AKSHAY
    --OK
    AT +PSWD?
    :To check the current password of the module
    --+PSWD:124
    --OK
    AT +PSWD=0000
    :To set the password to 0000
    --+PSWD:0000
    --OK
    AT +ADDR
    :To check the address of the module
    --+ADDR:98d3:32:1123f9
    --OK
    AT +UART
    :To check the Baud Rate of the module for communication
    --+UART:9600,0,0
    --OK
For All the AT Commands Download this file:
HC-0305_serial_module_AT_commamd_set_201104_revised.pdf

To understand better Watch the demonstration video below.

Demonstration:


Click here to see more codes for Arduino Mega (ATMega 2560) and similar Family.

Feel free to ask doubts in the comment section. I will try my best to solve it.
If you find this helpful by any mean like, comment and share the post.
This is the simplest way to encourage me to keep doing such work.
Thanks and Regards,
-Akshay P. Daga

2 Comments

  1. What is the TX, RX pin in ATMEGA2560 for the program ?

    ReplyDelete
    Replies
    1. I have already mentioned the pin numbers for ATMEGA2560 TX and RX in step 2 in above blog post.

      Delete
Post a Comment
Previous Post Next Post