top of page

Interfacing Bluetooth HC-05 module with Raspberry Pi

Updated: Jun 23

Have you ever wondered how data is transferred between the devices without any physical contact? You would have shared many songs among your friends without the use of the internet. It's because of this module called #Bluetooth. While proceeding you will know about how the Bluetooth works? Which signal is carrying the data? The transferred data can be viewed using #raspberrypi as an output terminal.


The interfacing is pretty simple and can be used as a reference for various projects in the future. This article briefly explains the process involved in #interfacing. Starting from the list of required components.


List:

The following list provides the hardware and software components required to perform this interfacing.

Hardware components:


1.Bluetooth Module [HC-05]:

This module follows the IEEE 802.15.1 Standardized protocol. It helps us to construct Wireless Personal Area Network (PAN) and for the transmission of data, the device employs frequency hopping spread spectrum (FHSS). To interact with other devices, it uses the mode of serial communication. The module consists of 6 pins and it can be operated either in master or slave configuration.

bluetooth hc 05,hc 05 bluetooth module ,hc 05 bluetooth module price hc 05 ,bluetooth module arduino
HC-05

KEY/EN pin: This pin ensures that the module is in AT command mode. It consists of data mode and command mode.


DATA MODE: Transmission and reception of data


COMMAND MODE: Execute the commands that help in changing the configurations of HC-05 and transmit those commands to the serial port is used.


· VCC pin: Power supply 3.3V. We can also supply 5V since the device has 5V to 3.3V regulator.

· GND pin: Ground pin of the module.

· TXD pin: Transmits the serial data.

· RXD pin: Receives the serial data.

· STATE pin: It indicates whether the module is paired or not.


2.Raspberry Pi 3:


We are using #Raspberrypi to connect with the Bluetooth HC-05 module and display the output. It contains several I/O pins using which we can connect the module and then by coding the Raspberrypi, we will receive the commands/signals that are sent from the mobile.


raspberry pi 3 b+,raspberry pi 3,raspberry pi 3 model b,raspberry pi 3 model b+

3.USB Cable:

This cable is used to connect the Raspberrypi to the power supply. It also helps in the transmission of data.

usb cable,micro usb cable,usb type c cable,usb extension cable

4.Jumper wires:


These are simple connecting wires, that are used to connect the ends without any soldering. The male wires have the ends that can be connected to other ends and the female wires are the ones that have the receiving end. In this interfacing, female to female wires is used.


jumper cables,jumper wires price,male to male jumper wires,electrical jumper

Software components:-

1.SSH Terminal:

The SHH Terminal is used in this project to connect the Raspberry pi module to the terminal of another computer.

ssh,ssh full form,what is ssh,ssh port,ssh command

2.Python IDE:

#Python Programming is done in an IDE (Integrated Development Environment) is a platform where we can write the code, run, and test the working.

python,python compiler,in python,python code,python online

CIRCUIT:


circuit diagram,electric circuit,what is an electric circuit,electric circuit diagram,,what is a circuit

In this section, let's see the connections made to the interface Bluetooth module to the Raspberry pi device.


What goes where?

  • The RED wire connects the VCC of the Bluetooth module to the 5V (VCC) of the raspberry pi.

  • · BLACK wire connects the ground pin of #HC-05 to the ground pin of the raspberry pi.

  • ·BLUE 1 wire connects the transmitting pin [TX] of HC-05 to the receiving pin [RX] of the raspberry pi device.

  • · BLUE 2 wire connects the receiving pin [RX] of HC-05 to the transmitting pin[TX] of the raspberry pi.


After establishing the connections, the power supply is given to the devices and raspberry pi gets boot up.

pi,raspberry,raspberry pi 4,raspberry pi 4,what is raspberry pi

Note: To setup HC-05 on your system and interface it with Raspberry Pi, follow the instructions mentioned in the file below.


Baud rate is nothing but the speed or rate at which data is being transmitted between devices. The default baud rate of the raspberry pi serial port is 115200 bps but we need to reduce it to 9600 bps in order to interface it with #HC05. File /boot/cmdline.txt contains two options, they are console and kgdboc. Now they are reassigned as,

console=ttyAMAO,9600

kgdboc=ttyAMAO,9600

To edit the file we have to use the command called SUDO. VI and PICO are the two text editor commands. So finally, we have to run the following command for editing the file.

sudo pico /boot/cmdline.txt

These are the steps involved in interfacing HC-05 with raspberry pi.


CODE:



Note: This file is in the text format and should be converted to python-format (.py) before downloading.


Working:

After the device gets a boot-up, We can install an app named BLUETOOTH TERMINAL HC-05 or BLUETERM so that, we can transfer the data from our mobile on to the Bluetooth module HC-05 and we can view the output on the raspberry pi terminal. The default PIN number of the Bluetooth module is 1234. Once the connection has been established, the LED of HC-05 will not stop blinking and remain lit. The data which is entered in the mobile application gets transferred to the end terminal with the help of an interfaced Bluetooth module.

hc 05 bluetooth module,bluetooth kit,hc 05

The given input data now gets displayed on the raspberry pi terminal.

pi,raspberry,raspberry pi 4,what is raspberry pi

The Practical implementation of this interfacing is presented here as a video.


Video credits: Sai Parimal

This interfacing can also be performed with Arduino or other development boards but raspberry pi has more advantages when compared to others. It has wireless LAN and in-built Bluetooth facility by which we can achieve wireless connectivity and this plays an important role in the field of the Internet of things.


See also:


Article on interfacing 4*4 keypad with raspberry pi

Smart lighting system- using LED's, LDR and raspberry pi

Interfacing a Buzzer with Arduino Board

6,279 views4 comments

Related Posts

See All
bottom of page