DistanceData Monitor Info

(and things to remember while using it)

Sirtaj Kang, August 1995. Revision 1.

No responsibility taken for anything.

What is this thing?

It's a Polariod sonar ranger connected to a serial driver device made locally by Physics some years ago. This allows it to be controlled by any computer with a serial interface and a clock (with a little effort. See A. Hardware Connection below).

So far, it's main use has been in demonstrating single-dimension motion to first-year physics students (160 labs).

A. Hardware Connection

The current driver box hooks into a serial port. Since the box doesn't have a PC/Mac protocol switch built into it (obviously the developers thought that it would never be used on anything except a Macintosh), the box has to be manually rewired when used with the PC. Hopefully, this will be fixed one day, but I'm not holding my breath.

The connection inherently runs in half_duplex. As far as I know, there is no way to change this, currently. (Unfortunate. It would make runtime error-checking much easier...)

B. Communication protocol

Serial Communication Settings The serial interface should be initialized for 4800 baud, 8 data bits, 1 stop bit, even parity. (It uses a Motorola MC14496 UART).

Talking to the ranger driver The ranger sends out it's ranging ping (you should hear a sharp click) when it receives the following 4 bytes: 80H 01H CR LF.

When the echo returns, the ranger sends back the time taken for the wave's round trip; this is an unsigned two-byte integer (the word is big-endian; the MSB is the first received), and is the round-trip time in milliseconds.

C. Calculating the distance

After some playing around with the speed of sound and the trip time, Nick Nicola and I came up with a distance/time factor of 5.56605x10-4 cm.count-1. So, to directly convert the returned count to centimetres, just multiply it by this factor.

Note: Your mileage may vary.

D. Things to watch out for

1. Minimum distance: about 40cm It doesn't seem to work at all under this range; the ping gets back before the ranger can read it.

2. Secondary echoes from nearby objects

3. Uneven target objects may not correctly return echo An echo might "bounce" off the target, bounce off a nearby wall back onto the target, and then to the unsuspecting ranger. Result: Ranges that are too large, or no range at all.

4. Command transmission time 4800 baud isn't lightning fast, so don't trust the total time from when you sent the ping command, unless you compensate for this. (This is probably not worth the effort.)

6. Conversion-factor error During Open-Day '95, a proportional error of ~.05 cm was occasionally noticed in the "How tall are you?" demo VI. We still haven't figured out why it happened. Frequently (and I mean frequently) restarting and recalibrating the app didn't seem to make a difference.

5. Incorrect/Inaccurate information in this info sheet All I can say is that I tried.


Acknowledgement: Part 1 Staff, Roger and the author of the Mac QuickBASIC program used in the 160 Labs.

Raspberry: Whoever lost the first version of this document, if it ever existed.