HC-05 Bluetooth Interfacing with PIC Microcontroller | PIC18F452
Hi..!!!
Welcome to Embedded World. Today we talk about how to interface HC-05 Bluetooth with PIC18F452 Micro-controller or any micro-controller. HC-05 module is mostly used in bluetooth based project. Its operating voltage is 3.6V to 6V and defaylt baud rate is 9600. But we can change it as per our requirements by using AT command.
HC-05 works on serial communication. It communicate with microcontroller through UART communication.
It is six pin device, where we only used VCC, GND, RXD, TXD. For changing Baud rate we used KEY pin and STATE pin not used, its only for status of device.
When we give supply to HC-05, it will become searchable by other bluetooth device. for 1st pairing it ask for password, default password is 1234. we can also change its password bt AT command. Once pairing done, we can send and receive data bluetooth device to HC-05 module through microcontroller and vice versa. For that we can install any bluetooth terminal app on our android phone. In this tutorial i used Bluetooth Terminal app.
1) Circuit Diagram
In above circuit we simply connect RXD pin of controller to TXD pin of HC-05 module and TXD pin of controller to RXD pin of HC-05 module. And at PORT D we connect LED.
2) Coding
Algorithm
1] Declare variable for communication
2] set controller communication pin
3] Declare PORT D as a output PORT
4] Initialise uart communication
5] set baud rate 9600
6] store initially zero to uart
7] received data till flag is high
8] read received data
9] compare received data
3) Simulation Result
For showing simulation result, here we used proteus virtuual terminal. whatever data write on virtual terminal, it will be received by controller through receiver pin.
when received character is '1' send logic high to PORT D, that makes LED turn on, and when received character is '0' send logic low to PORT D, that imakes LED turn off.
4) Burn Hex File
For loading program on controller I used PICkit3 Programmer. buy it from Amazon at RS.1100.
5) Hardware Output
For hardware implementation I used my PIC Development board. you can also used your board or just making simple connection on breadboard as per circuit diagram. Here we used external power source from 12Vac adapter then further it can be converted to 5V supply using rectifier and LM7805 and further provided to PIC MCLR pin and HC-05 module. whatever data send by bluetooth terminal app, it will received by HC-05 and further feed through micro-controller, and then as per received data micro-controller takes action. In our case it control LED ON/OFF.
Download Here...!!!
You can download project hex file, proteus file, simulation, code, mikroc etc files here....
If you want to design your PIC Development Board, here its all required data, download and make your project..... ALL THE BEST !!!!
If you have any doubts, quires, suggestions for me please comment below or contact me on my number.
...Thanks For Visiting...