The AT commands mode is used to change the default settings of the HC-06 Bluetooth module. AT commands are required in command mode. The data mode is used for data transfer between devices whereas command mode is used for changing the settings of the Bluetooth module. This HC-05 Bluetooth device can be used in 2 modes data mode and command mode. A Logic Level Converter is recommended to protect the sensor if connect it to a 5V device (e.g Arduino Uno and Mega). The HC-05 will work with supply voltage of 3.6VDC to 5VDC, however, the logic level of RXD pin is 3.3V and is not 5V tolerant. The HC-05 Bluetooth Module can be used in a Master or Slave configuration, making it a great solution for wireless communication. No user code specific to the Bluetooth module is needed at all in the user microcontroller program. When the module receives wireless data, it is sent out through the serial interface exactly at it is received. All data received through the serial input is immediately transmitted over the air. Once it is paired to a master Bluetooth device such as PC, smartphones and tablet, it’s operation becomes transparent to the user.
The HC-05 is a class 2 Bluetooth SPP (Serial Port Protocol) module designed for transparent wireless serial communication.
Please refer my previous tutorial for How to use SoftwareSerial library Arduino Board. We can SoftwareSerial library as well to communicate with HC-05 module. To communicate with HC-05 Bluetooth Module we need to user serial communication between serial communication Pins RX & TX available with Arduino and HC-05 Bluetooth module. In this tutorial, we will learn how to interface HC-05 Bluetooth Module with Arduino Mega 2560 controller with simple example for controlling LED connected with Arduino Board over Wireless Communication (Bluetooth).