Hc 05 distance between it and the phione

I'm trying to calculate the distance between and android device and the HC-05 bluetooth module (connected to an arduino module: the MEGA 2560), using an android app created using appinventor.

For example, I'd like to know if the devices are 4 meters from each other so I can turn on an alarm.

After doing some research it seems that is almost imposible to do, it seems that the most that can be done is estimate that distance constantly sensing the RSSI indicator.

Is this possible? if not ,what could I use?

Are the elements of my project (HC05,arduino, appinventor) the ones I should be using?

Is this the only way?

You need at least two sensors to triangulate the position of a signal on a single plane, unless it's a single moving antenna with a GPS.
If you're serious about pursuing this I would consider that in the design.

This is simply not possible, using the setup you describe. Similar questions come up on this forum at least once a week, and the answer hasn't changed in years.

The nominal range of the HC-05 is 10m.

Your app can certainly determine if the phone has lost connection with the HC-05 and raise an alarm when that occurs. Would that provide a reliable measurement of the distance b/w the two to be 10m? I don't know.

Could the HC-05 be screened somehow to reduce its transmission strength? Through trial and error could a 4m threshold be established rather than the nominal 10m?

You can operate in high power or low power modes, but those are the only real changes that you can make.
However, you can check the signal strength of the connected device by its RSSI (Received Signal Strength Indication). Check this forum for HC-05 RSSI and you might achieve your goal on some level.

ok thanks but can u please tell me how can i turn on an alarm (a buzzer) if the HC05 is disconnected from the phone

No, you need to make an attempt first.
You have the information you need to do research:

Search the forum and the web for Arduino examples and try to put something together yourself. If you try and hit a specific error then post your code and pictures of your setup and you're much more likely to get help.

I tried it before and it didnt work so im trying another method can u help me please ?

I have helped you as much as possible short of writing your program for you. Now you need to help yourself.
When you find a specific problem and you post a detailed question you are much more likely to get help.

Good Luck :slightly_smiling_face:


It is not possible to get a reliable measurement. You can setup your Arduino and your phone and get a relative measurement for that current scenario. I build a Geiger counter type of example in with Arduinos with direct BLE support. I could hear a change in tone when I move closer or went away. It was fun for 5 minutes. But that is not reliable. As soon as the room geometry changes, the phone is in a backpack, or you turn your body in between your phone and the Arduino the value in RSSI changes as well without changing the distance. Rotating the device or phone will also change RSSI, the antennas are not perfect radial, and the signal can also bounce of surfaces around you.

You cannot get the distance from the signal strength. If you place your device in a metal box, the signal strength will go down. You can get something that works for 5 minutes of fun as I described.

Regarding the buzzer. What type of buzzer do you have? Some are active you only need to enable them via a digital pin to get a sound, other buzzers need to be controlled with an alternating signal with the right frequency to make noises.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.