HC-05 bluetooth RSSI not working with Arduino
Asked Answered
S

6

6

I cannot get my HC-05 bluetooth modules to output RSSI values. I issue it the following commands in series:

AT+INIT
  -> *OK*
AT+INQM=1,9,48
  -> *OK*
AT+INQ
  -> *No response, it starts flashing rapidly, indicating AT mode is no longer active*

After the INQ command, the module it starts flashing rapidly. I think this means it has exited AT command mode, and I get not response on the INQ request. I have to issue the INIT command before the INQM? as otherwise it gives back an error(16).

I have even tried purchasing a different make of the HC-05, but that did not help.

Why is this happening, and how can I solve it?

EDIT: Just for some more info, I also have an AT+VERSION? command in there, and that responds just fine with the version. The only thing that does not work is the AT+INQ... Here is the output when I start up my serial monitor:

bt2bt HC module - version a
BtSetCmdMode 1
BtReset
Set as Master
OK

+VERSION:2.0-20100601
OK

OK


OK

UPDATE: I can still talk to the module after it starts flashing: "AT+STATE" -> +STATE:INQUIRING But how can I get the responses to the INQ command out of the module?

Slowworm answered 22/4, 2014 at 13:41 Comment(0)
I
2

Try

at+inq\r\n

Accordin to this , page 17

The process for HC-05 should be:

at+init\r\n ---- Initialize the SPP profile lib( can’t repeat initialization) 
     -> OK 

at+iac=9e8b33\r\n ----Inquire Bluetooth device has an access code 
     -> OK 

at+class=0\r\n ----Inquire the Bluetooth device type 

at+inqm=1,9,48\r\n 

At+inq\r\n ----inquire the Bluetooth device around 
Inchmeal answered 30/4, 2014 at 17:24 Comment(3)
It looks a lot like what I am doing now, minus the at+iac and at+class part. The inqm and inq commands are the same as I wrote above, apart from case. I am unfortunately out of country until monday, but will try your solution when I get home. If it works, I will open a new bounty to give to you :)Slowworm
I'm glad it worked! I assume the problem was the extra missing commands?Inchmeal
I think actually the problem was just that my "test" BT module was not discoverable (sigh), but your code worked, and therefore I think you deserve the bounty as promisedSlowworm
S
9

I occurred the same problem. I found a odd thing. I press a small button in my HC-05 and power on HC-05. Then I can enter AT mode. then I can use AT command like at+class=0,at+role=1. But if I tried to type at+inq ,i cannot see any response. But....... I tried a special action. I pressed the small button in my HC-05,and "keep press" ,not to release it.and try at+inq command.... wow...it work.... I don't know why ..but maybe you can try it. some special AT+command need to press the button (pull pin 34(key) high).even if hc-05 has been in AT mode.

Shropshire answered 29/6, 2015 at 18:34 Comment(4)
You my friend are awesome! (Don't listen to the downvoters!) I actually had the exact same problem, and bashed my head against it until midnight when I came across this answer. And behold, when holding a wire to pin 34 keeping it high, everything works! This answer is very relevant to people who have an HC-05 boards without the "key" pin, only the button. You think holding the button only for power on is enough but it is not. Thanks again user5062578 :)Anemograph
Same here, FC-114 HC-05 +VERSION:2.0-20100601 won't respond to some commands unless you hold down the tiny button.Egarton
faced same problem. Yes, pressing that button solved the problem. Has anyone tried to remove that button???Byng
For the HC05 to work in AT mode, pin34 of the chip needs to be VCC. In some modules this is done by connecting the KEY pin of the module to VCC. In other modules pin34 connection to VCC is done with a button. That's why you need to press the button when powering the module up. The strange behavior you experience is because when issuing AT+INQ the module leaves AT mode. Therefore in modules that have the KEY constantly connected to VCC is no problem because the module automatically reenters the AT mode. However, for the button version you need to have it pressed in order to reenter the AT mode.Rafiq
C
2

To set inquiry settings in chip I think you should call

AT+INQM=1,9,48

not

AT+INQM? 

This command with ? is used to ask for current settings.

Chiekochien answered 23/4, 2014 at 9:8 Comment(1)
Ah, sorry that was a typo (my bad, I know). I was not using a question mark. I have updated the question, and also put in the output. Thank youSlowworm
I
2

Try

at+inq\r\n

Accordin to this , page 17

The process for HC-05 should be:

at+init\r\n ---- Initialize the SPP profile lib( can’t repeat initialization) 
     -> OK 

at+iac=9e8b33\r\n ----Inquire Bluetooth device has an access code 
     -> OK 

at+class=0\r\n ----Inquire the Bluetooth device type 

at+inqm=1,9,48\r\n 

At+inq\r\n ----inquire the Bluetooth device around 
Inchmeal answered 30/4, 2014 at 17:24 Comment(3)
It looks a lot like what I am doing now, minus the at+iac and at+class part. The inqm and inq commands are the same as I wrote above, apart from case. I am unfortunately out of country until monday, but will try your solution when I get home. If it works, I will open a new bounty to give to you :)Slowworm
I'm glad it worked! I assume the problem was the extra missing commands?Inchmeal
I think actually the problem was just that my "test" BT module was not discoverable (sigh), but your code worked, and therefore I think you deserve the bounty as promisedSlowworm
C
1

You need to add /r/n to the end of the calls to the Bluetooth module. /r is the carriage return character and /n is the line feed character. They work together to act like hitting the enter key on your keyboard.

The calls need /r/n added to them so that the Bluetooth module knows that that is the end of the command, otherwise it all is one line.

Crossbreed answered 30/4, 2014 at 20:9 Comment(1)
Thank you, but unfortunately I am already sending the HC-05 \r\n after all callsSlowworm
R
1

try this:

at

Make sure you get OK as response.

then:

at+init
at+orgl
at+role=1
at+inqm=1,9,48
at+inq

Make sure the device you're trying to find is in discoverable mode and it should show up in the output list within a minute. I think the part you were missing was at+role=1

Reticle answered 1/5, 2014 at 19:21 Comment(0)
V
0

please also make sure that the HC-05 is in master mode

at+role=1\r\n ----Setting the device for master mode

The factory default is slave mode. I have just wasted half a day because of this.

Vargo answered 18/6, 2014 at 16:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.