How to Auto-Pair Two HC-05 Modules on Power-Up (Without Manual AT Commands)
Configuring two HC-05 modules to automatically find and connect to each other as soon as power is applied is ideal for wireless projects like RC vehicles, remote sensor stations, or wireless telemetry.
To achieve this, you only need to program AT commands once for each module: one set as Master and the other as Slave.
How It Works
Slave Module: Stays on a fixed MAC address and listens for incoming connections.
Master Module: Configured with the Slave’s specific MAC address and set to fixed-address pairing mode (
CMODE=0). Every time it powers on, the Master automatically scans for and connects to that exact Slave module.
1. Configuring the SLAVE Module
Connect Module 1 to your PC (via a USB-to-TTL adapter or Arduino) and enter AT Command Mode (hold the button while powering on so the LED blinks slowly every 2 seconds).
Set your Serial Monitor to 38400 Baud with Both NL & CR enabled.
1.Set to Slave Mode & Retrieve MAC Address:3 min.
Send the following AT commands sequentially:
AT+ORGL— Restore factory default settings to clear old configurations.AT+ROLE=0— Set the module to Slave mode.AT+ADDR?— Query the module’s MAC address.
Note: The module will return an address in the format:
+ADDR:12:34:56789A.Save this address! You will need it to configure the Master module in the next step.
2.Set Password & Operational Baudrate:2 min.
AT+PSWD="1234"— Set the pairing PIN code (default is usually 1234 or 0000).AT+UART=9600,0,0— Set the serial communication speed to 9600 bps (or whatever baud rate your project requires during normal operation).
2. Configuring the MASTER Module
Disconnect the Slave module and connect Module 2 in AT Command Mode to configure it as the Master.
1.Set to Master Mode:2 min.
Send the following commands:
AT+ORGL— Restore factory default settings.AT+ROLE=1— Set the module to Master mode.AT+CMODE=0— Set to fixed-address mode (only connects to a bound MAC address, preventing random connections).
2.Match Password & Baudrate with Slave:2 min.
AT+PSWD="1234"— Must match the Slave's PIN 100%.AT+UART=9600,0,0— Must match the Slave's operational baud rate 100%.
3.Bind Slave's MAC Address to Master:2 min.
Take the MAC address obtained from the Slave module in Step 1.
Convert the colons (:) to commas (,).
Example: If Slave MAC was
12:34:56789A$\rightarrow$ convert to12,34,56789A.
Send the binding command:
AT+BIND=12,34,56789A(Replace with your actual Slave MAC address)
3. Testing the Automatic Pair
Disconnect both modules from AT Command Mode (unplug USB or power off).
Power both modules normally (5V) in standard operating mode (do not hold the button on boot).
Observe the LEDs:
Initially, both LEDs will flash rapidly (~2 times per second) as they search.
After 2–5 seconds, both LEDs will switch to a synchronized double-blink pattern (two quick blinks followed by a pause).
This double-blink indicates that the Master and Slave have successfully discovered each other and established a transparent wireless serial link. Any data sent into the TX pin of one module will now come out of the RX pin on the other!

Be the first to leave a comment.
Leave a comment