Steps to interface Bluetooth module with app

  1. Set connections as per the circuit diagram given. Do not provide VCC to GND and GND to VCC of HCO5 to Arduino. It might damage your HCO5 Bluetooth module.
  2. Do not provide EN pin more than 3.3v it might damage your HC05 Bluetooth module as the pin is directly connected to bc417 radio chip which works on 3.3v.
  3. Now download the BT serial monitor app in your smartphone.
  4. Connect your phone app with hco5 module default password is:1234
  5. Upload the code on Arduino Uno and control whatever u want.
  6. The app can be downloaded from play store or u can make your own app from MIT APP INVERTER.
  7. Make sure that baud rate of serial monitor and the baud rate used in code that u are uploading should be same.
  8. LED Blinking will observe changes when it will receive data and it is control by firmware in radio chip.

 

 

HC-05 Specifications

 

 

  • Bluetooth protocol: Bluetooth Specification v2.0+EDR
  • Frequency: 2.4GHz ISM band
  • Modulation: GFSK(Gaussian Frequency Shift Keying)
  • Emission power: ≤4dBm, Class 2
  • Sensitivity: ≤-84dBm at 0.1% BER
  • Speed: Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps
  • Security: Authentication and encryption
  • Profiles: Bluetooth serial port
  • Power supply: +3.3VDC 50mA
  • Working temperature: -20 ~ +75Centigrade
  • Dimension: 26.9mm x 13mm x 2.2 mm
  • It is IEEE 802.15.1 standardized protocol, through which one can build wireless Personal Area Network (PAN). It uses frequency-hopping spread spectrum (FHSS) radio technology to send data over air.

 

Pin Description

 

 

1.Key/EN:It is used to bring Bluetooth module in AT commands mode. By default this pin operates in data mode. Key/EN pin should be high to operate Bluetooth in command 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 modeExchange of data between devices. Baud rate is 9600bps in data mode.

 

  • Command mode: It uses AT commands which are used to change setting of HC-05. Baud rate is 38400bps in command mode.

2. VCC: Connect 5 V or 3.3 V to this Pin.

  1. GND: Ground Pin of module.
  2. TXD: Connect with Microcontroller RXD pin of Microcontroller.Transmit Serial data (wirelessly received data by Bluetooth module transmitted out serially on TXD pin)
  3. RXD: Connect with Microcontroller TXD pin of Microcontroller.Received data will be transmitted wirelessly by Bluetooth module.

 

 

HC-05

NOTE: if you are using software serial port make sure that in Arduino only serial one port works at one time. Do not activate any port other serial port while transmitting data.

 

 

 

Steps to interface two HCO5 with two Arduinos:

 

First you have to convert one in master mode and one in slave mode. As per the procedure data always transfer from master to slave mode but in HCO5 it happens in both ways.

 Convert HCO5 Modules into master and slave mode with the help of AT commands.

Connect EN pin to 3.3 v of Arduino Uno board Connect VCC and GND.Do not connect TX and RX of Arduino board.

Upload a blank code in Arduino Now u can configure it with the help of AT Commands. After it is configure into AT commands upload the code in both Arduino boards:

 

CODE:

#include <SoftwareSerial.h>

 

SoftwareSerial mySerial(2, 3); // RX, TX

 

void setup()

{

  // Open serial communications and wait for port to open:

  Serial.begin(57600);

  while (!Serial) {

    ; // wait for serial port to connect. Needed for Leonardo only

  }

  Serial.println(“Goodnight moon!”);

 

  // set the data rate for the SoftwareSerial port

  mySerial.begin(4800);

  mySerial.println(“Hello, world?”);

}

 

void loop() // run over and over

{

  if (mySerial.available())

    Serial.write(mySerial.read());

  if (Serial.available())

    mySerial.write(Serial.read());

}

Questions:

How the does blinking of LED is controlled?

It is controlled by firmware that is present in radio chips that is used in modules. Firmware is used for controlling hardware signaling. Whenever it receives data, Firmware controls blinking to indicate the user that the module is receiving or sending the data.

How does the software serial port works in Arduino?

If we want to use more than one UART port then software serial library in Arduino comes into play from which we can make can digital pins as UART port. You can only use one UART port at one time. If we are using two ports at one time then it might create disturbs because of baud rate.

 

Applications

 

  • Computer and peripheral devices
  • GPS receiver
  • Industrial control
  • MCU projects

Reference:

https://components101.com/wireless/hc-05-bluetooth-module

https://wiki.eprolabs.com/index.php?title=Bluetooth_Module_HC-05

https://www.electronicshub.org/hc-05-bluetooth-module/

https://electrosome.com/hc-05-serial-bluetooth-module/