Converse Bluetooth RSSI into meters

Hi friends. I'm making a project using a HC-05 Bluetooth module to localize an HC-06 and know the distance between them. I have linked them but I don't know how to get RSSI and converse the value into meters. The idea is build an Objects Locator Device, it is a highschool project, so please HELP!!!

Start by finding another way of measuring distance, as RSSI is not a (reliable, useful) measure for distance between two objects.

To find the distance between two objects have one bounce a signal off the other. Ultrasound, IR, laser. Send the signal and time how long it takes for the return.

Thank you, but I think I don't have too much time to rebuild the device. I don't really need a lot of precision, I only need something to converse the signals in meters (without centimeters, of course).

Well, start measuring.

Read signal strength, 1m distance - write down the number, 2m distance - write down the number, etc, and you have yourself a calibration table.

Do make sure no-one walks in the way of your signal, the humidity of the air remains constant, that you don't get stray reflections that appear to be part of the signal or even be the signal, and that you definitely don't put walls or door s in the way. All of those will mess up your signal strength big time.

And hope you learned one important lesson: think before you build. Make sure your sensors are suitable for what they have to sense.

Thank you very much. I think I learned the lesson, I am just 14 years old but everything is about experience. I'm going to write the values and then I will think how to integrate it to the code.
Thank you again and sorry for my english, I am just learning.

Well, remember that for every problem there are usually multiple solutions. The one you can think of may not be the best solution (and without knowing multiple solutions, it usually isn't).

Also with some 7 bln people in this world it's very likely that someone else has had the same problem to solve as you do, and that someone somewhere has come up with a very clever solution for that. The chance for you (or me) to come up with something unique and super clever that has never been done before is extremely slim because of that.

So: when you have a problem, first start looking for other people that had the same problem, and how they solved it. Learn from that, apply it to your own problem, and you quickly have the best solution. Nowadays with the Internet such searches have become dead easy, and lots and lots of such information is posted online (especially on forums like this on).

Good luck with your project!

Thank you very much, only one more question: I read you can know RSSI in the last number, if you write in the serial monitor the command "AT+INQ", but I think there has to be a better way. Do you know it?

Also take the time to see how much the signal level (and distance ?) changes as you stay in one position but vary the orientation and position of the Bluetooth transmitter and receiver.

Twist it, turn it, on the ground, in a pocket, held high etc.

I assumed fixed positions and fixed relative orientations so there's at least a fighting chance of making this work :slight_smile:

Thank you, I made the tests 6 times each distance (0.5, 1, 1.5, 2, 2.5, 3 and 3.5) and I have the values, now I want to show them in a LCD Display, do you suggest something to put in my code?

Pabloduino:
Thank you, I made the tests 6 times each distance (0.5, 1, 1.5, 2, 2.5, 3 and 3.5) and I have the values, now I want to show them in a LCD Display, do you suggest something to put in my code?

Decide on the LCD your going to use, get hold of one, and then try the examples in the particular LCDs library first, to make sure you have the LCD connected and working correctly.

And so that we know, you need to tell us the values you got from your 6 tests.

My LCD works perfectly, I have tried with other codes. Now I need to show the answers I get of the Serial Monitor into the LCD Display. I did this to get the values:

  1. Connect both modules, of course.
  2. Open the Serial Monitor of one of them
  3. Send AT Commands like AT+INQM=1,5,9. This helped me to turn on the RSSI mode and say to the module I needed five answers in nine seconds.
  4. Write AT+INQ to detect the second module, it returns with the addres, the type field and the strength of the signals.

Then I did it puting the modules to different distances, in different places of my room: 0.5 meters, 1 meter, 1.5 meters, 2 meters and 2.5 meters.
I got this:
0.5 meters=When I put this to 0,5 meters I get values from FFD5 to FFCF.
1 meter=When I put this to 1 meter I get values from FFCF to FFC9
1.5 meters=When I put this to 1,5 meters I get values from FFC9 to FFC5
2 meters= When I put this to 2 meters I get values from FFC5 to FFBD
2.5 meters= When I put this to 2,5 meters I get values from FFBD to FFB9
I want that my LCD shows the distance when I put the AT Command in the Serial Monitor. Is there a way to do that?

Assuming those values are signed integers representing RSSI values in dB, start by making a graph!

rssi.png

Pabloduino:
I got this:
0.5 meters=When I put this to 0,5 meters I get values from FFD5 to FFCF.
1 meter=When I put this to 1 meter I get values from FFCF to FFC9
1.5 meters=When I put this to 1,5 meters I get values from FFC9 to FFC5
2 meters= When I put this to 2 meters I get values from FFC5 to FFBD
2.5 meters= When I put this to 2,5 meters I get values from FFBD to FFB9

Very odd that it plots like a staircase, real world you would have expected a degree of randomness.

Very odd that it plots like a staircase, real world you would have expected a degree of randomness.

That is because the OP reported a staircase, a range consisting of two data points for each distance.

Of course those are not the actual measurements!

RSSI is only very aproximately a measure of distance. Variations in tx power and rx sensitivity and antenna directivity matter enormously here. But the elephants in the room are obstructions and reflections. Unless you're in unobstructed clear space you'll get variations of >>20dB which ruins all the sums.

Find another way.

Allan

allanhurst:
Find another way.

That I suggested at the very beginning of this thread already, after which OP reported it's "too late" to come up with another way.

It's a school project. Let it be.

Thank you all for the help, I have finished my project. I know RSSI signals are not very precise but at the final I did the read of the signals and made a table with the values into meters.
So, I only wrote the table on the LCD Display and that's it. Now when I ask for "AT+INQ", I get an address, a type of device and the RSSI. Just see the LCD Display and compare the Serial Monitor result with the table I can read from the LCD.