i have problem with accessing at-command in module Bluetooh HC-05.

i just follow all tutorial to activate at-command like this, http://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-in-slave-mode/

or in this video https://www.youtube.com/watch?v=Vr4cdpsoVEo&t=31s

and just read some explanation and implemented to my problem HC-05 Bluetooth AT+INQ command not working

but i just still get same error. i cant use AT+INQ command, always get ERROR(1F). AT+INIT get ERROR(17).

i have module HC-05 with version 3.0-20170601

This is my code i use it.

#include <SoftwareSerial.h>
SoftwareSerial BTserial(8, 9); // RX | TX`

const long baudRate = 38400; 
char c=' ';
boolean NL = true;

void setup() 

   Serial.print("Sketch:   ");   Serial.println(__FILE__);
   Serial.print("Uploaded: ");   Serial.println(__DATE__);
   Serial.println(" ");

Serial.print("BTserial started at "); Serial.println(baudRate);
Serial.println(" ");

void loop()


// Read from the Bluetooth module and send to the Arduino Serial Monitor
if (BTserial.available())
       c = BTserial.read();

   // Read from the Serial Monitor and send to the Bluetooth module
if (Serial.available())
       c = Serial.read();

    // Echo the user input to the main window. The ">" character indicates 
    the user entered text.
    if (NL) { Serial.print(">");  NL = false; }
    if (c==10) { NL = true; }

  • check this out ... stackoverflow.com/questions/23221336/…
    – jsotola
    Mar 20, 2018 at 21:43
  • Ty for comment sir. I just read and implemented your guide But my problem still not solve. I wondering my firmware. Because I have Bluetooth version is 3.0. and other tutorial have version is 2.0 Mar 20, 2018 at 22:30
  • Do other AT commands work? what arduino are you using?
    – mystery
    Mar 22, 2018 at 17:01
  • Yap i just use all AT-COMMAND. Just AT+INQ get error. I use Arduino uno. Mar 22, 2018 at 23:47
  • thank you for this wonderful post Presidenten ,but i am having issue, "AT+STATE" shows inquiring ..if i power up my bluetooth device (not hc05) it doesnt show any address...what am i missing..please help... Oct 20, 2018 at 6:54

4 Answers 4


I have a HC-05 with 3.0-20170601 that I managed to bind to a slave last night. It turns out that the v3 has two AT-modes.

The first is when you hold the button while you connect power. The led will blink slowly and you can connect at 38400 baud. But this is like a configuration mode, where AT+INQ is not available.

In this mode I did these commands:


(Press and hold the button)


(Release the button after device restarts and led is slowly blinking)


AT should give OK as answer to know connection is working

AT+UART will show configured baudrate. Default is 9600.

AT+RMAAD clears all saved connections

AT+ROLE=1 sets it as master

AT+RESET restarts the device to change to master

AT+CMODE=1 accepts all kinds of devices

AT+INQM=0,5,5 inquires in standard mode, with 5 max connections or 5 secs

AT+PSWD="9999" sets the pin code 9999, change to the pin you need

After this it is time to update the arudino code. In your case you should update line 4 from

const long baudRate = 38400;


const long baudRate = 9600;

...or what ever value you might have set the baud rate to. Then reflash your arduino.

Now enter the very irritating second AT command mode.

Power up without holding the button. You will get the fast blink speed. When its powered up, press and hold the button. The led will continue blinking fast, but while the button is pressed you can now connect to the device on the configured baud rate. So open the serial monitor and type AT to verify. Remember that the mode is only active while the button is pressed. So keep it pressed. I had a small clamp I put on there.

Then I entered these commands:


AT+STATE will show current state, should be inquiring

Then power up the slave device and the adress should start popping up. It will be something like xyz:xy:xyzw,931F00,7FFF

The first part is the address you want (xyz:xy:xyzw)

Change : to , and get xyz,xy,xyzw

Check that you connecting to the correct device


Then bind


The AT+LINK command gave me FAIL as output. But it did not matter. I restarted and did not press any button before or after. Just normal start.

After 5-10s serial data showed up in my serial monitor.

Modules are bound. And will automatically connect at power up. If not you might have the wrong pincode. Make sure to change 9999 above to 0000 or 1234 or what ever it may be. When I hade the wrong pin I still got OK from the AT+PAIR and AT+BIND commands... It didnt work for me until I entered the correct pin.

Sorry for long post, but I wanted to be thorough since info about HC-05 v3 is very scarce on the internet right now.

A reference to all commands can be found here: http://www.electronicaestudio.com/docs/istd016A.pdf (Link valid 2018-08-13)


I have two modules:

(A) HC-05 with firmware version 3.0-20170601

(B) HC-05 with firmware version 2.0-20100601 (ok)

I have the same problem: when the AT command "AT+INQ" is sent on (A) module, the response is always "ERROR:(1F)". This error code seems not be reported in any document or specification available on internet. This BT module have firmware version (AT+VERSION) 3.0-20170601. Also I have noticed that command AT+INIT on (A) module returns always ERROR:(17), this error normally can be ignored if the command has been sent already (Initiate SPP lib), but the first time should be return "OK" as on (B) module.

The (B) module with firmware version 2.0-20100601 works ok with the following commands (set PIN34 high at power-up, or press button on module and keep pressed during commands):

AT+RMAAD -> delete all paired devices list

AT+ROLE=1 -> Set master mode

AT+RESET -> reset module to enter into master mode

AT+CMODE=1 -> Permit connection with any device

AT+INQM=0,5,9 -> Set Search parameters(Query mode standard, 5 devices, 9secs)

AT+INIT --> Init SPP profile mode (first time response: "OK")

AT+INQ --> Start search devices (return device list after some seconds)

The differences between two modules are:

On AT+INIT the (A) module return always ERROR:(17), the (B) module return "OK" first time and ERROR:(17) if the command is sent twice. On (A) module the command AT+INQ return always ERROR:(1F), the (B) module return the list of the BT devices.

Also the (A) and (B) modules are physically different. The (B) module have some components (resistors/capacitors) between the two big black chips, the (A) module no.

Also I noticed that on (A) module the AT+CLASS? return "1f00" value (default?). The correct value should be "0" as (B) module ? Anyway setting AT+CLASS=0 on (A) module the result is always the same.

In slave mode (AT+ROLE=0) both modules works fine.

With (A) module I'm unable to use it as "MASTER" and connect it to any other slave BT modules because did not perform devices search. (INQ fails).

I think that in 3.0 firmware is needed to set other(s) parameter(s) in order to start SPP profile correctly (INIT) and then avoid ERROR:(1F) in INQ command (search).

Someone already solved the problem ?

  • So the conclusion about my problem is the firmware on HC-05. Firmware with 3.0 make AT+INQ will be not work. Ty very much for your answer. This is problem make me Stack on a month. Your answer very useful to me. Mar 25, 2018 at 9:34
  • So your HC-05 with firmware 2.0 have push button or not? Mar 25, 2018 at 12:03
  • Yes, it have the push button. The HC-05 is soldered on ZS-040 board that have the push button connected to PIN34. If you press the button at power-up, the module will enter in AT-COMMAND mode (38400bps, CR+LF) and it is possible to setup and view configuration of the module as MASTER o SLAVE by using AT commands. Some similar modules (HC-06) doesn't have the button because they are SLAVE only.
    – Atomix
    Mar 25, 2018 at 14:33
  • Okay. Ty very much brother. Mar 25, 2018 at 14:35
  • Sir, can I buy your HC 05 with Firmware 2.0? Apr 3, 2018 at 9:21

Extending the Presidenten's answer, the easiest way to program HC-05 is to sonnect a wire to EN on the chip and set the UART console to 9600.

Then pull the EN high, send commands, wait for OK (after each one), and drive EN down.

You now have a chip in data state.


I have the same version module HC-05. This mode (INQ) is enabled for default and it's impossible switch it off. Seems that manufacturer removed this command in that version.

Another point, that it works only on default 9600 bod/s regardless of settings AT+UART=... and only in standart AT mode (key pin pull high after power on device).

Once connected to other module only one way to return to "inquiring" that I found is full reset it by command ORGL, and reconfigure it class and role.

Don't touch IAC settings - that also causes improperty working.

Not the answer you're looking for? Browse other questions tagged or ask your own question.