|Robots and Systems
|BARG Newsletter Issue 3/4, Spring/Summer 1985 p11 - 13 -- The Aargh Interface Mark II
|BARG Newsletter Issue 3/4, Spring/Summer 1985 p21 - 28 -- Zero 2 review, Letters, Index
The technical notes supplied with the equipment are not entirely clear, as they refer to four different versions of the ranging circuit board, as well as a separate designers' kit. The naming of various logic signals in different parts of the circuit is ambiguous, with signals of opposite polarity having the same name. In this article, the main references to the technical notes will follow their conventions with minor changes to avoid ambiguity. This applies also to those diagrams based on the technical notes, and which are included with acknowledgement to Polaroid.
The Polaroid part numbers are as follotws:
Instrument Grade Electrostatic Transducer Part No 604142 Unmodified 4-frequency Ranging Board Part No 606191 Unmodified Single-frequency Ranging Board Part No 606192 Modified 4-frequency Ranging Board Part No 606745 Modified Single-frequency Ranging Board Part No 607089 Cable assembly Part No 604789
There is also a commercial grade transducer available but it is not suitable for this purpose. Normally only modified boards are supplied, unless otherwise requested. The modifications involve the addition of two transistors, and connecting a 6-way ribbon cable to locations on the back of the board. The 4-frequency board has three i/cs, whereas the single-frequency board has 2. Use and Interfacing is otherwise identical.
Figure 1 is a block diagram of the circuit, and shows the control signals. VSW supplies upwards of 100 mA of current and is used to trigger the transmission of a pulse VSW should be kept high for at least 100 mS, then taken low for at least 40 mS. /XLDG follows about 5 mS after the application of VSW and consists of about 50 pulses at 49.1kHz (the 4-frequency board uses a combination of frequencies). The leading edge of this signal is used for all timing. /MFLDG is generated on receipt of the first echo, or after 65 mS, but not during the first 1.6 mS after /XLDG. Figure 2 illustrates the timing relationship. /XLDG and /MFLDG are not suitable for connection direct to the computer, and need to be buffered, as described later. These signals are also referred to in the technical notes as XLG and FLG, though these terms should really refer to the inverted signals foIlowing the buffers. There are other points on the board where signals can be tapped, for example to detect echoes other than the first.
Notes 1 POWER SHOULD NOT BE APPLIED TO THE RANGING BOARD UNLESS THE TRANSDUCER IS CONNECTED. OTHERWISE THE BOARD WILL BE DAMAGED. 2 300 VOLTS IS GENERATED ACROSS THE TRANSDUCER TERMINALS - HARMLESS BUT PAINFUL.
So, the ranging board requires an input signal at VSW, and provides two outputs at /XLDG and /MFLDG. These signals are not at TTL or CMOS levels and will need additional circuitry before they can be handled by a computer. A suitable circuit is shown in Figure 3. The PNP transistor must switch up to 150 mA, but otherwise the transistors are small signal switches. The 1 uf capacitor shown between VSW and GND should already exist on the ranging board, and if so can be omitted from the buffer circuit. As shown, MDL should not be taken high less than about 100 mS after going low, so that the capacitor can discharge. If required, the additional components shown in the inset can be included reducing the 100 mS to a minimum of 40 mS. As this is only an increase from 5 to 7 readings a second, it is not much of an improvement.
Operation then becomes a straightforward sequence:
First, apply Vcc with MDL low Then, for each reading; Take MDL high Wait for XLG (or XLGQ) to go high Count until FLG goes high Take MDL low Wait for 100 mSThe count will be proportional to the round-trip distance, as discussed in the first article. For example, if the count is 1 every 10 uS (100kHz) then each count will represent a distance of 3.43 mm (sound travels at about 343 mm/mS), or 1.71 mm to the object. A simple machine code loop will be sufficient if a resolution of around 1 cm is sufficient, otherwise a hardware counter would be required. A suitable Z80 programme segment is given below, which assumes that FLG is connected to d7 of a parallel port, XLG (or XLGQ) is on d6, MDL on d1 and that the port address is in register C. The other bits are ignored. The routine returns with the count In HL. Users of other processors will have to make do with the flowchart, unless they are bilingual.
xlg equ 6, ;XLG bit mdl equ 1 ;MDL bit start: ld hl,0 ;clear counter xor a ;enable MDL set mdl,a out (c),a wait: in (c),a ;wait for a pulse bit xlg,a jr z,wait_q count: inc hi ;count until FLG high c1: bit 7,h ;check overflow c2: jr nz,exit ;exit if so in (c),a jp p,count ;loop if bit 1 low exit: ret ;count is in HL
An alternative is to use a hardware circuit to do the counting, allowing the processor to attend to other matters until the result is available. Figure 6 is a block diagram for a hardware counter. If the clock frequency is arranged to be 171.6 kHz then the count would be directly equivalent to the distance to the object in millimetres to within a few percent. Such a circuit could run continuously, with the processor reading the last count as required, or by using an interrupt to signal a reading was available.
The Polaroid rangefinder has its limitations, of course. A cycle time of around 150 - 200 mS (I have worked it faster, but not much) means it cannot be used where fast response is needed - Ping Pong machine builders take note. The single frequency board can be operated at higher speeds than the four frequency board, as it is less prone to overheating. Polaroid suggest using a battery of devices time multiplexed to improve response, but sorting which echoes belong where would seem a bit of a nightmare.
A possibility that might work is to use a principle from radar. Bouncing the signal from a section of a parabolic reflector will focus the beam. To be effective, the reflector needs to be very much larger than the signal wavelength (about 7 mm In this case), and a 180 mm reflector should reduce the -3dB point to +-2.3 degrees. This is totally experimental, as I haven't tried it, and it depends on the sound waves behaving In the same way as light would in similar circumstances.
A glassflbre reflector could be moulded on the back of a car headlamp. Only a segment of about 1/3 of the headlamp is needed, as shown in Figure 7. The transducer would be mounted at the focus of the parabola, angled into the section so that it does not get in the way of the focused signal. If you try this idea, let me know how you get on.
As discussed in the earlier article, the speed of sound in air is dependent on temperature, and the values given have all assumed 20 degrees ambient. The error is not very great, as the speed varies by less than 2% in 10 degrees. If you intend to include a temperature sensor in your robot you can, of course, use this to provide compensation. The formula is given below. For the really
Distance to object = Distance to marker x (Time to object / Time to marker)The marker would need to be 30 cm, or more, from the transducer to clear the echo-blanking period following transmission.
Speed of Sound in Air : 331.4 x (T/273)^0.5 metres / Sec where T is air tenperature in KelvinElectrical Characteristics
MIN TYPICAL MAX UNITS Supply Voltage 4.9 5.6 6.8 Volts DC Continuous Current (Receive) 175 200 250 mA (Standby) 30 37 50 mA Peak Current (Transmit) 2500 3000 mA VSW Input Current (High) 100 150 mA /XDLG Output Current (Low) -0.5 mA /XFLG Output Current (Low) -1.0 mA