I. Bluetooth Module Introduction

A Bluetooth module (such as the HC05, HC06, HC08, and ZXD32) is a hardware device that implements wireless communication using the Bluetooth protocol. It typically communicates with the Arduino through a serial port (UART).

HC05/HC06: Classic Bluetooth modules support serial port transmission and are commonly used in Arduino projects.

Bluetooth Low Energy (BLE): Modules such as the HM10 and nRF51822 are suitable for low-power scenarios (such as wearable devices).

II. Bluetooth Module Configuration

1. Entering AT Command Mode

Bluetooth module parameters (such as name, baud rate, and pairing code) must be configured using AT commands.

To enter AT mode:
HC06/HC05: Disconnect VCC, press and hold the module's KEY pin (if available), and then reconnect VCC.

Status Indicator: The LED flashes every two seconds to indicate that AT mode has been entered.

2. Baud Rate Matching

Ensure that the Arduino's serial port baud rate matches the Bluetooth module's (e.g., 9600, 38400, or 115200). For example:
```cpp
Serial.begin(9600); // Arduino serial port initialization
bluetooth.begin(9600); // Bluetooth module baud rate

III. Application Scenarios

1. Smart Home Control: Control home appliances (e.g., lights, fans) via Bluetooth on your phone.

2. Sensor Data Acquisition: Wirelessly transmit data such as temperature, humidity, and heart rate to your phone.

3. Robot Control: Control robot movement by sending commands via your phone.

4. Remote Debugging: Monitor the Arduino's operating status in real time via the Bluetooth module.

Ⅳ. Common Problems and Precautions

1. The module cannot communicate:

Check whether the pin connection is correct (TX/RX cross connection).

Confirm that the baud rate settings are consistent.

Use the serial port debugging assistant to send AT commands to verify the module function.

2. The module is damaged:

Avoid directly connecting 5V to the VCC of the 3.3V module.

Use a resistor divider to protect the RX pin (such as 1kΩ and 2kΩ resistor divider).

3. Pairing failed:

Make sure the Bluetooth name of the mobile phone is consistent with the module name.

The default pairing code is usually `0000` or `1234`.

4. Dual Bluetooth module communication:

Use two SoftwareSerial instances to connect two modules respectively (refer to the code example in [11]).

Ⅴ. Extended Learning

Bluetooth Low Energy (BLE): Learn to use the HM10 or nRF51822 module to achieve low-power communication. Mesh network: Build a multi-node communication network through Bluetooth Mesh modules.