Bluetooth HC-06

Properties

This article describes how to connect the HC-06 Bluetooth module with an Arduino board in order to set the module name, baudrate and pin code.

The AT-commands to be used is described below. Verify the changes by any Bluetooth scanning device such as a smartphone.

Steps

  1. Connect the HC-06 to the breadboard and wire the 4 cables according to the figure below. TX <-> D7, RX <-> D8
  2. Power up the arduino
  3. Start Arduino IDE and select correct Tools/Serial Port
  4. Install the Arduino sketch below.
  5. Start the Serial Monitor in Arduino IDE. The AT command: AT shall be answered with OK from the HC-06.
  6. In the serial MOnitor, type AT+NAMEyourdevicename and the HC-06 shall answer with OKname.
  7. Continue to send the AT commands you want to execute.

AT Commands:

Component List

  1. Arduino board
  2. HC-06 Bluetooth module
  3. Breadboard
  4. 4 cables (red, black, green, yellow)

Software

//==============================================

// Arduino Sketch

//==============================================

#include <SoftwareSerial.h>

SoftwareSerial mySerial(7,8); // RX, TX

void setup()

{

Serial.begin(9600);

pinMode(10,OUTPUT); digitalWrite(10,HIGH);

Serial.println("Enter AT commands:");

mySerial.begin(9600);

mySerial.write("AT");

Serial.println("Entered AT!");

}

void loop()

{

if (mySerial.available())

{

Serial.write(mySerial.read());

}

if (Serial.available())

{

mySerial.write(Serial.read());

}

}

//==============================================

Links and References

http://arduino.cc/en/Reference/SoftwareSerial