Change Default Name and Password of HC-05 Module with AT Commands
Most important part of the device (HC-05) is above Highlighted Button.
UNO and HC-05 Connection |
- Module RX - > Uno PIN 11 as TX
- Module TX - > Uno PIN 10 as RX
- Module VCC - > Connect UNO 5v PIN OR or UNO PIN 8 (Programmatically it's set to pin mode output and HIGH)
- Module GND -> UNO GND
- MODULE Key Or State Pin - > UNO Pin 9 or Uno 3.3v
Program :
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
void setup()
{
pinMode(8, OUTPUT); //for vcc input to module or you can use vcc itself from the UNO pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key/STATE pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command more
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}
KEY THINGS TO REMEMBER:
- Before upload the code please unplug the VCC connection from the module
- Before plug the VCC pin into module press the PUSH the button in HC-05 Module and without releasing the button connect the VCC(5v) Pin to UNO and itself begin to blink the LED on Module slowly.
- Please select the Both NL & CR Option from the Serial Monitor in Arduino IDE.
- COMMAND : AT - Respond = OK
- COMMAND : AT+VERSION - To Check version.
- COMMAND : AT+PSWD=12345 - Set the Bluetooth password as 12345
- COMMAND : AT+NAME=Devopt - Set the Bluetooth Device name as Devopt
- After completing all these things, remember to unplug the VCC pin from the Arduino board and again plug without pressing push button on HC-05 and try to browse the device in any Bluetooth discover tool (or android phone)
Comments
Post a Comment