HC-05 Bluetooth is a master-slave Bluetooth serial module, simply put, when the Bluetooth device and Bluetooth device are paired with a successful connection, we can ignore the internal Bluetooth communication protocol, Bluetooth will be used directly as a serial port. When the connection is established, the two devices use a common channel that is the same serial port, a device sends data to the channel, another device can receive data in the channel.
The HC-05 Bluetooth module is a popular module for wireless communication in embedded systems. Here’s a quick overview of the pinout and their functions:
HC-05 Pinout
- EN/Key (Enable/Key): Used to switch between command mode and data mode. High input (3.3V) puts the module in command mode, allowing AT commands, while low input puts it in data mode.
- VCC: Power supply pin (3.3V to 5V).
- GND: Ground pin.
- TXD (Transmitter): Sends data from the HC-05 module to another device. Connect to the RX pin of a microcontroller (e.g., Arduino).
- RXD (Receiver): Receives data into the HC-05 module from another device. Connect to the TX pin of a microcontroller.
- State: Outputs high when the module is paired and low when not paired.
- LED: This onboard LED indicates the Bluetooth connection status (flashing = not connected, solid = connected).
How to use HC-05 Bluetooth module with Arduino?
You need the following components to make your first Bluetooth-enabled project using HC-05 with Arduino.
- LED
- 200-ohm resistor
- HC-05 Bluetooth module
- Arduino UNO
- Breadboard
- Jumper wires
Connect all these components as shown below.
-
Connect an LED to an Arduino board with the help of jumper wires.
-
Connect the Bluetooth module to the Arduino with the help of jumper wires. Except for the first and the last pin, all other pins need to be connected to the Arduino.
-
Ground and power pins of HC-05 to Ground and 3.3V pins of Arduino, respectively.
-
Tx of module to RX of Arduino and vice versa.
Main Parameters:
-
Operating Voltage: DC 3.3V - 5V
-
Operating Role: Slave mode
-
Serial Parameters: 38400 bits/s, 1 stop bit, no parity bit
-
Pairing Code: 1234
-
Device Name: HC-05
-
Connection Mode: Supports connection with any Bluetooth device (Restore default settings with AT command: AT+ORGL)
Core Functions:
-
Status Indicator: The LED indicates the Bluetooth connection status. Rapid red-blue flashing means no Bluetooth connection, slow flashing (every 2 seconds) indicates AT mode and double flashing (twice per second) indicates Bluetooth is connected and the port is open.
-
Reverse Connection Protection: The board is equipped with a reverse connection protection diode and a 3.3V LDO. The input voltage is 3.6V-6V. The current is about 30mA when not paired and about 10mA after pairing. The input voltage must not exceed 7V!
-
Interface Level: 3.3V level, can be directly connected to various microcontrollers (51, AVR, PIC, ARM, MSP430, etc.). 5V microcontrollers can also be connected directly, without the need for MAX232 and should not go through MAX232!
-
Communication Distance: Effective range of 10 meters in open space (Power class: CLASS 2). It may connect beyond 10 meters, but the quality of the connection is not guaranteed.
-
Communication Format: After pairing, it can be used as a full-duplex serial port, supporting 8-bit data bits, 1 stop bit, and optional parity bit communication format, which is the most common format. It does not support other formats.
-
AT Command Mode: You can enter AT command mode by pulling up pin 34 to set parameters and query information.
-
Size: The module size is 3.57cm x 1.52cm, factory-produced with surface-mount technology to ensure quality. It is covered with transparent heat-shrink tubing for dust proofing, aesthetic appearance, and some level of electrostatic protection.
-
Mode Switching: Can switch between master or slave mode via AT commands, and can connect to specific devices using AT commands.
-
Baud Rate: Supports baud rates from 4800bps to 1382400bps.
-
Control Signal: Controlled via serial communication.
FAQs
What is the PIN code for HC-05?
PIN code or default password of HC-05 is 1234 or 0000.
What is the state pin in HC-05?
The state pin serves to indicate its current operational status, such as paired or unpaired, connected or disconnected. It outputs a signal that can be monitored by microcontrollers to facilitate communication and control in embedded systems.
Can HC-05 run at 3.3 V?
Yes, it can operate at 3.3V, making it compatible with many microcontrollers and devices that use lower voltage levels.