Bluetooth module HC 05 interfacing with pic microcontroller


Bluetooth module HC 05 interfacing with pic microcontroller: Hi Everyone, In this article I will explain you how to interface Bluetooth module HC 05 with pic16f877a microcontroller or any other microcontroller like 8051, AVR and Arduino. It is very easy to communicate with android mobile through Hc 05 Bluetooth module. It has many applications and this Bluetooth module Hc 05 is very popular in engineering students. Many students use this module in their microcontroller based projects. Examples of most popular Bluetooth based project are robot control through android mobile and home automation system. You can also use it to measure solar energy on your sell phone through android application.

Introduction to Bluetooth module HC 05

So lets start with basic introduction of Bluetooth module Hc 05. It has single chip on board integrated circuit based on CMOS technology.It has upto +4dBm transmission power.It has wide operating voltages between 3.6 to 6 volt. Default baud rate of this device is 9600. But you can change it according to your requirement by using AT commands. I will explain later how to use AT commands of this bluetooth module. HC 05 work on serial communication. It communicates with microcontroller through UART communication. So you should know how to use serial communication of pic microcontrollerIf you know serial communication programming of pic16f877a controller you can easily interface this module and write a program in C.Bluetooth module HC 05

Bluetooth module HC 05 pin out

pin out of Hc 05 module is given below. As you can see it has six pins. All these pins has specific functions. You can check data sheet of this module to know more about functionalities of these pins. you will need to use only  Vcc, ground, TXD and RXD pin of this Bluetooth module HC 05 to interface it with pic microcontroller. Explanation of all these pins are given below:

  • KEY pin:  This pin is used to enter AT commands. If this pin is connected with ground or no connection, you can simply use it pair it with devices. if it is connected with high logic, it will use to enter in AT commands.This pin is used to remove information stored in hc 05 bluetooth module about paired devices.
  • State pin: It is of no use. It just shows the status of device.
  • Vcc pin: It is a power supply pin. You should connect 5 volt with this pin.
  • Ground pin: Connect ground pin of power supply to this pin.
  • TXD pin: This is data transmission pin. You should connect RXD pin of microcontroller with this pin.
  • RXD pin: This is data receiver pin from microcontroller. you should connect TXD pin of microcontroller with this pin.

Bluetooth module HC 05 interfacing with pic microcontroller

circuit diagram of Bluetooth module interfacing with pic microcontroller is given below:

Bluetooth module HC 05 interfacing with pic16f877a microcontroller

In above we have simply connected RXD pin of microcontroller with TXD pin of Hc 05 BT module and TXD pin of microcontroller with RXD pin of HC 05 BT module. When you turn on BT module by providing power supply to it, it will become searchable by other BT devices. For example with your android mobile you can search for available devices.  It will be available with the name of HC 05. Now you can pair with it. When you try to pair with Bluetooth module Hc 05 first time, you will have to enter a password. Default password for this device is 1234. You can also change the password by using AT commands of this module. Once you are done with pairing of your mobile with hc 05 BT module . Now you can send and receive data from android mobile to BT module through microcontroller and vice versa. you can install any Bluetooth terminal app on your android mobile to send and receive data. you can try this android BT device.

LED control with Bluetooth module Hc 05 sing pic microcontroller

Below is a video in which I explain how to interface it with pic microcontroller and how to use to control LED’s connected with microcontroller.

Solar energy measurement on android app using pic microcontroller

Below is video lecture on how to measure solar energy on android app using microcontroller and HC 05 Bluetooth module. In this project, I have measured solar energy with pic microcontroller and send it to android app using BT module.

Code of Bluetooth module interfacing with pic microcontroller

Below is code to send different strings to BT module every one second.

int voltage, current, power;
void main() {
 UART1_Init(9600); // Initialize UART module at 9600 bps
 Delay_ms(100); // Wait for UART module to stabilize

 UART1_Write_text("voltage = 5.1 Volt\r\n");
 UART1_Write_text("current = 0.5 Ampere\r\n");
 UART1_Write_text("Power = 2.5 watt\r\n");



So this is how we can interface HC-05 Bluetooth module with pic microcontroller. you can easily use it in your embedded systems projects. If you have any issue let me know with your comments. thanks.


  1. Natali February 18, 2017
  2. nahom February 26, 2017
  3. tany September 26, 2017
  4. Devesh January 31, 2018

Add Comment

Subscribe to our blog to get updates in your email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,480 other subscribers