Bluetooth Communication Arduino HC-05 Basic Set Up

The HC-05 is based on the EGBT-045MS Bluetooth module. It can operate as either a slave device or a master device. As a slave it can only accept connections. As a master it can initiate a connection.
The EGBT-045MS Bluetooth modules is a 3.3v device. The HC-05 break out board has a 3.3v regulator that allows an input voltage of 3.6v to 6v but the TX and RX pins are still 3.3v. This means user can use the 5V out from the Arduino to power the boards but cannot connect the Arduino directly to the HC-05 RX pin.
The HC-05 Bluetooth module is one of the most economical and easiest way to go wireless via Bluetooth. This module makes it easy for any user to wirelessly extend serial interface, so user can control any program running on Laptop with serial port interface. For the HC-05 RX pin user need to convert the Arduino's 5V to 3.3v. A simple way to do this is by using a voltage divider made from a couple of resistors. Since the Arduino will accept 3.3 volts as HIGH user can connect the HC-05 TX pin directly to the Arduino RX pin.

HC-05 zs-040 Status LED
The onboard LED shows the current state of the module.
  • Rapid flash (about 5 times a second) – module is on and waiting for a connection or pairing
  • Single quick flash once every 2 seconds – the module has just paired with another device
  • Double quick flash every 2 seconds – connected to another device
The HC-05 remembers devices it has paired with and after cycling the power user do not need to re-pair. This means user can go from rapid flash (about 5 times a second), module is on and waiting for a connection or pairing, to double quick flash every 2 seconds, connected to another device directly.

  • HC-05 Vcc to 5V, can be from the +5V out from the Arduino
  • HC-05 GND to common GND
  • HC-05 RX to Arduino pin D3 (TX) via a voltage divider
  • HC-05 TX to Arduino pin D2 (RX) connect directly
  • Default name: HC-05
  • Default pairing code: 1234
  • Default baud rate: 9600
But in AT/Command mode it has 38400 baud rate. Usually this Bluetooth module is used with the Arduino, but it can be used with others microcontrollers devices. Here it’s how it’s wired with an Arduino.

<img src="arduino_hc05_basic_setup.png" alt="arduino_hc05_basic_setup.png">