The explanation is like this
i have tried BluetoothLE1 extension in MIT App Inventor to calculate bluetooth signal strength but those extension is for Bluetooth Low Energy and Bluetooth HC-05 module doesn't support BLE.
then my last option is calculate bluetooth signal strength in arduino.
I know one way that might be used is to use AT+INQ, is that right?
The bluetooth-module has a certain transmitting-power.
It might be that on some more advanced bluetooth-modules you can adjust the transmitting-power which would be a process of giving the bluetooth-module a command set RF-power to x% of maximum.
But there is absolutely nothing about calculating it. High frequency electromagnetic waves can't be calculated. The received signal strength depends on so many many factors that you can't control it nor can you calculate it.
You can choose hardware that makes it more likely that the send/receive works reliably
like
external antenna instead of a PCB-antenna
using direction-sensitive antennas
adjusting the antenna-position to maximise RSSI
If you start describing what the final purpose is that you want to send whatever over bluetooth suggestions can be made how to reliably realise this.
Most receiving devices have some type of circuit to reduce the amplification(gain) of the receive circuit so it is not overloaded and creates distortions. The signal strength is a measure of that gain reduction voltage. And ALL that is inside the IC that contains the receiver and transmitter circuits.
i am trying to get the rssi value, the code i wrote is something like this
void loop() {
if (bluetoothSerial.available()) {
String input = bluetoothSerial.readStringUntil('\n');
input.trim();
if (input.equals("CONNECTED")) {
int rssi = readRSSI();
if (rssi > -20) {
bluetoothSerial.println("AT+DISC");
}
while (bluetoothSerial.available()) {
String receivedData = bluetoothSerial.readStringUntil('\n');
receivedData.trim();
// Process received data
bluetoothSerial.println(receivedData);
}
}
}
}
int readRSSI() {
bluetoothSerial.println("AT+INQ");
delay(500);
while (bluetoothSerial.available()) {
String response = bluetoothSerial.readStringUntil('\n');
response.trim();
if (response.startsWith("+INQ:")) {
int startIdx = response.indexOf(':') + 1;
int endIdx = response.indexOf(',');
String rssiString = response.substring(startIdx, endIdx);
return rssiString.toInt();
}
}
return 0; // Default value if RSSI reading fails
}
i use AT+DISC to disconnect the Bluetooth connection with the condition the RSSI value is more than -20dBm
and use the AT+INQ command to get the rssi value
so my question is,
can the AT command be used like the example above?
without bluetooth the hc-05 enters AT mode and AT commands are not input via the serial monitor
You can even use the Arduino-IDE inbuild serial monitor for this.
If you have any questions about how to do this just ask.
You should get much more specific in asking.
If you keep on posting only small information where your potential helpers have to ask back again and again you are stressing the patience of your potential helpers.
how do i know those datasheet is correct for the version of my bluetooth module?
honestly i don't really know, i mean that is the datasheet for bluetooth hc-05 module so so I guess it can be used as a reference for my bluetooth module