Arduino Bluetooth Module HC-05 Tutorial

You will learn how to connect Bluetooth module HC-05 to Arduino and how to make wireless communication with Arduino using PC via bluetooth to control a LED

This Arduino Bluetooth Module HC-05 Tutorial shows how to control a LED connected to Arduino Uno by controlling the Arduino microcontroller using bluetooth wireless connection with computer. In particular you will learn how to use HC-05 Bluetooth module. This tutorial should also work with other Bluetooth module like HC-06. Also this Arduino Bluetooth module project is showing simple wireless control of a LED from a computer. The same steps can be followed for more complicated Bluetooth projects.

Bluetooth allows wireless communication between devices. Using computer or cellphone you can control devices such as switch or sensors attached to the Arduino board. In this tutorial we will make a LED blink on and off that is connected to Arduino UNO board using PC with bluetooth wireless communication.

HC-05 bluetooth module

The HC-05 Bluetooth module front and backside are shown below.

As you can see in the figure above there are 6 pins in the module. Not all are required in this tutorial. Now this HC-05 module has to be interfaced with the Arduino UNO board.

Circuit Connection for Arduino Bluetooth Module HC-05 Tutorial

The circuit connection diagram is shown below.

Circuit Connection for Arduino Bluetooth Module HC-05 Tutorial

Notice that a LED is connected to pin 7. Also you can see that we have implemented a voltage divider at the output of Tx pin of the Arduino Uno using 1KOhm and 2.2Kohm resistors. The voltage from the intersection of the voltage divider is fed to the Rx pin of the bluetooth module. This is done because the signal from Arduino Uno is +5V voltage which can damage the bluetooth module because the Rx pin of the bluetooth module can handle voltage upto 3.3V.

The actual physical hardware setup is shown in the figure below.

Arduino Bluetooth Module HC-05 real hardware connection

Connect the hardware as shown and illustrated in the above diagram and in the figure above.

Arduino code for bluetooth module HC-05

The next work is to write the program code for the Arduino Uno microcontroller. The program code is such that the microcontroller on the Arduino UNO will read the incoming message from the Bluetooth module sent from PC. The microcontroller after receiving the message on its Rx pin turns on the LED on or off according to the received message.

The following is the Arduino program code.

Now compile and upload the code into Arduino.

Note that before you compile/upload disconnect the Tx and Rx line as shown below. Otherwise you will get error during upload.

Sending messages for Arduino Bluetooth Module HC-05 Tutorial

The final part of the tutorial is to use port emulator called Tera Term to send 1 and 0 to turn on and off the led and also to view the message as programmed above. Tera term is open source port emulator which you can download for free. A simple google search can help you to download and install it.

Once you have installed Tera Term, configure it to use the serial communication as shown below.

You can find the Com port to use if you go to device manager/Ports(COM & LPT) in your computer. Shown below is the com port used in this tutorial computer.

With Tera Term open, type 1, to turn on the LED. The LED connected to the Arduino should turn on and simultaneously you should get LED ON message on the Tera Term window. Similarly when you type 0 the LED should turn off and you should also get LED OFF message on the Tera Term window.

The following picture shows the turned on LED.

Arduino Bluetooth Module HC-05 Tutorial

See other Arduino Matlab Simulink Tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *