HC-05 Bluetooth Module Working Principle Tutorial

What is Bluetooth?

         Bluetooth is short-range communication technology. The Bluetooth name is taken from the 10th-century Danish king Herald Blatant. Who combined Denmark and Norway.

          Usually, when two electronic devices communicate with each other, they use cables, infrared rays, WiFi, etc. These are some of the various complicated methods used in connecting one device to another. Bluetooth is a similar technology, which is used to connect one electronic device to another, without the usage of any wires and cables. It is a wireless technology to send and receive data between two devices.

Coinage of the term Bluetooth

          The etymology of the word Bluetooth is interesting. An interesting fact about Bluetooth technology is that it is named after King Harold Bluetooth, who was the King of Denmark during the 10th century. It was him who united countries like Denmark and Norway. The name Bluetooth was chosen for the technology because it is countries like Denmark which dominate the Bluetooth communication industry. Another reason for the naming is that Bluetooth technology integrates two electronic devices just as King Bluetooth did in the late 9th century.

How does Bluetooth technology work?

          Bluetooth Network consists of a Personal Area Network or a piconet which contains a minimum of 2 to a maximum of 8 Bluetooth peer devices- Usually a single master and up to 7 slaves. A master is a device that initiates communication with other devices. The master device governs the communications link and traffic between itself and the slave devices associated with it. A slave device is a device that responds to the master device. Slave devices are required to synchronize they are transmitting/receiving timing with that of the masters. In addition, transmissions by slave devices are governed by the master device (i.e., the master device dictates when a slave device may transmit). Specifically, a slave may only begin its transmissions in a time slot immediately following the time slot in which it was addressed by the master, or in a time slot explicitly reserved for use by the slave device.

          The frequency hopping sequence is defined by the Bluetooth device address (BD_ADDR) of the master device.  The master device first sends a radio signal asking for a response from the particular slave devices within the range of addresses. The slaves respond and synchronize their hop frequency as well as a clock with that of the master device.

          Scatternets are created when a device becomes an active member of more than one piconet. Essentially, the adjoining device shares its time slots among the different piconets.

 Bluetooth Specifications:
  • Core Specifications: It defines the Bluetooth protocol stack and the requirements for testing and qualification of Bluetooth-based products.
  • The profiles specification:  It defines usage models that provide detailed information about how to use the Bluetooth protocol for various types of applications.
 The core specification consists of 5 layers:
  • Radio: Radio specifies the requirements for radio transmission – including frequency, modulation, and power characteristics – for a Bluetooth transceiver.
  • Baseband Layer: It defines physical and logical channels and link types (voice or data); specifies various packet formats, transmit and receive timing, channel control, and the mechanism for frequency hopping (hop selection) and device addressing. It specifies point to point or point to multipoint links. The length of a packet can range from 68 bits (shortened access code) to a maximum of 3071 bits.
  • LMP- Link Manager Protocol (LMP): defines the procedures for link set up and ongoing link management.
  • Logical Link Control and Adaptation Protocol (L2CAP): is responsible for adapting upper-layer protocols to the baseband layer.
  •  Service Discovery Protocol (SDP): – allows a Bluetooth device to query other Bluetooth devices for device information, services provided, and the characteristics of those services.

The 1st three layers comprise the Bluetooth module whereas the last two layers make up the host. The interfacing between these two logical groups is called the Host Controller Interface.

Advantages of Bluetooth Technology:
  • It removes the problem of radio interference by using a technique called Speed Frequency Hopping.  This technique utilizes 79 channels of a particular frequency band, with each device accessing the channel for only 625 microseconds, i.e. the device must toggle between transmitting and receiving data from one-time slot to another. This implies the transmitters change frequencies 1,600 times every second, meaning that more devices can make full use of a limited slice of the radio spectrum. This ensures that the interference won’t take place as each transmitter will be on different frequencies.
  • The power consumption of the chip (consisting of the transceiver) is low, at about 0.3mW, which makes it possible for the least utilization of battery life.
  • It guarantees security at bit level. The authentication is controlled using a 128bit key.
  • It is possible to use Bluetooth for both transferring of data and verbal communication as Bluetooth can support data channels of up to 3 similar voice channels.
  • It overcomes the constraints of the line of sight and one-to-one communication as in another mode of wireless communications like infrared.
Bluetooth Applications:

Cordless Desktop: All (or most) of the peripheral devices (e.g., mouse, keyboard, printer, speakers, etc.) are connected to the PC cordlessly.

Ultimate headset: It can be used to allow one headset to be used with myriad devices, including telephones, portable computers, stereos, etc.

Automatic synchronization: This usage model makes use of the hidden computing paradigm, which focuses on applications in which devices automatically carry out certain tasks on behalf of the user without user intervention or awareness.

Multimedia Transfer:- Exchanging multimedia data like songs, videos, pictures can be transferred among devices using Bluetooth.

What are Bluetooth adapters? How do they work?

          Bluetooth works by the simple principle of sending and receiving data in the form of radio waves. Every Bluetooth-enabled device has a card-like attachment known as the Bluetooth adapter. It is this Bluetooth adapter that sends and receives data. A Bluetooth adapter has a particular range of connections. One electronic adaptor can notice another Bluetooth device only if the second device is present within the range of the first device. When they are within the range, they can strike up a connection between themselves. Striking up the connection between two Bluetooth devices is known as paring of devices.

How is the data sent between two Bluetooth devices?

          The radio-wave connection between two devices is used to send and receive data between two Bluetooth devices. The data send and received at a time is equal to 720 Kilobytes per second. There are 79 frequency channels of a frequency 2.45 GigaHertz through which the devices send and receive data to each other. When two devices are trying to be paired, they are actually searching for a common frequency through which they can send and receive data. When such a frequency is discovered, the devices are “found”. The connecting of two devices does not hamper the connecting of two other devices because they usually use different channels of frequency and hence do not overlap. In simple terms, this is the principle behind Bluetooth technology.

What is piconet? How is it related to Bluetooth?

          One merit of Bluetooth technology is that it allows more than two devices to be sharing information at the same time. When more than two electronic devices enter into the process of sending and receiving data, they form a small network like that of a computer network. Such a micro-network of electronic devices is called a Piconet. In a piconet, there will be more than two devices. The maximum number of devices that a single piconet can accommodate is seven. Any one of these devices acts as the superior device or the Master device. It is the master device that initiates the action, or “gives the order to begin” the action. The other devices are known as slave units. They act according to the instructions given by the Master unit. A Bluetooth device can either act as the Master or as the Slave, depending upon the situation. A device can enter a piconet and leave a piconet. When more than one piconets join together, it is termed a scatternet.

Is Bluetooth safe and secure?

          As we all know, wireless connections are always more prone to attacks than wired connections. Wired connections occur through a medium that is generally accessible only to the devices engaged in communication. Attacks, for example, a virus can enter a device only if it is present in one of the devices that are engaged in the open. Nowadays, even these types of connections are not as secure as they used to be, but a wireless connection is always more vulnerable. Bluetooth being a wireless technology, cannot be said to be secure. Nowadays we hear the incidents where Bluetooth devices are hacked. To prevent this, Bluetooth security measures are necessary.

Bluetooth security: How to keep it secure and safe?

  • Switch on Bluetooth when you need to send or receive data. Do not keep it turned on always. This can prevent the chances of hacking.
  • When a Bluetooth device tries to send data to your device, usually a message will show up, asking you to confirm the reception. Do it only if you know who is sending the data.
  • Install a good antivirus program on your mobile device.
  • Install a good program in your system as well. Harmful software can enter your device from the system as well when you transfer data.
  • Do not use wireless technology like Bluetooth to send confidential data.
  • These are some of the specific ways through which you can keep your Bluetooth device safe and keep your data secure

HC-05 Bluetooth Module

  • HC-05 is a Bluetooth module that is designed for wireless communication. This module can be used in a master or slave configuration

Pin Description

Bluetooth serial modules allow all serial-enabled devices to communicate with each other using Bluetooth.

It has 6 pins,

  1.  Key/EN: It is used to bring Bluetooth module in AT commands mode. If the Key/EN pin is set to high, then this module will work in command mode. Otherwise, by default, it is in data mode. The default baud rate of HC-05 in command mode is 38400bps and 9600 in data mode.

HC-05 module has two modes,

  • Data mode: Exchange of data between devices.
  • Command mode: It uses AT commands which are used to change the setting of HC-05. To send these commands to module serial (USART) port is used.
  1. VCC: Connect 5 V or 3.3 V to this Pin.
  2. GND: Ground pin of the module.
  3. TXD: Transmit Serial data (wirelessly received data by Bluetooth module transmitted out serially on TXD pin)
  4. RXD: Receive data serially (received data will be transmitted wirelessly by Bluetooth module).
  5. State: It tells whether the module is connected or not.

 HC-05 module Information

  • HC-05 has a red LED that indicates connection status, whether the Bluetooth is connected or not. Before connecting to the HC-05 module this red LED blinks continuously in a periodic manner. When it gets connected to any other Bluetooth device, its blinking slows down to two seconds.

  • This module works on 3.3 V. We can connect 5V supply voltage as well since the module has on board 5 to 3.3 V regulator.
  • As the HC-05 Bluetooth module has a 3.3 V level for RX/TX and the microcontroller can detect 3.3 V level, so, is no need to shift transmit level of the HC-05 module. But we need to shift the transmit voltage level from the microcontroller to the RX of the HC-05 module.

 Bluetooth communication between Devices

         Send data from the Smartphone terminal to the HC-05 Bluetooth module and see this data on PC serial terminal and vice versa.

          To communicate a smartphone with an HC-05 Bluetooth module, a smartphone requires a Bluetooth terminal application for transmitting and receiving data. You can find Bluetooth terminal applications for android and windows in the respective app. store.

          So, when we want to communicate through a smartphone with an HC-05 Bluetooth module, connect this HC-05 module to the PC via serial to USB converter.

          Before establishing communication between two Bluetooth devices, 1st we need to pair the HC-05 module to a smartphone for communication.

Pair HC-05 and smartphone:

  • Search for a new Bluetooth device from your phone. You will find a Bluetooth device with the “HC-05” name.
  • Click on connect/pair device option; the default pin for HC-05 is 1234 or 0000.
  • After pairing two Bluetooth devices, open terminal software (e.g. Teraterm, Realterm, etc.) on PC, and select the port where we have connected USB to the serial module. Also, select the default baud rate of 9600 bps.
  • In smartphone, open Bluetooth terminal application and connect to paired device HC-05.

          It is simple to communicate, we just have to type in the Bluetooth terminal application of the smartphone. Characters will get sent wirelessly to Bluetooth module HC-05. HC-05 will automatically transmit it serially to the PC, which will appear on the terminal. In the same way, we can send data from PC to smartphone.

Multimeter Working Principle Tutorial
Laser Diode Working Principle Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *

Navigation

My Cart

Close
Viewed

Recently Viewed

Close

Great to see you here !

Your personal data will be used to support your experience throughout this website, to manage access to your account, and for other purposes described in our privacy policy.

Already got an account?

Quickview

Close

Categories