I'm planning to create a Raspberry Pi robot to map a room. I intend to use a particle filtering algorithm as one of the central points of the project, that will allow me to work out my position relative to a 'beacon'. This beacon will be placed near the centre of the room and the robot needs to be able to work out the distance from itself to the beacon, accurate to within <1 metre. The direction to the beacon doesn't matter.

I'm struggling to work out what technology I should use for the beacon. It could be powered by a portable battery, and it needs to work fairly well through table/chair legs (I don't expect it to work through a wall though).

I've considered:

  • Infra-Red
  • Ultrasound
  • Ultra-Wide-Band
  • Wifi networks
  • Bluetooth
  • Image analysis to determine range from known object (won't work through table/chairs)

Is there a way to determine the distance from the robot to a fixed point? If so, what is the best way?

This question is not a duplicate of this question, even though they look similar. I want a distance to an object, the other question is about tracking movement.


3 Answers 3


I would suggest using ultrasonic beacons sending a coded message. These beacons would be triggered by radio signals of some kind. My suggestion is to use Bluetooth.

By experimentation you could discover how long your beacons take to receive and process the BT signal before sending out their sonic reply. The rest of the delay would be due to the time it takes for the sound to travel.

Difficulties include such things as the sound bouncing, multiple beacons sounding at the same time, multiple robots attempting to use the beacons.

Another way is to use bar codes. Around 15-20 years ago, I built a small robot that had a webcam attached that found and read these oversized and simplified bar codes. Yes, I printed out stickers which I attached to doorways within reach of the robot.

I think that a better solution would be to use a simplified form of QR codes. There are open source programs to read and write them, so it should be possible to modify the code to make something easier to read though containing less information.

With the proper ink, these could be seen with IR illumination. Or perhaps we can assume that the light is on.

There is an implementation of the simplified qr codes called "April Tags." Each tag can hold 4-12 bits of information, which is enough to enumerate almost anything I can think of that fits into a normal house.


Light and radio waves travel too fast, you'll need a very precise measurement to get the distance, coupled with expensive equipment.

Ultrasound, on the other hand is cheap, travels at the speed of ~300m/s, sensors are cheap and the results can be analysed using entry-level micro-controllers.

I would put an emitter on the robot, and make the beacon to send a reply every time it hears the request from the robot. This should take care of the situation with reflections and robot receiving its own signal.

  • $\begingroup$ So you are saying that the beacon then sends its own ultrasonic sound back to the robot when it receives a sound? And presumably I have to take into consideration the 360˚ sensors and emitters? $\endgroup$ Jun 27, 2018 at 20:44
  • $\begingroup$ @tburrows13 ultrasonic is pretty wide-angle, if you run the robot within a room, start from one, point it anywhere. if it does not work, get two, pointing in the opposite directions, or if you feel adventurous, get four, pointed in all 4 directions. These are cheap anyway, maybe $1 on ebay, search for "Ultrasonic Module HC-SR04". $\endgroup$
    – lenik
    Jun 28, 2018 at 5:12
  • $\begingroup$ Ok, that looks feasible. How are you suggesting that the beacon sends a reply? $\endgroup$ Jun 28, 2018 at 6:34
  • $\begingroup$ @tburrows13 the beacon waits for a signal from the robot, can be frequency or PWM coded or whatever approach you like. Once the encoded signal is recognised, the beacon answers with its own encoded message. The messages should be different to avoid beacon or robot talking to himself instead. $\endgroup$
    – lenik
    Jun 28, 2018 at 9:54

There are a lot of ways to do so. But the one which I am more familiar with is by using the Received Signal Strength (RSSI) method. You can use the BLE/WiFi signal strength for the calculation of the distance. Go through this post.

You can also use accelerometer and gyroscope sensors to map the positioning. You can find some reference here:




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.