Skip to main content
1 of 2
shailendra
  • 327
  • 2
  • 6
  • 14

Bluetooth module HC-05 giving ERROR :(0)

I am working right now with Arduino UNO and HC-05 bluetooth module.I followed the instruction given on this link for wiring.So there are 2 mode of working with this HC-05 module

i) Simple serial communication ii) working in AT command mode so as to change the parameters of HC-05 module

As long as i work in simple serial communication mode, everything work fine but when i tried to change the parameters of module, it didn't worked out.FOr working in At command mode, PIN NO 34 of HC-05 module need to be high and i had taken care of.Lately i find that in mu module they had knowingly not connected the Berg strip to PIN 34 , so i connected the PIN directly, even thought i am not able to change the parameters of moduel and when i write any command on COM port of arduino IDE, i get this response

Enter AT commands:
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^

I think that garbage is due to my code

and here is my code

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  
}

void loop()
{uint8_t x;
 char CommandFromSerial[50]=" ";
 char ResponseFromBluetooth[50]= " ";
   
  if ((Serial.available())){
    if(Serial.available()>0){
  for(x=0;x<50;x++){
  CommandFromSerial[x]=Serial.read();}
BTSerial.println(CommandFromSerial);}
}
    

 
  if ((BTSerial.available())){
    if(BTSerial.available()>0){
  for(x=0;x<50;x++){
  ResponseFromBluetooth[x]=BTSerial.read();}}
Serial.println(ResponseFromBluetooth);}
    

}

I am not able to figure out what i am doing wrong. i used this command on COM port AT\r\n and many other commands but everytime i get the same response.

Did i had messed up with my bluetooth module unknowingly?

shailendra
  • 327
  • 2
  • 6
  • 14