Saturday, July 7, 2012

Windows: Communicating with a HC-06 bluetooth module

On this post, I'll cover the PC-side configuration needed to communicate with a HC-06 bluetooth module. For more information about the HC-06 module per se (pinout, recommended electrical connection, AT commands and more) check this post.

The process is straightforward in Windows.

Discovery


Double click the Bluetooth icon in your taskbar. Or alternatively, go to Control Panel > Hardware and Sound > Devices and Printers > Add a device.

On this new window, click on the "Add a device" button in the menu.

Discovery of bluetooth devices.

Windows will start searching for nearby bluetooth devices (your HC-06 module should be powered by now).

Pairing


From the list of discovered devices, select your HC-06 module. You should be able to see it's name (linvor is the default name) and it should be listed under the Other category.

On the new window, select the "Pair without using a code" option.

Pairing with the HC-06 module

Checking


You should see the "Installing device driver software" bubble by now. When the installation is done, we'll be able to check the properties of the HC-06 module. Right click on the device and select properties. The important information is under the "Services" tab of the properties window.

Checking the HC-06 module properties.

Communication


After pairing with the HC-06 module, it will be registered as a "COM" port, and you'll be able to communicate with it, using any serial port emulator (e.g. qSerialTerm)

On the first connection to the module, you'll be asked for the pin (the default pin is 1234).

Inserting the pin on the first connection.

Enjoy


That's all, go ahead and play with your bluetooth module.

Testing the bluetooth module.


6 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hi, Do I need a BT Device already attached with my PC. or HC-06 will connect PC via serial port?

    ReplyDelete
    Replies
    1. Hello Chulla,

      Your PC must have bluetooth (either built internally or via a Bluetooth dongle). This is because the HC-06 is a slave Bluetooth device, so your PC must start the communication.

      On the HC-06 side, you can connect a microcontroller or any other UART capable device. You can configure the HC-06 module before linking the module with your PC.

      See this post for more information about the HC-06.

      Delete
  3. Hi, I'm not sure if you will be able to help but its worth a try:

    I am making a project where I (for now) just trying to get the PC to send commands to a microcontroller via bluetooth using the HC-06 module.

    My supervisor for uni has already tested it out and it works for him. I am having problems getting the hc-06 to talk to the microcontroller. The connection to the PC seems fine for now.

    I know theres no communication because after programming the mc to configure the hc-06 module to my own settings, the PC does not pick up these changes.

    By this I mean, I changed the default name linvor and password 1234 to my own but my customised name is not coming up neither does the customised password work.

    I hope you can help

    Thank you

    Hana

    ReplyDelete
    Replies
    1. Hello Hana,

      I strongly advise you check this post:
      http://embeddedprogrammer.blogspot.com/2012/06/ubuntu-hacking-hc-06-bluetooth-module.html
      It contains general information about the HC-06, you'll find it useful whether you are using Windows or Ubuntu.

      About your issue, does the HC-06 retains its default configuration (name: linvor and pin:1234)? If the answer is yes, then this means you are not correctly configuring the HC-06.

      Consider the following:

      + The HC-06 stores its configuration in non-volatile memory. This means the HC-06 will remember its last configuration (e.g. you changed its name) even if you power it off.
      + The HC-06 can only be configured when it's unpaired.
      + The HC-06 will "reply" after receiving a configuration command, be sure to check that you are receiving a correct reply.
      + Be sure to use the correct baud rate (the last you configured, which is not necessarily the default 9600).

      Good Luck.

      Delete
  4. Am curious why you pair without the code? Having tried a number of different things, my experience is, for some reason, the connection / PIN popup is for some reason hidden, and never appears. Eventually the connection attempt times out, and the connection fails.

    Pairing with the code hasn't made any difference - the HC)6's simply won't connect as virtual com ports regardless, but was curious all the same.

    This has been a frustrating struggle.

    ReplyDelete