HC-05 Bluetooth Module

Bluetooth (HC-05) with Arduino Uno

HC‐05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module. It uses serial communication to communicate with devices. It communicates with a microcontroller using a serial port (USART). It has range up to <100m which depends upon transmitter and receiver, atmosphere, geographic & urban conditions. 

The HC-05 Bluetooth Module can be used in a Master or Slave configuration, making it a great solution for wireless communication. So, it is used for many applications like a wireless headset, game controllers, wireless mouse, wireless keyboard, and many more consumer applications.

The Bluetooth module HC-05 is a MASTER/SLAVE module. By default the factory setting is SLAVE. The Role of the module (Master or Slave) can be configured only by AT COMMANDS. The slave modules cannot initiate a connection to another Bluetooth device but can accept connections. The master module can initiate a connection to other devices.

It is IEEE 802.15.1 standardized protocol, through which one can build a wireless Personal Area Network (PAN). It uses frequency-hopping spread spectrum (FHSS) radio technology to send data over the air.

Hardware Features

  • Typical ‐80dBm sensitivity.
  • Up to +4dBm RF transmit power.
  • 3.3 to 5 V I/O.
  • PIO (Programmable Input/Output) control.
  • UART interface with programmable baud rate.
  • With an integrated antenna.
  • With edge connector.

Software Features

  • Slave default Baud rate: 9600, Data bits: 8, Stop bit: 1, Parity: No parity.
  • Auto‐connect to the last device on power as default.
  • Permit the pairing device to connect as default.
  • Auto‐pairing PINCODE:”1234” as default.

Pin Description:

  • Key/EN: It is used to bring Bluetooth module in AT commands 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 the module serial (USART) port is used.
  • VCC: Connect 5 V or 3.3 V to this Pin.
  • GND: Ground pin of the module.
  • TXD: Transmit Serial data (wirelessly received data by Bluetooth module transmitted out serially on TXD pin). Connects to Rx Pin of Micro-Controller.
  • RxD: Receive data serially (received data will be transmitted wirelessly by Bluetooth module). Connects to Tx Pin of Micro-Controller.
  • State: It tells whether the module is connected or not.

More details: Mobile Controlled Bot | AT Command | Master-Slave Configuration

Components

Arduino Unox 1
HC-05 Modulex 1
Jumper Wirex 4
Bread Boardx 1

Steps:

  1. Connect the HC-05 Module pins as shown in the image.
    State–> +No COnnection
    Rx Pin –> GPIO-11
    Tx Pin –> GPIO-10
    Gnd –> Gnd
    Vcc –> +5V
    EN –> No Connection
  2. Make sure VCC and GND not short.
  3. Upload the code mentioned for Arduino UNO.
  4. Open the Serial Monitor to see the readings.

Circuit:

Code:

/*the code is written for Arduino UNO, but can run on any Arduino Board with required modification */

#include<SoftwareSerial.h>

SoftwareSerial BT(11, 10);      
//TX, RX respetively For BT

String readdata;  
void setup() {
  BT.begin(9600);
  Serial.begin(9600);
  pinMode(13, OUTPUT);
}	
void loop() {
  while (BT.available()) {
    delay(10);
    char c = BT.read();
    readdata += c;
  }

  if (readdata.length() > 0) {
    Serial.println(readdata);

    if (readdata == "LED on") {
      digitalWrite(13, HIGH);
      delay(100);
    }

    else if (readdata == "LED off")
    {
      digitalWrite(13, LOW);
      delay(100);
    }
    readdata = "";
  }
}

P.S. Remove the Tx & Rx pin while uploading the code.

Helpful Resources:

Mobile Controlled Bot | AT Command | Master-Slave Configuration

Related Projects:

Mobile Controlled Bot | AT Command | Master-Slave Configuration

Follow us on:

Source: Platforuma

Leave a Comment

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

EXTRA ₹999 OFF on Lock-Down Live Learning!

Join Now!
X myStickymenu