Introduction: Getting Started With HC05 Bluetooth Module & Arduino [Tutorial]

About: Passionate about electronics parts and tutorials. We're your go-to source for high-quality components and expert guidance. Join us on our journey of exploration and innovation in the world of electronics.

You can read this and other amazing tutorials on ElectroPeak's official website

In this tutorial, you will learn how to communicate and send data with Bluetooth using HC05 Bluetooth Module and Arduino board. At the end of this article, you will learn:

  • General information about Bluetooth protocol
  • How to send data using Bluetooth
  • How to send AT-Command to HC05

Step 1: A Brief Introduction to Bluetooth Communication and Protocol

There are several ways for wireless communication such as NRF, ZigBee, Wi-Fi, and Bluetooth.

Bluetooth protocol; an affordable communication method in PAN network, with a maximum data rate of 1Mb/S, working in a nominal range of 100 meters using 2.4 G frequency is a common way of wireless communicating.

HC05 module is a Bluetooth module using serial communication, mostly used in electronics projects.

HC05 Bluetooth module important specifications:

  • Working voltage: 3.6V – 5V
  • Internal antenna: Yes
  • Automatic connection to the last device: Yes

Step 2: Sending Data to Arduino Via Bluetooth

HC05 module has an internal 3.3v regulator and that is why you can connect it to 5v voltage. But we strongly recommend 3.3V voltage, since the logic of HC05 serial communication pins is 3.3V. Supplying 5V to the module can cause damage to the module.

In order to prevent the module from damages and make it work properly, you should use a resistance division circuit (5v to 3.3v ) between arduino TX pin and module RX pin. When master and slave are connected, blue and red LEDs on the board blink every 2seconds. If they aren’t connected, only blue one blinks every 2 seconds.

Step 3: Circuit

Step 4: Code

In order to communicate with HC05 using Bluetooth, you need a Bluetooth terminal application on your phone. You can use this one.Now for start transferring data, upload this code on your Arduino and connect HC05 using the app you have just installed. Communication name is HC05, the password is 1234 or 0000 and the transfer baud rate is 9600 by default.

Let’s take a deeper look at the code and see what each line means:

#include "SoftwareSerial.h"

library you need for software serial communication. You can download it here.

SoftwareSerial MyBlue(2, 3);

Software definition for serial pins; RX2 & TX3

MyBlue.begin(9600);

Configuring software serial baud rate at 9600

Reading serial data and Turning LEDs On/Off accordingly.

Step 5: Sending AT-Commands to HC05 Bluetooth Module

By pressing and holding the button the module switches into AT-command mode. Otherwise, it works in the communication mode.Some modules have a push button in their packages and there is no need to add one anymore.The default baud rate to enter At-command mode is 38400. Now upload this code on your board and set commands using Serial Monitor.

You will receive the RESPONSE by sending a COMMAND to the module. Here are some of the most important AT commands:

Step 6: Buy HC05 Bluetooth Module