HC-06 Bluetooth Serial Module (HCARDU0004 & HCARDU0064)

Wireless and wired modules including Bluetooth, Ethernet, and IR kits.
admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

HC-06 Bluetooth Serial Module (HCARDU0004 & HCARDU0064)

Post by admin » Mon Aug 20, 2012 5:30 pm

Image

HC-06 Arduino Bluetooth Wireless Serial Port Module. These modules are available in master (HCARDU0064) and slave (HCARDU0004) versions. Please see FAQ section before purchasing one of these modules.

The slave module can be purchased here.
The master module can be purchased here.


Default password: 1234

Baud rate: 9600

Dimensions: 1.73 in x 0.63 in x 0.28 in (4.4 cm x 1.6 cm x 0.7 cm)

  • PINOUT
    1.....VCC
    2.....GND
    3.....TXD
    4.....RXD

AT Commands:

Module must be disconnected (Led flashing) to issue AT commands.

Communication Test :
Send: AT
Response: OK

Change Baud Rate:
Send: AT+BAUD<b>

<b>......Baud
1......1200
2......2400
3......4800
4......9600
5......19200
6......38400
7......57600
8......115200

E.g.
Send: AT+BAUD7
Response: OK57600

Change Bluetooth Device Name:
Send: AT+NAME<devicename>

E.g.
Send: AT+NAMEHobbComp
Response: OKHobbyComp


Change Pincode:
Send : AT+PINxxxx
Response: OKsetpin


FAQ:

What version of firmware do these modules have?

They are V1.06 HC-06

Can a slave device be a master?

No, they are fixed to either a master or a slave, you need to purchase the appropriate one.

What is the purpose of the red LED?

The LED indicates the current link status of the module.

Flashing = Not connected
Solid = Connected

What is the difference between a master and slave module?

The slave module is intended for communicating with other Bluetooth devices such as a laptop or smart phone. The master device is intended ONLY for communicating with a slave module. By default it will automatically pair with a slave module with no software interaction.

I have purchased a master module but why can't I get it to pair with my computer?

Please see previous question.

I have paired my computer to a slave so why is the modules LED still blinking?

Although your computer may have successfully paired with the slave module, it may not sustain a link unless you open a serial terminal connection on your computer.

When I send an AT command the module doesn’t respond and the command just appears at the remote end, why is this?

When the modules are connected they switch to a transparent mode and will not respond to AT commands. To issue an AT command you must be disconnected (LED flashing)

Is there any way for my program to know when I am connected?

Other that writing a 'ping' response into your program, the easiest way is to just issue the at command 'AT'. If you receive an OK back from the module then you are not currently connected to another device.

Can a master connect to more that one slave?

No, you can only connect to one slave module at any one time.

I have several slave modules, can I switch the master from one module to another?

Yes but in a roundabout way... Both master and slave modules accept an AT command (AT+PIN) to allow their pin code to be changed. By giving each slave module a unique pin code the master module will only connect to a slave that has a matching pin code. You can change the pin code on the master module to match the one on the slave that you wish to connect to. The only issue with this is that you cannot issue AT commands to the master whilst it is currently connected to a slave. Therefore you will either need to move the master out of range of the connected slave or cycle the masters power supply and then immediately issue a pin number change. By powering the master module via a transistor this could be done in software using a DIO pin.

Code: Select all

/* FILE:    ARD_BLUETOOTH_SERIAL_MODULE_HCARDU0004_Example.pde
   DATE:    17/07/12
   VERSION: 0.1

This is a simple example of how to use the HobbyComponents Bluetooth serial 
module (HCARDU0004). This module allows communication from an Arduino dev 
board to a Bluetooth enabled device. The module communicates with an Arduino 
device via a simple two wire serial protocol. If you choose to use the modules 
default settings then the module requires no setting up to communicate with it,
just connect to the Arduino. The device defaults to 9600 baud, 8 data bits, 
and 1 stop bit. The baud rate, amongst other settings can be changed using 
standard AT commands via its serial interface.

This sketch demonstrates an example of how to communicate with the 
device using a software serial interface using just two DIO lines to interface 
with the module. The program will pass-through for any data sent to and from 
the device to the Arduino's hardware serial interface. This will allow you to 
communicate with any device paired with the module via Arduino IDE's built in 
serial port monitor.


SENSOR PINOUT:

PIN 1: KEY
PIN 2: VCC
PIN 3: GND
PIN 4: TXD
PIN 5: RXD


SETUP INSTRUCTIONS:

Connect the Bluetooth module as follows:

Arduino       Bluetooth module
5V            PIN 2 (VCC)
GND           PIN 3 (GND)
DIO 10        PIN 4 (TXD)
DIO 11        PIN 5 (RXD)

You will require the NewSoftSerial library available at the following location,
which will provide the functions required for the software serial port:

http://arduiniana.org/libraries/newsoftserial/

If you are using Arduino V1.0 or above, this library is now integrated into 
the core and therefore does not need to be downloaded. Instead just change all
NewSoftSerial references to SoftwareSerial.

Compile the sketch and upload to your Arduino. 

Pair your Bluetooth enabled device with the Bluetooth module using PASSCODE: 1234
(you do not need to do anything on the module side to do this).

Open up the serial port monitor in the Arduino IDE (CTRL+SHIF+M).

You will now be able to communicate with the paired Bluetooth device.


You may copy, alter and reuse this code in any way you like but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. */



/* Include the software serial port library */
#include <NewSoftSerial.h>

/* DIO used to communicate with the Bluetooth module's TXD pin */
#define BT_SERIAL_RX_DIO 10 
/* DIO used to communicate with the Bluetooth module's RXD pin */
#define BT_SERIAL_TX_DIO 11

/* Initialise the software serial port */
NewSoftSerial BluetoothSerial(BT_SERIAL_RX_DIO, BT_SERIAL_TX_DIO); // RX, TX


void setup()  
{
  /* Set the baud rate for the hardware serial port */
  Serial.begin(9600);
  /* Set the baud rate for the software serial port */
  BluetoothSerial.begin(9600);

}

/* Main loop that will pass any data to and from the Bluetooth mode to the
   host PC */
void loop()
{
  /* If data is available from the Bluetooth module then pass it on to the 
     hardware serial port. */
  if (BluetoothSerial.available())
    Serial.write(BluetoothSerial.read());
 
   /* If data is available from the hardware serial port then pass it on 
      to the Bluetooth module. */
  if (Serial.available())
    BluetoothSerial.write(Serial.read());
}

Manual:

PLEASE NOTE that this manual covers several versions of module and is not just for the ones advertised in this thread. It includes some information and AT commands that are not relevant. For a list of AT commands see above list in this post.
HCARDU0004_JY_MCU_Bluetooth_Module_Manual.zip
You do not have the required permissions to view the files attached to this post.

mitchyboy9

Re: JY-MCU Bluetooth Serial Port Module (HCARDU0004)

Post by mitchyboy9 » Thu Oct 25, 2012 11:35 am

Can this module be used as a master? I would like to be able to scan for other Bluetooth devices within range and initiate a connection from the Arduino. The code sample mentions that 'other settings' can be changed using standard AT commands, so I just wanted to check. Thanks

admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

Re: JY-MCU Bluetooth Serial Port Module (HCARDU0004)

Post by admin » Thu Oct 25, 2012 7:16 pm

mitchyboy9 wrote:Can this module be used as a master? I would like to be able to scan for other Bluetooth devices within range and initiate a connection from the Arduino. The code sample mentions that 'other settings' can be changed using standard AT commands, so I just wanted to check. Thanks
Hi, these are supplied factory set as slave devices. We have now attached the manual to the original post. Current shipped version is HC-06 (V1.05)

mitchyboy9
Posts: 1
Joined: Thu Oct 25, 2012 8:01 pm

Re: JY-MCU Bluetooth Serial Port Module (HCARDU0004)

Post by mitchyboy9 » Thu Oct 25, 2012 9:09 pm

Please note the defect in the example code.
This line:

Code: Select all

NewSoftSerial BluetoothSerial(BT_SERIAL_RX_DIO, BT_SERIAL_RX_DIO); // RX, TX
should be:

Code: Select all

NewSoftSerial BluetoothSerial(BT_SERIAL_RX_DIO, BT_SERIAL_TX_DIO); // RX, TX

admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

Re: JY-MCU Bluetooth Serial Port Module (HCARDU0004)

Post by admin » Fri Oct 26, 2012 9:49 am

Well spotted, the code has now been updated.

cscaria
Posts: 3
Joined: Fri Nov 23, 2012 9:23 pm

Re: JY-MCU Bluetooth Serial Port Module (HCARDU0004)

Post by cscaria » Fri Nov 23, 2012 10:13 pm

Dear admin,
I’ve tried to download the zip file (manual) but I get the error that the file is corrupted so not able to unzip it. Could you please help? Thanks
Regards
cscaria

admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

Re: JY-MCU Bluetooth Serial Port Module (HCARDU0004)

Post by admin » Sun Nov 25, 2012 8:12 pm

Thanks for bringing this to our attention, the file should now work.

cscaria
Posts: 3
Joined: Fri Nov 23, 2012 9:23 pm

Re: JY-MCU Bluetooth Serial Port Module (HCARDU0004)

Post by cscaria » Mon Nov 26, 2012 3:02 pm

admin wrote:Thanks for bringing this to our attention, the file should now work.
thanks a lot. now it works!

thierry

Re: JY-MCU SLAVE Bluetooth Serial Port Module (HCARDU0004)

Post by thierry » Wed May 22, 2013 11:10 am

Hello,
What module should I have to connect to issue the AT command ?
USB to serial adapter?
something like this ?
[Link removed]
Thanks
Thierry

admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

Re: JY-MCU SLAVE Bluetooth Serial Port Module (HCARDU0004)

Post by admin » Thu May 23, 2013 3:21 pm

Hi,

The following item (HCARDU0011) will work perfectly with this module: http://www.hobbycomponents.com/index.ph ... duct_id=91

Thanks,

Andrew

Post Reply

Return to “Wireless / Wired”