Introduction: Connecting HC-05 Bluetooth Module to Arduino

About: TechDepot Egypt is an online retail store that sells the components to bring your electronics projects ideas to life. We are not just components sellers but we are as well technology lovers and hobbyists. We a…

The HC-05 Bluetooth module is an excellent interface for communicating with your mobile. It has a great data transfer rate and very easy to implement.

In order to try this tutorial out you will need the following:

- Any Arduino board you like and if you don’t already have one check this out

- Grab a breadboard similar to any one of these

- Get yourself one of the HC-05 Bluetooth Modules, if you don’t already have one then grab one from here

- 2 Resistors, 2K Ohm and 4.6K Ohm

- Finally grab some Dupont jumper wires or use normal wires if you are comfortable with that

It is worth noting that the HC-05 power in (Vcc) uses 5V, while the transmit and receive (TXD and RXD) logic signal uses 3.3V. Accordingly sending signals from the HC-05 module to Arduino is ok as the Arduino I/O pins can safely receive up to 5V but the issue is when Arduino tries to send the data to the HC-05 with signal level 5V, in this case it is required to use a voltage divider as we will see during the tutorial.

Also, it worth noting that the above links are for those of you guys living in Egypt, still, for those of you living abroad and want to get the components you can either drop us an e-mail to see if we can ship the components out to you or try

- For Arduino OSOYOO Mini USB Nano V3.0 ATMEGA328P Module CH340G 5V 16M Micro-controller board for Arduino

- For Breadboard Solderless Plug-in BreadBoard, 830 tie-points, 2 Power lanes, 200PTS, 16.5 x 5.4 x 0.85 cm

- For HC-05 JY-MCU Arduino Bluetooth Wireless Serial Port Module

- For Dupont Gikfun 3 x 40P 20cm Dupont Wire Jumper Cable 2.54 1P-1P Male-Male/Female-Female/Female-Male EK8403

Step 1: Check Breadboard Power Rail Consistent Connectivity

Get 2 dupont jumper cables, connect 1 at the rail start and one at the rail end. Now grab your voltmeter and set it on Ohm or connectivity measuring mode then connect the tips to the end of the jumper cables. Make sure that the rail is consistent.

Step 2: If Your Breadboard's Power Rail Connectivity Is Continuous You Can Skip This Step

If the power rail connectivity is not consistent then consider using jumper wires to fix that.

Step 3: Arduino Nano Connection

Connect the Arduino Nano and connect its 5V out and GND to power rails as depicted in the image above.

Step 4: Connect the HC-05 Bluetooth Module

Now let’s connect the HC-05 and its power sockets. Vcc to the Arduino 5V and GND to Arduino GND.

Step 5: Connect the Bluetooth Module TxD

Next we will connect the HC-05 TXD (this is the pin where all data received from the mobile will be transmitted via it to Arduino) to Arduino pin D3.

Step 6: Connect the Bluetooth RxD Module Using the Voltage Divider

Now we will have to connect the HC-05 RXD. First we need to establish a voltage divider using the 2K and the 4.6K ohm resistors. First connect one end of the 2K resistor to Arduino D2 pin, the connect the other end to any unused line in the breadboard, then into this line connect the 4.6K resistor and the other end to the GND. See the image above.

Connect a dupont jumper originating from the centre point between the 2 resistor and connect it to the HC-05 RXD.

Step 7: Create the Arduino Sketch

You are all done now with the hardware work. Let’s move to programming. Grab you USB cable and connect the Arduino to your laptop and use the code below:

#include <SoftwareSerial.h>

// Define the data transmit/receive pins in Arduino

#define TxD 2

#define RxD 3

SoftwareSerial mySerial(RxD, TxD); // RX, TX for Bluetooth

void setup() {

mySerial.begin(9600); // For Bluetooth

Serial.begin(9600); // For the IDE monitor Tools -> Serial Monitor

// Any code that you want to run once....


void loop() {

// put your main code here, to run repeatedly:

boolean isValidInput; do { byte c; // get the next character from the bluetooth serial port

while ( !mySerial.available() ) ; // LOOP...

c =; // Execute the option based on the character recieved

Serial.print(c); // Print the character received to the IDE serial monitor

switch ( c ) {

case 'a': // You've entered a

// Do the code you need when 'a' is received.....

mySerial.println( "You've entered an 'a'" );

isValidInput = true;


case 'b': // You've entered b

// Do the code you need when 'a' is received.....

mySerial.println( "You've entered an 'b'" );

isValidInput = true;



// Do the code you need when any other character is received.....

mySerial.println( "Please enter 'a' or 'b'" );

isValidInput = false;



} while ( isValidInput == true ); // Repeat the loop


Step 8: Congrats, You Are All Done :)

Oh, forgot to tell you, download and use BT-Term (S2 Terminal for Bluetooth) downloadable from the Google PlayStore to send characters to your module

Hope this tutorial helps!