1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Using AT Command on HC06 bluetooth and arduino.

Discussion in 'Arduino' started by Marceleo M, May 10, 2015.

  1. Marceleo M

    Marceleo M New Member

    Joined:
    Mar 25, 2015
    Messages:
    2
    Likes:
    0
    Hello, I tried many ways from internet that i could find to use AT command for changing the baud rate of HC06 bluetooth but nothing seems to work. Can anybody show me the right way? im120710006_8.jpg I use this type of bluetooth module and a Arduino UNO. Thanks.
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,148
    Likes:
    907
    Location:
    Rochdale UK
  3. Marceleo M

    Marceleo M New Member

    Joined:
    Mar 25, 2015
    Messages:
    2
    Likes:
    0
    Thanks but I have read both link you suggested and both show nothing about AT command. But, thanks anyway..
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,247
    Likes:
    1,218
    Location:
    Cardiff, Wales

    I'm no programmer, but doesn't this code (from the second link in post #2) set the baud rate?
    Code (text):
    void setup()  {
      bluetooth.begin(9600);
     
    • Like Like x 1
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    Again, easy with google :D

    http://42bots.com/tutorials/hc-06-bluetooth-module-datasheet-and-configuration-with-arduino/

    Code (text):
        One of the more useful attributes is the Bluetooth baud rate. You can set that by sending a command like AT+BAUD4, where the last number (4 in this case) is defining the rate as follows:

    AT+BAUD1———1200
    AT+BAUD2———2400
    AT+BAUD3———4800
    AT+BAUD4———9600 (Default)
    AT+BAUD5———19200
    AT+BAUD6———38400
    AT+BAUD7———57600
    AT+BAUD8———115200
    AT+BAUD9———230400
    AT+BAUDA———460800
    AT+BAUDB———921600
    AT+BAUDC———1382400

    If you enter AT+BAUD4 you should receive a response OK9600.
    Why do you want to change the baud rate anyway?.
     
    • Like Like x 1
  7. Les Jones

    Les Jones Well-Known Member

    Joined:
    May 15, 2015
    Messages:
    1,445
    Likes:
    187
    Location:
    Lancashire UK
    I configured my HC05 and HC06 Bluetooth modules by just using the USB to serial interface on the Arduino Uno board.
    These are the instructions.

    Using the Arduino Uno to configure an HC05 Bluetooth module.


    Either remove the ATMEGA328P or program it with this sketch which will not enable the TX pin on the ATMEGA328P. (It just runs a tight loop doing nothing.)


    Connect the RX pin on the Aduino board to the RX on the HC05 module via a potential divider consisting of a 5K6 resistor from the RX pin on the Arduino and a 10 K resistor to ground. NOTE Connecting the RX pin to the RX pin seems strange but the RX pin on the Arduino board is actually the TX pin on the ATMEGA16U2. (Used as a USB to serial converter.)

    Connect the TX pin on the Arduino to the TX pin on the HC05 together with a 3.3 volt zenner to ground. (+ to TX pin - to ground.)


    In the Arduino window click on the "Tools" dropdown box and select "Serial monitor"

    In the "serial monitor window" set the baud rate to 38400 bauds. In the box to the left of the baud rate box select "Both NL & CR"
    Type the required AT command in the send window then click send.
    You will see the response in the main part of the serial monitor window.

    NOTE The baud rate for AT commands is always 38400


    Link to HC05 data on Dropbox. https://dl.dropboxusercontent.com/u/58065284/AT Commands for Bluetooth Module.pdf

    Edit
    After entering this post I remembered that I had a problem with the HC06 modules. I found that typing in a command manually does not seem to work.
    Type the command into notepad etc then copy and paste it into the terminal program. The HC-06 seems to need all the characters of the command to be sent very quickly.

    Les.
     
    Last edited: May 20, 2015
    • Like Like x 1

Share This Page