The ultrasonic ranging modules in the autofocus cameras manufactured by the Polaroid Corporation have great appeal to robotics enthusiasts. Although they appear in several different cameras, the same basic design is used in the various implementations. All function by emitting 16 pulses at about 50 kHz shortly after initialization and utilize a variable-gain amplifier and level threshold for reception of the echo pulse. An output allows timing of the round trip distance to the nearest target.
The modules (as salvaged from cameras) are robust, cheap, always seem to work and there are lots of them available. Three basic camera types that are commonly available in thrift stores or eBay are shown here.
Several sources on the Web (for example, the article by Dennis Clark for the Seattle Robotics Society) detail modifications required to salvage the modules from the older style Pronto OneStep (left, center) or similar models, but these modules (right, top) suffer from several limitations, such as the requirement that they be powered down after each ranging cycle. The boards are odd-shaped and contain shutter and motor drive functions that are not particularly useful for experimenters. Finally, the output signals are not TTL compatible and range from about 0 to 2V.
For some years Polaroid offered a general-purpose ranging module (Series 6500) and a variety of transducers. They are somewhat expensive and lately are not being manufactured by this company. Thus, it is worth having a closer look at the ranging modules in the later model autofocus cameras, such as the "Sun Autofocus 660" or the less common "Impulse AF" (above, left and right). In these cameras, some of the camera-specific functions have been relocated to chips on flexible circuit boards elsewhere in the camera, and the resulting simplified ranging module looks very similar to the Series 6500 module. However, the internal circuitry is not the same. The most important differences are in the digital chip (U2) that handles the logic functions and oscillator timing.
In this article I describe in some detail how to remove and modify the ranging modules from the Sun 660 and Impulse AF cameras, such that they function identically to the Series 6500 modules. The modified modules do not require external components for interfacing to a computer or microcontroller and have multiple-echo capabilities.
I recently obtained and disassembled one of the the Polaroid Spectra cameras. To disassemble this camera, remove the top first (check for pins under the top on one side and the back that will need to be slipped out sideways). The sonar board (right) is at the back and contains switches for options. The Spectra appears to have the same circuit as the Sun 660, but the board design is quite different and J1 has 17 pins to accomodate the switches and jack. The pins indicated in the table below connect directly to U2 as in the Sun 660 camera. Pin 1 on J1 is in the CENTER of the module.
Warning: on some Spectra cameras/modules, there is an "autofocus disable" switch which when activated, shorts the connection between the REC pins of U1 (pin 9) and U2 (pin 8) to ground. I have not attempted to modify this board and anticipate some difficulties with these option switches depending on their settings and/or whether they are removed. I have not traced the circuit in its entirety but I recommend that you do so if you wish to use the board.
The rangefinder of the Spectra contains a cool, very tiny two digit 7-segment display (1 mm segments) on a small circuit board. Hmm...
The modules in the Sun 660 and Impulse AF cameras look like the Series 6500 modules produced by Polaroid but the digital chip (U2, the chip near the yellow ceramic resonator in the figure at left) has different functions. The camera connectors, labelled J1, have either 8 (Sun 660) or 9 (Impulse AF, staggered) or 17 (Spectra) pins. The pin functions and positions do not necessarily correspond with J1 of the 6500 series module. Pin 1 is closest to the edge of the board for the Sun 660 and Impulse, but in the center of the board for the Spectra.
The circuit diagram for the 6500 module supplied by Acroname
is, for the most part, valid for the camera modules except for the J1
|Function||Sun 660 J1 Pin||Impulse AF J1 Pin||Spectra J1 Pin|
|(BLNK) - Pin 16 U2||2||2||7|
|(BINH) - Pin 15 U2||3||3 RC to Pin 15 U2||8|
|INIT - Pin 14 U2||4||4||4|
|Filter - Pin 13 U2||5||5||12|
|OSC - Pin 10 U2||6||6||9|
|ECHO - Pin 9 U2||7||7||10|
|(BINH)||N.A.||8 Diode to Pin 15 U2||N.A.|
|V+ - Power||8||9||13*|
* On the Spectra2, Thad Cutsinger reports that V+ is pin 11, not pin 13. The other connections appear to be as in the table above. Thanks, Thad!
The digital chip (U2) has the same pinout as the Series 6500 chip (TL851), but has some important internal differences. After a couple of hours of experimentation with an oscilloscope and a computer to drive the board I determined the following (mostly using the board from the Impulse AF camera, but the Sun 660 seems to behave very similarly):
The Sun 660 and Impulse AF ranging modules can be used without modification if one is not interested in the BINH or BLNK functions. However, in order to reset the digital chip in these modules, after each ranging cycle the module must be powered down as with the older autofocus cameras. One solution, requiring a bit of extra circuitry, is provided in the article by Dennis Clark. One disadvantage of this approach is that there must be 3 signal lines from the controlling microprocessor: PowerUp, INIT and ECHO. A delay must follow the PowerUp signal for the oscillator to stabilize before INIT can be applied.
Both of these camera boards can be made to function exactly like the Series 6500 module, which requires only the two signal lines INIT and ECHO for the simplest applications. This simply involves replacing the digital chip U2 as follows. Perhaps the only source of the TL851 chip is Senscomp.
Start by removing the useless connector at "J1". It is possible to remove it pin-by-pin with a solder pencil and a pair of needlenose pliers, but using the soldervac will give you necessary practise for the chip removal. With the board clamped upside down in a vise, heat up each pin connection until the solder melts and quickly suck up the solder by cycling the pump and the yellow release lever shown in the figure. It helps to put the white teflon tip flat as possible on the board, but work quickly! As shown below, if the pin moves in the hole after this procedure, it is free. You may have to "pop" it free with a small pointed tool. When all 8 (9) pins have been desoldered, the connector can be pulled out easily as shown above right.
Next, check out whether the board functions. Attach the transducer and wires to J1 at V+, GND and INIT. ECHO is not needed at this point unless you are curious. If the board doesn't pass this test, it is probably not worth the effort to desolder and replace U2. However, I have yet to see one fail in about 6 camera disassembly operations. Apply 5 volts between V+ and ground, then connect INIT (green lead in figure) to V+. You should hear a click. This is the transducer ringing after the ultrasonic pulse has been emitted. Attempts to connect INIT and V+ will not produce further clicks until the power is cycled off and on again. In the photo, ECHO (the yellow lead) has been connected to a scope probe for signal verification.
Next, desolder U2. With practise, this takes about 10 minutes (if you are nervous, try removing chips from a junked circuit board). Note: the Sun 660 modules are double sided and have "plated through" connectors which are harder to desolder than the single-sided Impulse AF boards, but the Sun 660s seem to be more readily available.
Clamp the board upside down in a vise. As each pin is desoldered as briefly discussed above, test to see if it can be wiggled with a small screwdriver as shown here (pin 15 of U2). In this case, all of the pins have been successfully desoldered even though some solder remnants are visible. Sometimes a pin can be popped loose with a bit of pressure. Avoid overheating the signal traces as they will break free from the board! If they break or come off, the connections can usually be repaired with fine wire. I slipped and damaged the trace above pin 3 of U2, but the board still works. When all pins are loose, remove the chip by prying gently. Note the ground connection to pin 3 on the top of the board in the figure at right. Insert a 16 pin IC socket and solder it to the board. Be sure to inspect the modified board carefully with a magnifying glass to ensure that there are no solder bridges between pins or traces. It is a good idea to plug the "old" chip back into the new socket and retest the board before moving on to the next step.
Note the added 470 uF capacitor on the sonar board... if your 5V power supply is not well filtered, you should have at least 1000 uF total to handle the large peak current the module draws during the "ping" to avoid causing a serious drop in V+. I measured 1 amp peak, which is the C5 (.0022 uF) bias charging current, on the Impulse AF board.
The 12 V stepper motor works well on 5 volts and allows a maximum half-stepped angular resolution of 0.9 degrees. Since the sonar transducer has a response pattern that is about 15 degrees wide, the sonar image obtained by the scanner is a smeared out view of its surroundings. The response pattern of the detector (the point spread function) is published, so my next project will be to use image deconvolution to correct for this smearing effect.
If you are interested, for my initial tests the scanner was exercised by a *recently updated* QBASIC program through a simple interface to the printer port on a laptop (EXAMPLE code only!). This little program maps out 180 degrees of scanner space on the graphics screen in a DOS box. It should be run in DOS mode, not under Windoze, because the Windoze interrupts will play havoc with the timing loops and render the display nearly uninterpretable.
The schematic for the interface is available in either PDF or in PNG format. I used higher current transistors than the 2N3904 specified here, but the 3904s will work fine if the coil current is kept low (in my example it is about 60 mA/winding at 5V). For beginners with stepping motors, there are excellent tutorials on theory and practise in use of stepping motors and on using steppers salvaged from old floppy disk drives. The latter site also has a nice description of the pin functions of the PC printer port. Of course, the sonar ranging primer by the Acroname folks is an excellent resource.
It is complicated to get simple empirical timing loops right for this and to simultaneously use them to time the echos, so a separate timing clock would be very useful. My current solution, recently implemented in the above program, is to simply collect all of the echos (presently up to 200) and display them. The images obtained are complex and interesting! A little processing would be required to get the average location of each packet of echos, but the number of received pulses in each packet might be useful to estimate the size of the object. For an annotated "screen shot" of typical program output and the corresponding room layout, click on the image to the right.
Second, after some experimentation it is clear that although the multiple echo detection feature works quite well, interpretation of even the second echo can be difficult. In a simple setup with a few objects on a table, echos appeared in what should have been empty space. This may be due to reflections between nearby objects, but it will take some effort to sort this out.
From basic physics, the charge on the capacitor Q = CV. The current flow is I = dQ/dt = C dV/dt. Assuming that the power supply has limited current supply capabilities (high internal impedance) and that the capacitor must supply all of the module current during the period of 1 pulse 1/(50 kHz) = 20 microseconds, one can estimate the voltage drop across the capacitor from dV = (I/C)dt. For example, if C=47 uF, I=1A, dt=2 x 10^-5 s, the voltage drop across the capacitor (delta V) is approximately 0.5 volts for each of the 16 pulses. The module will cease functioning after just a few pulses, because the module supply voltage will drop below an acceptable level.
Feel free to email me (sjames_remington,at,yahoo,dot,com) with comments, questions or suggestions.
Impulse AF, Spectra, Sun 600/660 and Pronto OneStep are trademarks of
the Polaroid Corporation.
Thanks to Colin Mitchell and Ryan Willobee for suggestions.
last update: 7/19/05
Copyright (C) 2002,2005 by S. James Remington. All rights reserved.