Modifying Sonar Ranging Modules from Late Model Autofocus Cameras

(simplified interface and multiple echo capabilities)

Jim Remington

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.Popular Polaroid autofocus

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. Ranging module types

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.

Camera Disassembly

In all of these cameras, the internals are located in an intricate snap-together assembly that slides forward from the case. Popping the case I'll use examples from the Sun 660. Start by opening the film door and prying at the sides (left) with a flat blade. On the Sun 660, there are four snap fittings, two on each side (circled). After pulling out the internals, the ranging module is located in the front shelf of the camera with a shielded cable connecting to the transducer. It can be popped off by prying aside the plastic hooks. Pull the flexible printed circuit connector out of the module and carefully remove the transducer from the camera. (For more information on some of these steps, consult the details in sonar camera disassembly in the article by Dennis Clark). Module and transducer When you are done, you have the board and transducer shown here. The transducer for the Impulse AF camera is pretty cheesy (left), but it can be removed from the camera and used. It does not have convenient mounting characteristics, so I used instead the instrument-grade transducer from a Pronto OneStep, which works well with the Impulse AF board. Impulse AF transducer

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... Spectra module and transducer

Module Properties.

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 connections.

Function Sun 660 J1 Pin Impulse AF J1 Pin Spectra J1 Pin
GND 1 1 17
(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):

  1. The digital chip has inputs corresponding to the INIT, BINH and BLNK of the experimenter module, but only INIT seems to function in the same way. A high on this input initiates a ping.
  2. The ECHO output latches high and the chip must be powered down after each ranging cycle to reset it. Pin 15, the "BINH" input, if taken high, will force ECHO low but will not reset the latch. ECHO springs back up immediately when pin 15 is allowed to go low. The chip will not respond to a further INIT pulse when latched. Pin 15 may function as BINH before ECHO latches.
  3. The ECHO output is not open collector as in the 6500 Series modules. If the digital chip is powered down but the ECHO output is kept high by a pullup resistor (or even by connecting this output to a standard TTL input) the chip will remain latched up by parasitic power drawn through ECHO!
  4. I was unable to determine the function of the pin 16 of U2 (BLNK on the TL851), although it does appear to be an input. High or low signals here have no obvious effect. Both pin 15 and pin 16 do seem to be used, but differently on the Sun 660 and Impulse AF cameras as evidenced by associated circuitry.
  5. The OSC output of 93.3 kHz is very useful for ranging. The period of this oscillator corresponds to about 0.012 foot of travel for the ultrasonic pulse at room temperature and this can eliminate processor-dependent timing considerations. A microprocessor counter input connected to this output would simplify coding, as 80 counts ~ 1 foot of there-and-back travel. A simple and fast scaling procedure is to shift the count right by four (divide by 16) to get the range in units of 0.1 foot or 30 mm.
The Impulse AF J1 connector has two connections Impulse AF J1
pinouts to pin 15 of U2 ("BINH") as shown at right.

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.

Board Modifications

You will need a fine-tipped soldering pencil (30 watts max) and a desoldering tool. Specialized desoldering tools exist for chips that heat up all the pins at once, but I use a "solder vacuum", a spring loaded vacuum tool with a teflon tip. Desoldering tools Removing J1 I also filed down the tip of my 30 watt soldering pencil to make a narrower point than when purchased.

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.

Board Function CheckBoard
function test

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). Freeing a pinU2 removal 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.

Proceed to Checkout New digital chip

Final checkout involves inserting the TL851 chip and checking out the operation. If you are using the Impulse AF board, some decisions need to be made about the BLNK and BINH connections. If you do not want to use these functions, you need not do anything as they will be effectively low. If you do want to use these functions, take into account the circuit diagram above that was deduced from the two boards that I looked at. You will probably need to remove the 80 microfarad capacitor at least.  I had originally removed this capacitor and the 360 ohm resistor connected to pin15 of U2, thinking that they may have had something to do with the apparent failure of chip to respond to some inputs, but that was not the case. It is recommended that if you do not use BINH or BLNK to connect both pins to ground. 4.7K pullup on ECHO Don't forget to put a pullup resistor from ECHO to V+ and a large capacitor (470 uF or larger) from V+ to ground! (Why? See below). There is room for the resistor between the traces on the solder side of the board (Impulse AF module shown here).

Example Application: Sonar Scanner

Using a pancake style stepper motor salvaged from an old Seagate 20 Mb drive (4 coils, 85 ohms per phase, 200 steps/revolution) I constructed a simple sonar scanner circuit similar to one first presented by Steve Ciarcia in Byte Magazine in November 1980 (a later article by Steve is reprinted by Micromint). It works great! (see below).

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. Sonar 
applicationScanner front view

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.

Multiple Echo Capabilities

My initial experiments with the multiple echo feature indicated that this presents an interesting and nontrivial challenge. First, the 16 pulse ping is about 320 microseconds long, so an object could produce up to 16 detectable but closely spaced echos. Imagine a wave train about 10 cm (4") long spreading outward through space at 340 meters/sec (1100 ft/sec). Assuming that the first pulse of the train activates ECHO, one approach would be to ignore the remainder of the pulses in the packet by asserting BLNK for about 500 microseconds.

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. Scanner screenshot

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.

Why put a large, preferably low "equivalent series resistance" capacitor from V+ to ground?

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.

Final note: Speed of sound in air

Surprisingly, the speed of sound depends only the average molecular mass of an (ideal) gas and its temperature. It does not, as is commonly believed, depend on the density or pressure. In dry air, a good approximation is 331.4 + 0.6Tc m/s where Tc is the temperature in degrees Celsius. It is possible to measure the approximate temperature of air using the 6500 module and by timing the ping for a known distance.

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.

Site Meter