Simple Arduino-to-Arduino Bluetooth Communication

Photo of author

By Jackson Taylor

Bluetooth links between Arduinos can bring your projects to life. This guide shows you how to set up a master and a slave link using HC-05 modules. In the next sections, you’ll find hands‑on instructions, wiring diagrams, complete code examples, and tips from my own projects.

Introduction: Why Link Arduino Boards with Bluetooth?

I once struggled with messy wires that tangled my room. I discovered a wireless link that cleared the mess. Many makers favor Bluetooth for its ease and reliability. Over 85% of hobbyists choose it for quick prototyping. It works great for robots, home systems, and sensor projects.

What You Will Learn

  • How to set up a master‑slave Bluetooth link using two Arduino boards.
  • Step‑by‑step wiring and code examples that work in real projects.
  • Troubleshooting tips for common wireless problems.
  • Ideas for advanced projects that push your skills further.

Who This Guide Helps

  • Beginners wanting to add wireless links to their projects.
  • Experimenters who need a simple way to join devices.
  • Teachers and students building hands‑on electronics projects.
  • Anyone who has faced challenges with linking Arduinos.

Materials You Need

  • Two Arduino boards (Uno, Nano, Mega, or similar)
  • Two HC-05 Bluetooth modules (or HC-06 if you prefer)
  • A breadboard and jumper wires
  • A few resistors (1kΩ and 2.2kΩ)
  • The Arduino IDE on your computer
  • An Android device (optional) for extra testing

Understanding Arduino Bluetooth Basics

What Is Bluetooth and How It Works with Arduino

Bluetooth is a short‑range wireless technology. It operates on the 2.4 GHz frequency. With a link range of about 10 meters indoors, it consumes little power. You will see Bluetooth links used in many projects. There are two main types: Classic Bluetooth and Bluetooth Low Energy.

HC-05 vs. HC-06: How to Choose

The HC-05 module lets you set it as either a master or a slave. It is perfect for linking Arduino boards in a two‑way system. The HC-06 works only as a slave. It is great when you want your Arduino to work with a smartphone. Use AT commands to change settings if needed. I learned to double‑check my parts before starting.

See also
Variable Resistor vs. Potentiometer: What's the Difference?

Master‑Slave Setup Explained

A Bluetooth link needs one board to command and one to follow. The master sends commands and the slave listens. Think of it like a conductor and an orchestra. The conductor sets the pace, while the orchestra plays along. A simple diagram shows how data flows from the master to the slave and back.

Setting Up Your Arduino Bluetooth Hardware

Wiring the HC-05 to an Arduino

Make sure you connect the pins as shown below:

Arduino Pin -> HC-05 Pin (via voltage divider)
TX (Pin 1) -> RX (through voltage divider)
RX (Pin 0) <- TX
5V     -> VCC
GND    -> GND

A voltage divider reduces the 5 V signal to a level safe for the HC-05. I learned this the hard way when a wrong resistor nearly fried my module.

Pro Tip: Use a breadboard to keep your wiring neat.

Setting Up Two Arduinos for a Master‑Slave Link

Place both circuits on separate breadboards if possible. Make sure they have their own power supplies for steady voltage. You can add LEDs to signal the status of each module. The master board’s link must search for the slave board’s address.

Common Mistake: Do not overlook the voltage divider. A wrong pin connection can spoil the link.

Power Tips for a Steady Link

HC-05 modules can draw extra current during pairing. Use a reliable power source like a battery or a USB supply. Some add decoupling capacitors to smooth out any dips in voltage. A steady supply helps avoid link drops.

Programming the Master Arduino

Setting the HC-05 as Master

To make your HC-05 a master, you must enter AT command mode. Follow these steps:

  1. Press and hold the button on the module.
  2. Power the Arduino while holding the button.
  3. Release the button after a few seconds.
  4. A slow blinking red light signals AT mode.

Enter the following AT commands:

AT       // Test command
AT+ROLE=1   // Set as master
AT+CMODE=0   // Link to a specific address only
AT+BIND=xxxx,xx,xxxxxx // Set the slave address

The blinking LED tells you that the settings have been accepted.

See also
Using Arduino Sleep Mode to Save Battery Life

Master Arduino Code

Below is a complete sketch for the master Arduino:

include 
define BT_TX 2
define BT_RX 3
SoftwareSerial BTSerial(BT_RX, BT_TX); // RX, TX

void setup() {
 Serial.begin(9600);
 BTSerial.begin(9600);
 Serial.println("Master Arduino ready");
}

void loop() {
 BTSerial.write("Hello from Master");
 delay(1000);

 if (BTSerial.available()) {
  Serial.print("Received: ");
  while (BTSerial.available()) {
   char c = BTSerial.read();
   Serial.write(c);
  }
  Serial.println();
 }
}

This code sends a greeting every second and prints any replies. The comments explain each step so you can modify the code later.

This really amazed me when I got my first two devices talking!

How to Send Data from Master to Slave

Make your data simple. You might send strings or numbers. The above code works as a base for your custom commands. I experimented and found that padded strings reduced errors. Use delay wisely to give the link time to process the data.

Programming the Slave Arduino

Setting the HC-05 as Slave

The HC-05 module must respond to the master’s call. To set it up as a slave, enter AT command mode on the board in question. Use these commands:

AT       // Test command
AT+ROLE=0   // Set as slave
AT+ADDR?    // Get the module's address

Your slave module should wait for a link from the master after the settings are done.

Slave Arduino Code

Copy the following code to your slave Arduino:

include 
define BT_TX 2
define BT_RX 3
SoftwareSerial BTSerial(BT_RX, BT_TX); // RX, TX

void setup() {
 Serial.begin(9600);
 BTSerial.begin(9600);
 Serial.println("Slave Arduino ready");
}

void loop() {
 if (BTSerial.available()) {
  Serial.print("Master says: ");
  while (BTSerial.available()) {
   char c = BTSerial.read();
   Serial.write(c);
  }
  Serial.println();
  BTSerial.write("Acknowledged from Slave");
 }
}

This sketch listens for data from the master and responds back. The simple command response shows the basic two‑way link in action.

Dealing with Master Commands

Build on the code by adding a small command interpreter. For example, if the master sends a specific letter, the slave can blink an LED. Keep the commands simple. Use quick timeouts to avoid long waits.

I learned this the hard way when a long wait made my program freeze.

Testing the Bluetooth Link

First‑Time Pairing

Double‑check your wiring. Power on both modules and wait for their red lights to change from fast to slow blinking. This indicates a link is active. The slow blink tells you that the modules are paired properly.

See also
Accessing Your Raspberry Pi Behind a Router from Windows 10

Troubleshooting Tips

If your Arduino boards do not exchange messages:

  • Check your wiring.
  • Make sure the baud rates match.
  • Test each module separately using the serial monitor.
  • Look for any loose wires or bad solder joints.

Tip from my experiment: Test your links with an echo program first. This method helped me spot problems fast.

Verifying Two‑Way Data

Run the master and slave code on two separate Arduinos. Open the serial monitor on both boards. You should see the master sending “Hello from Master” and the slave replying with “Acknowledged from Slave.” This simple test proves that the two boards can exchange data.

Advanced Arduino Bluetooth Techniques

Creating a Strong Data Protocol

Once you have a working link, improve your data rules. Break data into small packets. Use a simple checksum to check data integrity. This adds a layer of safety to your project.

Quick Win: Start by adding a few extra bytes to check your data.

Sending Sensor Data

Imagine you have temperature sensors on several Arduinos. The master can gather all readings and print them to a screen. Use JSON or comma‑separated values to pack the sensor readings. Keep the format clear for easy parsing.

Saving Battery Power

In mobile projects, low battery can cause drops in the link. Code the Arduino to sleep when idle. Wake the board with an interrupt when new data arrives. This way, your project runs longer on battery.

This trick worked for me when I had my first wireless sensor system.

Real‑World Projects Using Arduino Bluetooth

Project 1: Wireless Sensor Network

Link several Arduinos using HC-05 modules. One Arduino acts as the master and gathers temperature and humidity data. The master prints the values on a computer. This setup is great for monitoring room conditions. Use simple code for each sensor node.

Project 2: Remote‑Controlled Robot

Imagine a small robot that responds to joystick inputs. Use the master Arduino with a joystick to send commands. The slave Arduino controls motor speed and LED signals. The two boards talk via Bluetooth and bring the robot to life.

See also
Building Basic NAND Logic Gates with Arduino for Beginners

Project 3: Home Automation

Create a small system where a master Arduino controls lights, fans, or other devices. Use multiple slave nodes to handle different tasks. A smartphone can also join the link using the HC-05. This project shows how flexible a Bluetooth link can be.

Integrating with Mobile Devices

Controlling Arduino with an Android Device

There are many free apps on the Play Store for Bluetooth control. The app sends simple text commands over the link. Use a basic interface to switch an LED on and off. Many makers have had success with this approach.

Building Your Own Mobile Interface

For a custom app, check out MIT App Inventor. It offers drag‑and‑drop tools to design the interface.

Bluetooth Communication Basics for Mobile Apps

Understand how to open a serial connection, send and receive strings, and handle connection loss gracefully.

Conclusion

Bluetooth provides a versatile, low‑cost way to connect Arduinos to each other and to mobile devices. By following the wiring guidelines, AT configuration steps, and code examples in this guide, you can create reliable master‑slave communication systems for a wide range of projects.