IoT Modules Sensors and Modules UART Modules

HC-05 Bluetooth Module

Table of Contents In our era, people are more likely to use wireless devices because it makes using them much easier. HC-05 is a Bluetooth module used for wireless communication. It uses Serial communication to communicate. Its work is based on UART. Usually, it is used to connect small devices like a mobile phone or laptop and exchange files over the range of less than 10m. You can also communicate  between two microcontrollers like Arduino through this. However, this module does not transfer multimedia like photos or songs. It can take up to 4-6V of power supply. It supports baud rate of 9600, 19200, 38400, 57600, etc.  Refer to these blogs if you feel stuck. Serial Communication UART HC-05 Default Settings Specifications How to connect HC-05 module HC-05 Module PIN OUT of HC-05 Connection or HC-05 & Arduino Modes of Communication Data Mode: This mode is used to communicate with other Bluetooth devices wirelessly. Command mode: AT Command mode is where we can change the default device settings. Let\’s see an example here for both of the modes, starting with Data Mode. Bluetooth communication between Devices (Data Mode) Here we will connect our module with Arduino and our phone. We will send signals from the phone to the HC-05 module wirelessly which will be displayed on the serial monitor. If we will send 1 it will turn on the LED or If we will send or it will turn off the LED.  Components required: Arduino Uno LED Jumper wires HC-05 Bluetooth An android phone Steps. Follow the steps mentioned above to connect your module. Now follow these steps to make the circuit turn on/off the LED. Connect the long leg of the led with the resistor. The resistor should be connected with any digital pin, let\’s say pin 13. Connect the short leg with the ground. 3. Now we are using the same TX, RX pin for communication. For this, First, we need to remove RX, TX wire. We did this because Arduino Uno has only 1 pair of UART pins and by them, it receives the data from the IDE. We are aware that Arduino uses the UART protocol for communication. If we connect these pins with the HC-05 module while uploading we will get an error as it will clash. Upload the code to the Arduino and reconnect the pins. int ledP=13;int dtime=1000;int readData;void setup() {  // put your setup code here, to run once: pinMode(ledP,OUTPUT); Serial.begin(9600);}void loop() {  // put your main code here, to run repeatedly:while(Serial.available()==0) {} // reading the data from the serial monitorreadData = Serial.parseInt();Serial.println(readData);if(readData==0){  digitalWrite(ledP,LOW);}if(readData==1){  digitalWrite(ledP,HIGH);} To send the signals via phone we need to install an app. I use an Arduino Bluetooth controller. Pair it, add the password which is usually 1234 or 0000. Changing the default settings of HC-05 (Command mode) AT Command mode is where we can change the default device settings. Steps to use AT commands Connect your Arduino Board to the Pc. Upload the bare minimum code to Arduino without any breadboard connection. Unplug the Arduino from the computer. Connect the HC-05 module to the Arduino as below. Press and hold the push-button on the module for 1-2 sec and while holding it connect the Arduino to the PC. Now you’ll see the red light will blink in 1-2 sec intervals which shows AT command mode is active. Now select the baud rate to 38400. We do that because 9600 is slow for high-speed transmission. It can go even higher according to the HC-05 reference. Set the box next to the baud rate from newline to both NL(newline – n) & CR(carriage return – r). Now we will use AT commands. First, type At on the Serial Monitor and send. If you will see an OK then everything is fine. To change the name of the module we use AT+NAME=HC-05Devanshi. To change the Password of the module we use AT+PSWD=\”9876\”   You can refer to this for AT commands. Applications of HC-05 module Robots  Wireless communication between two microcontrollers Communication with Mobile and Laptop

Stay Updated With Us

Error: Contact form not found.