Shop OBEX P1 Docs P2 Docs Learn Events
Distance measurements with Xbee and Propeller — Parallax Forums

Distance measurements with Xbee and Propeller

spragucmspragucm Posts: 5
edited 2012-01-02 08:55 in Propeller 1
Here's my scenario:
I have three propellers with an Xbee attached to each. Two props (w/Xbee) are mounted at a fixed, measured distance. The third prop (w/Xbee) is moving around. I want to calculate the distance between the moving prop and the fixed props.

I think that it would be possible to send a bit from the moving prop to stationary ones over the Xbees, and determine the distance by saying:

distance=velocity*time
where distance is distance between moving/stationary Xbees
velocity is that of light in air
time is the time it took for the bit to travel (clocked by the xbees)

So, here's the question...Is this possible? Has anybody tried this or something similar to calculate distances?

Thanks much

Comments

  • Ken GraceyKen Gracey Posts: 7,401
    edited 2011-12-29 20:02
    This will be an interesting thread because somebody (not me) will have useful replies.

    XBees have the signal strength indicator. If this value is brought out to the I/O pins it could be a good solution to approximate distance.

    But the real reason I replied to your post is to welcome you to our forums. I can see that you've made only a few posts and want to see that you feel right at home!

    Sincerely,

    Ken Gracey
  • spragucmspragucm Posts: 5
    edited 2011-12-29 20:07
    Thanks. I certainly appreciate that I've posted two questions and two people have at least shouted back. Whew...not a black hole :)
  • sylvie369sylvie369 Posts: 1,622
    edited 2011-12-29 20:10
    I suspect you're going to find that the time differences that you would have to measure are so small for any reasonably short distances that the measurement error overwhelms the useful data. That's why Ken is suggesting the use of the received signal strength instead (though that will have problems of its own, if there are other surfaces around that can reflect radio waves, confusing the receiving XBee). It's an interesting idea, nonetheless, and you'll surely learn something by trying.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-12-29 20:54
    Assuming you could measure the received signal to the nearest 12.5ns (one clock @80MHz) you'd have a resolution of 3.75m. Probably not useful inside a room but it could be useful outside.

    I just finished a book about using XBees in wireless sensor networks. I'm not familiar with any way of accurately determining the time a signal is received.

    If XBees can't do it there are other wireless devices or even using visible light. I think you'd have better luck with some sort to audio signal. You could use ultrasonic transducers to send and receive signals. This would be a lot more accurate than trying to measure the distance light travels in a given time.

    BTW, Welcome to the forums.
  • LtechLtech Posts: 380
    edited 2012-01-02 07:17
    Use a GPS and Xbee ?
  • T ChapT Chap Posts: 4,223
    edited 2012-01-02 08:55
    Light, sound, radio, all have their own problems for distance measuring when one of the devices is moving around and radio is a real challenge at close distances. More info would be required to provide ideas. For short distances, a light method would be difficult without some type of very sophisticated laser solution. There are a lot of laser distance finders advertised online, no idea how complex that would be to build from scratch but there are devices advertised for less than US100.00. Radio is problematic at short ranges, and it would take a ton of data to create an accumulated delay that might be measurable by the Propeller. Ultrasonic has it's own set of problems, reflections from other objects would be very tough to avoid, unless there were given parameters that stated that the 3 systems are all closer together than any other wall or object. Also, what if all the devices are on the same trajectory, does one device have enough mass to block or diminish the sound from getting to the device behind it?

    One method might be to use an ultrasonic + radio hybrid solution. Thinking out loud: Have the roving Prop emit an initial ultrasonic ping 'packet' burst from either a multidirectional speaker, or rotating speaker. The packet is a series of pings that can be decoded by the receiver as a START packet. There could even be ping packets that contain the ID of the receiver. The 2 receiving Props sync to the START packets, then emits a radio response that tells the sending Prop it has received the packet, and tells the sender to fire the 'measurement detection pings' after the receiver has locked a timing method onto the sent packet. The time it takes the sender to reply with the follow up ping may be able to be determined and a distance extracted from the process.

    In simpler form:

    Sender sends START packet, a series of sound pulses.
    The Receiver decodes the packet and determines if it is the ID contained in the packet.
    The Receiver can lock on to the START packet with an internal timing method (start a timer).
    The Receiver sends back an ACK via radio that says basically "Got your message, timer is started"
    The Sender sends back either a solo ping or packet of pings for measurement.
    The Receiver determines the time it took to receive the measurement pings
    The Receiver then replies via radio the result.

    All of this still requires that the environment be adequate for the audio to work right.

    EDIT: Light intensity falls off quite consistently and measurably. If you had enough light sensors on the receivers, and enough light emitters on the sender, you may be able to use a method of calibrating the distance to the light fall-off factor. And again if using the radio for the response, each Prop can send out it's detected distance via xbee.
Sign In or Register to comment.