← All posts Blog Post

How to Use a Bluetooth Module with Arduino

Viktoria Builds

A quick guide to wiring the HC-05 Bluetooth module to an Arduino Mega and sending messages from an Android phone over serial.

Watch on YouTube

The HC-05 is one of the easiest ways to add wireless control to an Arduino project. I connected it to my Arduino Mega and used an Android app to send messages over Bluetooth — no cables, no Wi-Fi setup needed.

Parts

  • Arduino Mega
  • HC-05 Bluetooth module
  • Jumper wires
  • Android phone with Serial Bluetooth Terminal app installed

Wiring

The HC-05 comes with 6 pins, but you only need four: GND, VCC, TX, and RX. Connect VCC to 3.3V on the Mega, GND to GND, then cross the data lines — HC-05 TX goes to Arduino RX, and HC-05 RX goes to Arduino TX. The Arduino Mega is nice for this because it has multiple hardware serial ports (Serial1, Serial2, Serial3), so the Bluetooth module doesn't share the same port as the USB connection to your computer.

The sketch

The sketch initialises Serial for the USB monitor and Serial1 for the Bluetooth module. In the loop it forwards anything received on Serial1 to Serial, so messages typed in the phone app appear in the Arduino serial monitor. The full sketch is on GitHub: viktoriabuilds/bluetooth-module-arduino.

Pairing and testing

Power on the Arduino, open Bluetooth settings on your phone, and pair with the HC-05. The default pairing PIN is 1234. Then open Serial Bluetooth Terminal, connect to HC-05, and type a message — it shows up in the Arduino serial monitor right away.

Result

It worked on the first try. The HC-05 is cheap, widely available, and surprisingly simple to set up. Good starting point if you want to add wireless control to a project without dealing with Wi-Fi configuration.

Enjoying this tutorial?

Support the channel on Patreon and get early access to projects, build logs, and more.

Support on Patreon →