top of page

Interfacing Bluetooth HC-05 module with Raspberry Pi

Updated: Apr 6

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.


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


Hardware components:


1.Bluetooth Module HC-05 with Raspberry pi:

The IEEE 802.15.1 Standardised protocol is used by this module. It aids in the creation of Wireless Personal Area Networks (PAN), and the gadget uses frequency hopping spread spectrum (FHSS) for data transmission. It employs serial communication as its preferred method of communicating with other gadgets. The module has six pins and may act as either a master or a slave.

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

KEY/EN pin: This pin, designated as KEY/EN, confirms that the module is in AT command mode. There are two modes: data mode and command mode.


DATA MODE: Data transmission and receipt


COMMAND MODE: Use the serial port to transmit commands that can be used to change the settings of the HC-05.


VCC pin: 3.3V power supply. Since the gadget contains a 5V to 3.3V regulator, we can also provide 5V.

GND pin: The module's Ground pin.

TXD pin: This pin transmits serial data.

RXD pin: This pin receives serial data.

The STATE pin shows whether or not the module is paired.


2.Raspberry Pi 3:


To connect to the Bluetooth HC-05 module and show the output, we're using a #Raspberrypi. It has various I/O pins that may be used to connect the module, and when the Raspberry Pi is programmed, we can use it to accept orders and signals received from the mobile device.

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

3.USB Cable:

The Raspberry Pi is connected to the power source via this USB connection. Additionally, it facilitates data transfer

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

4.Jumper wires:


These straightforward connection wires are utilised to join the ends without the utilisation of solder. The receiving end is on the female wires, whereas the male wires have the ends that may connect to other ends. Wires that are female to female are utilised in this interface.

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

Software components:-

1.SSH Terminal:

In this project, the Raspberry Pi module is connected to another computer's terminal using the SHH Terminal.

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

2.Python IDE:

#Python programming is carried out within an IDE (Integrated Development Environment), which is a platform for writing, running, and testing code.

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

CIRCUIT:



Let us examine the connections between the Raspberry Pi device and the Bluetooth interface module in this part.


What goes where?


  • The raspberry pi's 5V (VCC) and the Bluetooth module's VCC are connected through the RED wire.

  • The ground pins of the #HC-05 and the raspberry pi are connected with a BLACK cable.

  • The raspberry pi device's reception pin [RX] and the transmitting pin [TX] of the HC-05 are connected by a BLUE 1 wire..

  • The transmission pin [TX] of the raspberry pi is connected to the receiving pin [RX] of the HC-05 via BLUE 2 wire


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: The instructions in the file below should be followed in order to establish the HC-05 on your system and connect it to the Raspberry Pi.


The rate or speed at which data is exchanged between devices is known as the baud rate. The raspberry pi serial port's default baud rate is 115200 bps, but in order to connect it to #HC05, we must lower it to 9600 bps. There are two possibilities in the file /boot/cmdline.txt: console and kgdboc. They are now designated as,

console=ttyAMAO,9600

kgdboc=ttyAMAO,9600

We must use the SUDO command to modify the file. The two text editor commands are VI and PICO. Finally, in order to modify the file, we must run the following command.

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:

The BLUETOOTH TERMINAL HC-05 or BLUETERM app may be installed when the device boots up so that we can send data from our mobile device to the Bluetooth module HC-05 and examine the results on the Raspberry Pi terminal. The Bluetooth module's 1234 default PIN is used. Once a connection has been made, the HC-05's LED won't stop flashing and will stay on. With the aid of an integrated Bluetooth module, the data input in the mobile application is sent to the end terminal.


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








Video credits: Sai Parimal

Check the Project Working video here - Interfacing Bluetooth HC-05 Module with Raspberry Pi

The Raspberry Pi provides greater benefits compared to other development boards, yet this interface may also be done with Arduino or other boards. It includes built-in Bluetooth and wireless LAN capabilities, allowing for wireless communication, which is crucial in the context of the Internet of Things.


See also:


Related Posts

See All

4 comentários


Anushka Gupta
Anushka Gupta
01 de ago. de 2023

I thoroughly enjoyed going through this article by Learn Electronics India. Not only did I learn how to interface the HC-05 module with Raspberry Pi, but the explanations also gave me a deeper understanding of the underlying concepts. The practical tips and real-world examples were incredibly valuable. My heartfelt appreciation to the author for sharing their expertise and passion for electronics with the world.

Curtir

Informative and concise! LearnElectronics India always delivers quality content.

Curtir

Kleyder Morán Flores
Kleyder Morán Flores
21 de set. de 2021

usefull!!!

Curtir

matheus zacarias
matheus zacarias
04 de set. de 2021

Your raspberry is a 3B, 3B+ or 3A+? every pi3 it works?

Curtir
bottom of page