HC-05 -> Inquiring mode (INQ)

Hello,

I am currently doing a project which requires me to get the RSSI value of bluetooth devices.
I am using an arduino Uno board and a HC-05 bluetooth module.

Is it possible for the HC-05 to run in inquiring mode by itself? because right now i must always set it into inquiring mode by typing "AT+INQ" in the serial command. Is it possible to program the arduino so that the HC-05 is always in inquiring mode and will automatically take in the RSSI of bluetooth devices when i plug it into a power source.

I have also set "AT+INQM = 1, 5000, 48". and the inquiring will always stop after some time. is it possible for it to run forever, until i switch it off?

Thank you for your help.

Shihaoyap:
I have also set "AT+INQM = 1, 5000, 48". and the inquiring will always stop after some time. is it possible for it to run forever, until i switch it off?

Simple answer is no, you cannot make it run forever. The 48 in your command is the timeout value and can only be set between 1 and 48. 48 gives a timeout of about 61.44 seconds. What can't you get the arduino to look for the OK response when the command times out and send it again?

DON'T CROSSPOST

@Riva ->Thank you for your reply :slight_smile: How will i be able to make my program to read a "OK" from the serial monitor?

bump

Shihaoyap:
@Riva ->Thank you for your reply :slight_smile: How will i be able to make my program to read a “OK” from the serial monitor?

Similar to how your reading the data supplied by the AT+INQ you sent to the BT module. I assume your reading and acting on this data as your looking for the RSSI of nearby BT devices.

@Riva

This is the set of code i am using. It does seem to be able to repeat. Is it possible to help me have a look at it?

#include <SoftwareSerial.h>

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

int count=0;
char val;

void setup()
{
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key 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
Serial.println(“AT”);
BTSerial.println(“AT”);
delay(1000);
Serial.println(“AT+ORGL”);
BTSerial.println(“AT+ORGL”);
delay(1000);
Serial.println(“AT+INIT”);
BTSerial.println(“AT+INIT”);
delay(1000);
Serial.println(“AT+ROLE=1”);
BTSerial.println(“AT+ROLE=1”);
delay(1000);
Serial.println(“AT+INQM=1,10000,48”);
BTSerial.println(“AT+INQM=1,10000,48”);
delay(1000);
BTSerial.println(“AT+INQ”);
delay(1000);
}

void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
{
Serial.write(BTSerial.read());
val = Serial.read();
}

// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
{
BTSerial.write(Serial.read());
val = Serial.read();
}

if (val == ‘OK’)
{
BTSerial.println(“AT+INQ”);
}

}

I see you have started a new thread on this here so I will stop replying here and comment in new thread.