Implementation of Wireless Communication using (HC-05) Bluetooth Module with MATLAB GUI

DOI : 10.17577/IJERTCONV10IS07017

Download Full-Text PDF Cite this Publication

Text Only Version

Implementation of Wireless Communication using (HC-05) Bluetooth Module with MATLAB GUI

Jiban Saha1, Joy Natp, Dr. Anirban Karmakar3

1Student, Department of Electronics and Communication Engineering, Tripura University, Agartala. 2 Student, Department of Electronics and Communication Engineering, Tripura University, Agartala. 3Faculty, Department of Electronics and Communication Engineering, Tripura University, Agartala.

Abstract: With the increasing development of modern technology, Bluetooth has revolutionized the way we communicate. Bluetooth is a wireless data exchange technology that provides a platform for convenience and controllability over a short distance. Wireless communication is an emerging tool of todays era to several wireless communication protocols, it has a broad spectrum of applications due to its wireless characteristics. Having the characteristic of low power consumption, low cost, peer to peer communication short range communication become more advantageous to others. In this work, we will discuss one of its applications, namely Wireless Communication using HC-05 module, which is controlled by using Software based system MATLAB, used for transferring the data from one device to another device but also used to control the device wirelessly. Nowadays, almost every electronic device has Bluetooth capability, therefore include Bluetooth control in your embedded programme is a sensible decision. It is a working prototype of a wireless communication system that uses data commands to control ON and OFF LED. The control of the LED ON and OFF is achieved by the simple use of an efficient control system based on the Arduino microcontroller board, the HC-05 and the MATLAB GUI. The results indicate that by using simple wireless communication as a control mechanism. It work on nominal voltage 5v with 2.1 Mbps transmission data rate within operating range of 10 meters.

Keywords-Wireless communication; Bluetooth module(HC- 05); Arduino Interface; Arduino UNO; MATLAB GUI


    The HC-05 Bluetooth module is the primary tool used in this paper. Bluetooth serves as the gateway for data transmission from one device to another. Bluetooth technology uses a spread spectrum, frequency hopping, full-duplex operation to operate in the unlicensed industrial, scientific, and medical (ISM) band between

      1. and 2.485 GHz. Most regions has access to the 2.4 GHz ISM band, which is unlicensed. Bluetooth has a range of 5 to 30 meters. Bluetooth has a 200ms latency. Bluetooth's bit rate is 2.1Mbps. The BSIG is in charge of Bluetooth, and it has over 19,000 members in the telecommunication, computer, networking, and consumer electronics industries. In embedded systems, it is the most widely used and basic protocol for short-range wireless communication. It is used to not only send data between devices, but also to control them wirelessly. Nowadays,

        almost every electrical device has Bluetooth capability, therefore including Bluetooth control in your embedded programme is a sensible decision. Bluetooth is a wireless data and voice communication open standard. As a standard for short-range wireless communications, Bluetooth technology is widely used in the field of wireless communication as personal communication devices and wireless networks systems of communication and transmission, because to its inexpensive cost, low power, tiny size, and other features. Embedded computer systems and wireless communication applications are combined in the intelligent and multimedia trend. Both wide-area mobile communications and technology for short-range communication have become increasingly obvious. In the information society, they have played a crucial role. The HC-05 serial Bluetooth module works with a voltage range of 4 to 6 volts. The HC-05 module sends data serially, resulting in improved signal quality, communication speed, and so on.

        9600, 19200, 38400, 57600, and other baud rates are supported by it. It can also be used in Master-Slave mode, which implies it won't send or receive data from other sources. The above schematic representation of a basic wireless communication system. It is made up of the MATLAB Software, which processes the data and transmit it wirelessly to the Bluetooth module HC05.

        Fig 1 Flowchart of wireless communication

        We'll learn how to utilize Bluetooth in MATLAB to interact wirelessly in this lesson. With MATLAB, we'll use the computer's built-in Bluetooth on the one hand, and an HC-05 with an Arduino on the other. The command window andthe

        MATLAB GUI are both options for setting up Bluetooth connectivity between MATLAB and Arduino. Both methods use same Arduino code.

        • HC-05 Module Interact with MATLAB

          This is a suitable method for connecting Arduino and MATLAB over Bluetooth. In this case, MATLAB makes use of the laptop's bluetooth to link the HC-05 to the Arduino. To begin, we first programme the Arduino to read serial data from the MATLAB (through Bluetooth on the laptop).

          Then, using the Bluetooth data from MATLAB, you can control anything linked to the Arduino. An LED will be connected to an Arduino and used MATLAB to control it from a PC. The command fprintf(B,'g') is used in the code below to turn on the LED by passing 'g' to the Arduino. The command fprintf(B,'h') is used in the code below to turn off the LED by passing 'h' to the Arduino. fopenf(B) to makethe bluetooth port accessible.

        • HC-05 Module Interact with MATLAB GUI Two graphical buttons in MATLAB to turn on and turn off to demonstrate Bluetooth Communication using MATLAB GUI, the Arduino is linked to an LED. When the graphical buttons are clicked, data will be transferred over bluetooth from MATLAB to the HC-05. The code for receiving Bluetooth sent data from MATLAB to HC- 05 and operating the LED based on the data received is contained in Arduino. And that therefore instead of delivering data 'g' and 'h' through the MATLAB, the same data will now be transmitted by clicking on two graphical buttons.

          Fig 2 Push Buttons

          To resize or modify the form of the pushbuttons, simply click on them and drag the corners. You may alter the colour, string, and tag of a given pushbutton by double- clicking it. As illustrated in the image below, we modified twopushbuttons.

          Fig 3 Modified Push Buttons

          You may modify the buttons to your choice. When you save this, MATLAB will create a code in the Editor window. Using the MATLAB GUI, modify this code and run the function you want your Arduino to execute while receiving Bluetooth data. As a result, the MATLAB code has been modified below. More information about the Command window, the Editor window, and other windows may be found in the MATLAB Basics. At the end of this project, you will get the whole MATLAB code for controlling leds from MATLAB over Bluetooth.

          fopen(bt) = Access the Bluetooth port for transmitted data. As you go down, you'll notice that two functions have been built for two pushbuttons in the GUI. Now, in the functions, put the code for the task you want to execute on click. To turn on the LED, copy and paste the following code into the LED ON button's function shortly before the end. fprintf(bt,'g') is used in the following code to communicate 'g' from MATLAB to HC-05 through Bluetooth. The data 'g' will be received by Arduino through HC-05, and the LED will be ON

          by setting the Arduino's 7th pin to HIGH. To turn off the LED, copy and paste the following code into the LED OFF button's function shortly befor the end. fprintf(bt,'h') is used in the following code to communicate 'h' from MATLAB to HC-05 through Bluetooth. The data 'h' will be received by Arduino through HC-05, and the LED will be OFF by setting the Arduino's 7th pin to LOW.

          Simply click the run button to execute the untitled code in the m.file after completing the MATLAB GUI coding. When you're ready, press the LED-ON, LED- OFF buttons to turn the LED on and off.

  2. Implementation Outline

The Wireless Communication consists of three key components, the HC-05 Bluetooth Module, Arduino UNO and MATLAB Software.

        • Arduino UNO ATmega328P

Fig 4 Arduino UNO

Operating Voltage:- 5V I/P and O/P Current:- 40mA Memory:-32


StaticRAM:- 2Kb EEP ROM:- 1Kb

Clock Speed:- 16MHz

The Arduino board's 5V pin serves as a regulated power supply voltage, powering both the board and on-board components. The 3.3V pin on the Arduino board is used to deliver a 3.3V supply provided by a voltage regulator on the board. The Arduino board is grounded via the GND pin. The microcontroller is reset via the RESET pin. ANALOG PIN (A0-A5) is an analogue input/output pin that ranges from 0 to 5V, DIGITAL PIN (D0-D13) is used as digital i/p or o/p for the Arduino board. The SERIAL PIN, sometimes called a URAT pin, is used to communicate between an Arduino board and a laptop or any other device. The data response is transmitted and received via the TxD and RxD pins. EXTERNAL PIN(2&3) is used to generate an external interrupt, and pins 2 and 3 are utilised to do so. PWM PIN is used to transform a digital signal to an analogue signal by altering the pulse width. The PWM pins utilised are 3,5,6,9,10, and 11.

This same serial peripheral Interface pin (SPI PINS) is needed to keep SPI communication running with the use of the SPI library..


  1. SS:- Slave selection is done using pin number 10.

  2. MOSI:- The Master out Slave in pin 11 is implemented. 3.MISO:- The Master out Slave in pin 12 is implemented. 4.SCK:- Serial clock is used on pin number 13.

    In pin number 13, an LED PIN is an in-built LED. AREF is an analogue reference pin on the Arduino board, and the LED only lights up when the digital pin is high. It's used to get a reference voltage from a separate source.

    • Bluetooth Module HC-05

      Fig 5 Bluetooth Module HC-05

      Bluetooth communication is a useful technology since it has a range of 100 meters. The Bluetooth serial port module is completely certified, including the 2.4GHz radio transceiver and baseband. Modulation 3Mbps Bluetooth V2.0+EDR (Enhanced Data Rate). It has a CSR Bluecore 04-External single chip Bluetooth system using CMOS technology and an

      AFH antenna (Adaptive Frequency Hopping Feature). It features a 12.7mmx27mm footprint.

      The system is simply simplified with this minimal Bluetooth module architecture. e TxD and RxD Serial pins on the Arduino Uno board may be used to connect the simple interface module to the board. The module can be connected to an Software Based System by the means of the Software application- MATLAB.

      Hc-05 Bluetooth module contains 6 pin are:- State, RxD, TxD, GND, VCC and Key

      • HC-05 Interface with Arduino UNO

        Arduino UNO

        HC-05 Bluetooth

        Digital pin 1(TxD)


        Digital pin 0(RxD)






        Fig 6 Arduino Interface Bluetooth(HC-05)

      • HC-05 Bluetooth Specifications


        2.4GHz ISM band



        Emission Power





        Authentication & Encryption

        Power Supply

        +3.3VDc 50mA

        Working temp

        -20~ +75 degree Celsius


        26.9mm x13mm x2.2mm

      • MATLAB GUI

        A Graphical user interface (GUI) is a visual interface that enables a user to interact with a computer without having to understand its language. This is accomplished through the use

        of user-friendly controls. The controls are the buttons that a user presses to get a certain result. A graphical user interface (GUI) is a software that is triggered by external events. This is due to the fact that it accepts input at any moment and executes the programme and returns results via callback functions. MATLAB creates the code for a graphical user interface. As a result, it's a superior tool for creating the user interface for engineering components.

        Fig 7 Circuit Diagram Wireless Communication using (HC-

        05) Bluetooth Module with MATLAB GUI.


The Software programme on the PC/Laptop is used to identify data instructions in this system. The microcontroller receives the processed data through Bluetooth via MATLAB. The data is then processed by the microcontroller, which turns the LEDs on and off. The following is the method for using wireless communication.

  1. Download and install the software Arduino IDE, MATLAB on the PC/Laptop.

  2. Then turn on your computer's or laptop's Bluetooth and pair with the HC-05. (For pairing, the default password is either 0000 or 1234)

  3. After successfully paired, go to MATLAB Software and assess Section fopen(B) after successfully executed the Bluetooth linked with MATLAB.

  4. The Arduino UNO accepts the data and subsequently turns on and off the LEDs.

Fig 8 Practical Implementation of Wireless Communication using (HC-05) Bluetooth Module with MATLAB GUI


In this MATLAB project, we will learn how to construct a communication link between the devices using Bluetooth and MATLAB. To properly understand the project, we will learn various features of the MATLAB language. Prior knowledge of networking and MATLAB essentials is required for this assignment. The new era is evolving, and we need to study modern languages in order to handle modern difficulties in computer science. MATLAB is an example of a programming language that can help you learn and explore new things.


[1] Uysal, Ziya, et al. "A Heart Rate Montoring Applicaton Using Wireless Sensor Network System Based on Bluetooth Wth Matlab GUI." International Journal of Engineering Science 2862 (2016).

[2] Le, P. T., Tsai, H. L., & Lam, T. H. (2016). A wireless visualization monitoring, evaluation system for commercial photovoltaic modules solely in MATLAB/Simulink environment. Solar Energy, 140, 1-11.

[3] Prabha, D. R., Swaminathan, R., Chaitanya, K., & Sultana, W.

R. (2019). Arduino Based Smart Irrigation System and Plant Leaf Disease Detection Using MATLAB. International Journal of Mechanical Engineering and Technology, 10(12).

[4] Joseph, A.K., Bousbaine, A. and Fareha, A., 2018, September. A Wireless communication system for a quadrotor helicopter. In 2018 53rd International Universities Power Engineering Conference (UPEC) (pp. 1-5). IEEE.

[5] Shantala, C. P., and C. R. Rashmi. "Mind controlled wireless robotic arm using brain computer interface." 2017 IEEE International Conference on Computational Intelligence and Computing Research (ICCIC). IEEE, 2017.

[6] Gujarathi, T., & Bhole, K. (2019, July). Gait analysis using imu sensor. In 2019 10th International Conference on Computing, Communication and Networking Technologies (ICCCNT) (pp. 1-5). IEEE.

[7] Ambati, S. R. (2020). Real-Time Impleentation of PID Controller for Cylindrical Tank System Using Short- Range Wireless Communication. Modelling, Simulation and Intelligent Computing: Proceedings of MoSICom 2020, 659, 430.

[8] Ananda, R. and Amin, M., 2020, August. CONTROL OF A ROBOT CAR WITH TWO COMMANDS VIA HC-05. In

International Conference on Social, Sciences and Information Technology (Vol. 1, No. 1, pp. 71-76).

Leave a Reply