Can i calculate the bluetooth signal strength on arduino?

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 receiver itself estimates the signal strength (RSSI), if that capability is built in. Check the data sheet for whatever bluetooth module you have.

RSSI is rarely very useful, and mostly useless for distance estimation, if that is what you are thinking about.

1 Like

that it means there is a possibility that I can calculate the RSSI

what do you want to use the RSSI for was the question?

Depending on the firmware version of your HC-05 module you can probably see some data about RSSI. there was a discussion here

1 Like

No.

It's the module that does the measurement - you just need to ask it to give you the result.

As the others have said, you need to study the datasheet for your particular module - and firmware version - to find out:

  1. If it even supports this at all;
  2. If it does, how to ask for the value - and how it will be returned.

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.

best regards Stefan

1 Like

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

nice to know but what is your real question?
You should take time to write down a detailed question

1 Like

sorry wait a minute

Do you really mean more - or less?

-30dBm is less than -20dBm

What does the documentation for the module say?

Have you tested this "manually" using a terminal before trying to code it?

so more negative is smaller?

i have tried when input AT command via serial monitor and bluetooth in AT mode but i got error, i got nothing displayed in my serial monitor

Yes!

It's a logarithmic scale.

Pardon?

Surely, you either got "ERROR", or you got nothing?

Again, what does the AT Command documentation tell you?

Does your particular module and firmware version support that command?

Are there restrictions stated on when the command is valid?

etc, etc, ...

Sure.

-20dBm would be quite a strong signal

-80dBm would be a weak signal

the steps are as exemplified in this image and the results are also as illustrated

when I try it the result is an error, not like the picture above

How are you certain that applies to the module and firmware version that you have?

So show what you're actually sending, and what you receive in response.

Does the nodule have an equivalent of AT+CMEE - to give you extended error information?

i see the datasheet here Bluetooth HC-05 datasheet

according to the datasheet I can't find any AT+CMEE command
and I don't know the firmware version on my hc-05 bluetooth module

What is so hard about doing

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.

best regards Stefan

1 Like

Again, how do you know that's correct for the version of firmware that you actually have?

this is my bluetooth hc-05 firmware version
Screenshot (471)

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