Modifying the HC-05 Bluetooth module defaults using AT commands

The HC-05, a Bluetooth to serial bridge, can be found for around $5 on the internet and therefore may be the cheapest way to add Bluetooth connectivity to your project.

However, its default settings may need to be changed depending on your application. [Hazim] explains a way to enter the HC-05 AT command mode to benefit from the rich set of features that the device can provide. The process is fairly simple as it only consists of maintaining the key pin of the HC-05 high while powering on. The device then boots in AT command mode with a default 38400bits/s speed and listens for all of the AT command set (PDF). As an example [Hazim] provides a sketch allowing you to write the AT commands directly in your favorite terminal.

With the basics out of your way you may want to further research the hardware, especially if you will be using modules from different sources. They don’t always come with the same firmware.

Comments

  1. The…hack…here is to take *one* pin HIGH…?
    (that is what it takes to get the module into command mode)

    • chango says:

      As a wise man once said, “Knowing is half the battle”

    • Adam says:

      Actually you can’t enter into AT mode by just taking one pin HIGH. It has to be high before you power the HC-05. Then you have to ensure the baud rate is 38400. Then you have to ensure you are communicating with the HC-05 via software serial since that’s the Arduino Serial Monitor is using pins 0 and 1. So it’s a number of little things that can throw off most hackers and waste considerable time when taking the HC-05 into AT mode. I have been there. These instructions could have saved me considerable time.

    • Kevin says:

      dmitry, if you read carefully, I don’t think this was intended as a hack. It was meant to be an easy to follow guide on how to configure the most popular bluetooth module the HC-05. You should say thank you when people take the initiative to make our lives easier. I had a tough time configuring the HC05 and this helps. Just because you are a guru who can figure things out on your own, the rest of us humans still need some help now and then. if you think this is as simple as turning one pin high, you should try it then you will see what the docs have left out. So be nice or keep your opinion to yourself.

    • Carlos Safe says:

      Hack or no hack this could have saved me countless hours of aggravations and frustrations. Before you tell people to RTFM maybe you should tell vendors and hackers to learn how to write.

  2. it’s in the docs…

  3. FZ says:

    The hack is to RTFM …

  4. pulsar says:

    IIRC these listening to “AT Commands” as long no paired device is connected.

  5. Lavarius says:

    The cool feature on these modules, is that with the right firmware, they can be used as master devices instead of slaves.

    I’ve put together a little setup that uses this and an arduino to interact directly with a mindwave mobile to light up a row of leds based on my perceived levels of concentration. Removing the need for a pc in there completely.

  6. Solenoid says:

    Here’s a library for the HC-05, although the pins are hard-coded because it’s for a very specific purpose you can use it for any HC-05: https://github.com/Robopoly/bluetooth-library

  7. a3 says:

    Just curious if anybody tested these for range in open space and indoors?

    Is there any info about that?

    • kerimil says:

      read a wikipedia article on bluetooth – there are generally two classes of bluetooth devices. Class 2 has range of about 10 meters in direct LOS (vast majority of all devices are of this class). Class 1 devices achieve 100 meters. You can achieve more using directional antennas or even amplifiers just as with wifi and there exist special long range modules. It’s all a matter of price and practicality really. If I ever needed longer range I’d probably choose RFM22B – I personally never used one but they do seem pretty impressive

  8. blueman says:

    i tried this a few months ago but gave up. the manual is a piece of s@#t. now i can change the settings. thank you for the instructions

  9. Geexo says:

    AWSOME!

  10. tz2026 says:

    I used a bunch of pins or needles in a block of Sculpey (and an LED directly inserted – it had an internal resistor) to program the modules without soldering them to a board.

  11. Stoutlimb says:

    I heard rumours that some HC-05’s secretly support a DTR signal. Some manufacturers in China say yes in correspondence but English wasn’t so good so I’m unsure. Has anyone had any success?

  12. btman says:

    kerimil: I see your name along with an army off your fake aliases pop up every time someone posts anything about arduino and bluetooth, always trying to start flame wars. grow up and get a life man. There are more important things in life than bluetooth and your project which you keep promoting as if the greatest thing since sliced bread. It’s just bluetooth dude :)

  13. keelobite says:

    Thank you Hazim for an excellent guide.

    “And on the 8th day, God created jerks.”

  14. mark88 says:

    I fried a couple of HC05s while trying to change the defaults. This really helps.

  15. TikTak says:

    Big like. I had to wrestle for hours with crappy HC-05 documentations when I should have been focused on my project. Unfortunately I gave up and bought a different Bluetooth transceiver. Time to dust off the HC-05 for the next project.

  16. HLL says:

    You can even REWRITE the entire firmware of the chip… try to translate this next my post from Hebrew: http://www.makers.co.il/mfs/showthread.php?91-%E4%EE%F8%FA-HC-03-Bluetooth-Module-%EE%E1%E5%F1%F1-CSR-%EC-HID-Device&p=421#post421

  17. lokster says:

    this isnt working for me, i followed everything, and nothing happens when i open serial monitor and type AT. =/ frustrating

  18. Rahul Jain says:

    Can we reduce Range of this module? Default it is 30 feets but i need its range for 10 Feets only.. is it possible?

    • CESAR ALVARENGA says:

      I am trying to do the same thing and cant find out. if you managed to find a way can you inform me of how you did it?

      • Rahul jain says:

        no i Didn’t got any way to do, but the thing which we can try is reducing the power. That what answer i got over irc, but i havn’t tried it yet.

        • CESAR ALVARENGA says:

          how would do i do that? i have two bluetooths, one connected to my initial project and one which has to portable. For the one conncted to my projected, i have it on a breadboard, can i just put resistors to decrease the power and for the wireless just give it a weak battery?

  19. David says:

    Hello Everyone Eh Created a program to Set all parameters of a Hc-05 Bluetooth Module, arduino By,
    Is Very Intuitive and shows the potential of these modules,
    download:

    https://mega.co.nz/#!IlgEhL7D!49AyfrlgPI2pjhWUyRTMK85TBGRP-BbSxW712nDXsdg

    Various Tools As has:
    Slave Name
    The Error Manager
    The Finder Device
    Configure All in one
    etc
    Since the program is written in Basic, the Deputy Pograma compiled and Soft for uploading to the Arduino
    It is compatible with Arduino Uno, Duemilanove, Nano, MiniPro, Etc
    Requirements,
    Micro: ATmega328P
    Clock: 16Mhz
    Baud: 4800
    Send the CR at the end of any order.
    regards

  20. John says:

    As for someone who has been working with digital electronics since the 8080 cpu, I welcome any and all insight. I’ve just started messing with arduino and find there is much more to HC-05 than one rule. There are many versions out there, are they all the same? I can see physically they aren’t some have 4 pin carriers, some 6. Is the firmware the same? IDK because I have yet to learn how to get to it. Am I dumb, no I’m inexperienced. So all you know it all’s give those fresh to the technology a break.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,369 other followers