Wireless Communication between two Arduinos using HC-05 Modules
2026-07-27 | By Rachana Jain
License: Attribution Arduino
Bluetooth communication is one of the simplest ways to establish a wireless link between two microcontrollers. While most Arduino examples demonstrate communication between a smartphone and an HC-05 module, the HC-05 also supports Master-Slave mode, allowing one Arduino to directly communicate with another without requiring a mobile device.
In this tutorial, we'll configure two HC-05 Bluetooth modules using AT commands, assign one module as the Master and the other as the Slave, and then use the wireless connection to control a 12V DC motor connected to the Slave Arduino through an L293D motor driver.
This project demonstrates serial communication, Bluetooth pairing, command parsing, and motor control, making it an excellent foundation for robotics, industrial control, wireless automation, and remote monitoring projects.
Overview
The HC-05 Bluetooth module is commonly used in Slave mode, allowing devices such as smartphones or computers to connect to it. However, by entering AT Command Mode, the module can also be configured as a Master, enabling it to initiate communication with another HC-05 configured as a Slave.
After pairing the modules, the Master Arduino sends commands wirelessly while the Slave Arduino receives the commands, performs the requested operation, and returns an acknowledgement. In this example, the Master controls the direction and speed of a 12V DC motor connected to the Slave board.
This communication model is useful for numerous wireless embedded applications including robot control, home automation, remote machine operation, and distributed sensor systems.
Configuring the HC-05 Bluetooth Modules
Before the two Arduino boards can communicate, both HC-05 modules must be configured using AT commands.
The Bluetooth module is connected to an Arduino UNO using the SoftwareSerial library. Digital pins 2 and 3 are used as software UART pins because the hardware UART remains connected to the USB interface.
Since the HC-05 RX pin operates at 3.3V logic, a voltage divider using 1kΩ and 2kΩ resistors is used to safely interface the Arduino's 5V TX signal.
Upload the AT command sketch to the Arduino, place the HC-05 into Command Mode by holding the onboard button during power-up, and use the Arduino Serial Monitor at 9600 baud (Both NL & CR) to send AT commands.
Entering Command Mode
After uploading the configuration sketch:
Disconnect USB power.
Hold the push button on the HC-05 module.
Reconnect power while continuing to hold the button.
Release the button after approximately two seconds.
The Arduino Serial Monitor should confirm that the module has entered Command Mode.
Once communication is established, sending the command
ATshould return
OKconfirming successful communication.
Configuring the Slave Module
The first HC-05 module is configured as the Slave device.
The default HC-05 settings are:
Baud Rate: 9600
Data Bits: 8
Stop Bits: 1
Parity: None
Passkey: 1234 (or 0000)
Default Name: HC-05
The module name can be changed using:
AT+NAME=SLAVENext, configure the role as Slave:
AT+ROLE=0Finally, read the Bluetooth address:
AT+ADDR?The returned address will later be used when configuring the Master module.
Configuring the Master Module
The second HC-05 module is configured as the Master.
After entering Command Mode, assign a custom name:
AT+NAME=MASTERConfigure the role:
AT+ROLE=1Restrict communication to a fixed Bluetooth device:
AT+CMODE=0Finally, bind the Master to the Slave using the Slave module's Bluetooth address:
AT+BIND=xxxx,xx,xxxxxxReplace the address with the one obtained from the Slave module. After configuration, verify the binding using:
AT+BIND?If the returned address matches the Slave device, the modules are ready for wireless communication.
Master-Slave Communication
Once both HC-05 modules have been configured, each module is connected to its respective Arduino board.
When power is applied, the Master automatically searches for the configured Slave and establishes a wireless connection. The Slave waits for incoming commands and responds whenever valid data is received.
In this demonstration, the Master Arduino controls a 12V DC motor connected to the Slave Arduino.
Three push buttons on the Master perform the following operations:
Rotate motor clockwise
Stop the motor
Rotate motor anticlockwise
A potentiometer connected to the Master board adjusts the motor speed by transmitting PWM values to the Slave over Bluetooth.
The communication protocol is intentionally simple.
The Master first checks whether the Slave is available by sending:
*ALIVE#The Slave replies with:
*OK#Motor commands are transmitted using the format:
*DIRECTION_BYTE, SPEED_BYTE#For example,
*1,255#commands the Slave to rotate the motor in one direction at full speed. After executing the command, the Slave returns:
*OK#to acknowledge successful reception.
Hardware Requirements
The demonstration requires two Arduino UNO boards, two HC-05 Bluetooth modules with AT mode support, an L293D motor driver IC, a 12V DC motor or fan, push buttons, a 10k potentiometer, breadboards, jumper wires, and suitable 12V power supplies.
The project can be adapted to many other wireless control applications by replacing the motor driver with relays, LEDs, sensors, or other peripherals.
Master Arduino Connections
The Master Arduino is responsible for generating the motor control commands.
Along with the HC-05 connections described earlier, a 10k potentiometer is connected to A0 to control motor speed. Three push buttons connected to digital pins 5, 6, and 7 select clockwise rotation, stop, and anticlockwise rotation, respectively.
The Arduino's onboard LED connected to pin 13 serves as a communication status indicator. A continuously illuminated LED indicates that the Bluetooth link is active, while a blinking LED suggests communication retries or packet loss, usually caused by excessive distance between the two boards.
Slave Arduino Connections
The Slave Arduino receives wireless commands from the Master and controls the motor using an L293D motor driver IC.
The Bluetooth module is connected in the same way as during the configuration stage. The L293D enable pin is connected to Arduino PWM pin 6, allowing PWM speed control. Arduino pins 8 and 9 drive the two motor direction inputs of the L293D. The motor is connected across the output terminals of the driver, while the motor supply is provided separately through the L293D power input.
To ensure reliable Bluetooth communication, the Arduino and the 12V motor should be powered from separate power supplies, with their grounds connected together. Sharing the same supply can introduce voltage drops during motor startup, causing the HC-05 module to disconnect unexpectedly.
Learn More
For the complete project—including full Arduino source code, detailed AT command explanations, troubleshooting tips, wiring schematics, and downloadable resources—visit the original tutorial on Play with Circuit:
https://playwithcircuit.com/hc05-master-slave-arduino-tutorial/

