| Sonar Ranging Primer Last Modified: 2006-09-06 | | |
| Acroname Robotics | |||
| Introduction Theory of Operation Blanking Selecting a Transducer Interfacing to Microcontrollers Power Supply Issues Noise Issues 6500 Board Pinout Precautions Rotating Proximity Scans Problems: Nothing works and voltage readings make no sense Problems: Ping causes microcontroller to reset Problems: ECHO is returned immediately upon ping regardless of object distance Problems: My new board looks different from my old one! Salvaging Sonar Modules from Old Cameras Further Reading Credits and Contributions Introduction A common technique in robotics for proximity detection is time-of-flight measurement (TOF). This is often accomplished using the Senscomp 6500 ultrasonic ranging module and an appropriate transducer. There are other options but the Senscomp modules are very popular because of their ease of interfacing and relatively low cost. Senscomp has done much of the work by providing the DC-DC conversion, blanking, stepped-gain amplification, and signal conditioning in one package that has a single 5 volt voltage requirement. This article briefly describes the theory of operation of the module and offers some tips on interfacing the module. Thanks to Senscomp for providing a great sensor and the information needed to use it. Theory of Operation The basic principal of operation for sonar ranging is the same no matter what system is being used. The sensing is initiated by first creating a sonic ping at a specific frequency. In the case of the Senscomp module, the ping is roughly 16 high-to-low transitions between +200v and -200v. These transitions are fed to the transducer at around 50 kHz. For reference, the human ear can hear sounds in roughly the 20 Hz to 20 kHz range. As this chirp falls well out of the range of human hearing, the ping is not audible. Sometimes you can hear the transducer click as the chirp is sent. The chirp moves radially away from the transducer through the air at approximately 343.2 m/s, the speed of sound. This is roughly 0.9ms/foot. This speed is only slightly affected by humidity and virtually not affected at all by pressure and therefore is almost independent of altitude. Since the chirp is spreading out radially, the signal strength as the chirp moves farther from the transducer is reduced by 1/d^2. This means that the maximum measuring distance drops off rapidly at the extreme maximum of the sensor. When the chirp reaches an object, it is reflected in varying degrees dependent on the shape, orientation, and surface properties of the reflecting surface. The Senscomp ranging system is capable of detecting amazingly small obstacles such as a flower stem at several meters. This reflected chirp then travels back towards the transducer, again at the speed of sound. The transducer is especially sensitive to noises around 50 kHz like the chirp. As the reflected signal hits the transducer, a voltage is created which is fed to a stepped-gain amplifier. Since the signal decreases in strength with distance at an inverse squared proportion, the gain of the amplifier is increased exponentially (~d^2). This helps give the best sensitivity across the range of the detector which is roughly 2 feet to 35 feet. Once the ranging module "sees" enough cycles of the reflected signal, it changes it's ECHO output to reflect the received reflected signal or echo. All that is left to do is to measure the time from the initiation of the ping to the received echo. This time corresponds directly to the distance traveled by the ping. ![]() A Senscomp 6500 Ranging Module Blanking One additional task for the ranging module is to "blank" the transducer just after the initial chirp is emitted. Since the receiving circuitry is very sensitive to the signal created during the chirp, any sonic or electrical residual such as the ringing of the transducer or noise after the chirp could be interpreted by the receiver as an echo. To prevent this, the ranging module automatically blanks the transducer by locking it up to an extreme by putting a dc voltage across the inputs to the transducer for a small amount of time. The default blanking time in the 6500 module is 2.38ms. This blanking interval dictates the shortest time allowed for the echo to be received which is effectively the minimum distance the ranger can detect. This blanking is very similar to H-Bridge designs that are made to "brake" a drive motor. This principal can also be found in Electronic Speed Controls for radio controlled cars. The automatic blanking can be overridden at the risk of false readings using the BLNK input to the 6500 ranging board. This input allows you specify when the reciever circuitry is to blank. In this way, you can obtain echo information from multiple objects in view of the detector. ![]() Two-echo timing diagram showing blanking input after each echo. Selecting a Transducer Senscomp offers several choices for transducers. They all are driven the same way and have slightly different characteristics. ![]() Front view from left to right, Series 9000, Instrument Grade, and Series 7000 transducers ![]() Back view from left to right, Series 9000, Instrument Grade, and Series 7000 transducers The basic transducer which is often used in robotics is the Instrument Grade Transducer. It is general purpose and quite accurate. Another common choice is the Series 7000 transducer. This transducer is slightly cheaper than the Instrument Grade and has a slightly wider beam pattern. It is also smaller in size. This Series 7000 transducer is a great choice in single-transducer designs and since it has a slightly larger beam pattern, it can be used more effectively on robots that don't have the luxury of a rotating head. Finally, the Series 9000 transducer offers an oval beam pattern and is designed to withstand harsh environments where it may be exposed to water, grit, salt, etc. The Series 9000 transducer has a peak frequency response at around 45kHz and a different impedance than the Instrument Grade and Series 7000 Transducers. Using the Series 9000 Transducer with a 6500 ranging module requires some modifications to the board to compensate for these differences. Interfacing to Microcontrollers The interfacing of the 6500 module to a microcontroller is not too difficult. The simplest connection requires only two lines, one output for INIT, and one input to receive the ECHO. In this mode, BINH and BLNK are just tied to ground as they remain low through the entire measurement cycle. If you want to do your own blanking, you will also need to have output connections to the BLNK and BINH inputs bringing the total lines used to four. The board can be wired directly from the 6500 board's cable connector to the pins of most micros including PIC, 68HC11, and BasicX. The only exception is the ECHO line which is an open collector This pin needs to have an external 4.7K Ohm pull-up resistor in order to work properly. Power Supply Issues The power requirements of the 6500 ranging module are pretty modest when not in use. The module consumes roughly 100 mA in standby mode. When in use, however, the power requirement jumps momentarily to 2 Amps. This huge jump can wreak havoc on microcontrollers and other circuitry sharing the power supply. Senscomp suggests putting a large capacitor (~500 uF) across the power lines on at the connector to the 6500 ranging board's thin cable. This capacitor should be of a low ESR type to avoid voltage drops as the capacitor drains. A microprocessor that is sharing the power supply with the 6500 board can also create unwanted noise through digital hash. An RF Choke or "Hash Choke" can be used to isolate the ranging board from such unwanted noise. Noise Issues One of the most common problems when hooking up the Senscomp Ranging board to a microcontroller is noise on the BINH line. This line is very sensitive to noise even when grounded at the far end of the thin flat connector cable. The result of this noise is for ECHO to go high right at the end of the blanking interval regardless of the distance to any object. Since the BINH line is not typically used (unless you are doing multiple echo pings), you can avoid much of this noise problem by directly wiring the BINH line of the digital chip on the 6500 board to GND. Since this chip is socketed, you can just jumper pin 3 (GND) and pin 15 (BINH) on the digital chip to ensure a clean BINH. If you do this, then you should make no connection to the BINH line at the other (controller) end of the the thin flat connector cable. Another suggestion to avoid the instant ECHO problem is to isolate the ECHO line from possible noise on the V+ line. This is typically done using a ceramic 1uF capacitor directly on the back of the 6500 ranging board between GND (pin1) and V+ (pin 9) of the flat cable connector. If you use this approach, care should be taken to avoid shorts involving the leads of this filtering capacitor. Tape or shrink-wrap the leads to protect from contact with the other connector pins. 6500 Board Pinout The 6500 9-pin connector is a bit confusing. Here is a diagram that shows the basic pinout for this board. ![]() Precautions The 6500 ranging board and transducers are pretty easy to work with. Because the voltage at the transducer connectors is high (400V), you should take care to avoid both touching with your hands, and shorting them out while the board is in operation. The current is fairly low but the shock you receive when you touch these connectors for the transducer when it is firing smarts. It will not hurt you but you will definitely feel it. Shorting the transducer connectors out will typically fry the drive transducer on the board rendering it useless if the board fires while shorted. Take extra care with any metal that may contact the back of the transducers when mounted to avoid this. Either chip on the board can be fried if the power and ground lines are reversed when you hook up the board. The digital chip is socketed so it can fairly easily be replaced but the analog chip is soldered so it is harder to replace. Rotating Proximity Scans Often, a Senscomp system is used on a rotating head. In this way, a scan can be performed which maps the proximity of objects surrounding the robot without the robot moving its base which could lead to loss of orientation. This scan is achieved by rotating the head and stoping to take a distance measurement. The head is then rotated to the next position and a new distance is recorded. Most people find the best results with scans when the measurements are made approximately 15° apart throughout the scan. ![]() Problems: Nothing works and voltage readings make no sense This may be a power supply grounding problem. If you are using a separate power supply for the sonar, be sure it shares a good common ground with the power supply for the processor. Remember to put a 4.7K pull-up resistor at the ECHO output of the sonar board. Problems: Ping causes microcontroller to reset This is typically caused by the momentary surge in current when the board pings. See the section on Power Requirements about adding a large capacitor near the connector to the board to remedy this. Problems: ECHO is returned immediately upon ping regardless of object distance This is often caused by unwanted noise on the board or on the BINH line. There are two things two try to remedy this problem. First, try a small 1.0uF ceramic (30WVDC) capacitor directly on the back of the ranging board between V+ and GND (pins 1 and 9) at the thin ribbon cable connector. You can solder this capacitor on the back of the board at these pins and add some electrical tape to protect the pins of the capacitor from shorting out against the other connections on the back of the board. Second, this only applies if you using the default blanking on the board. The BINH line is very susceptible to noise even when connected to ground at the end of the thin ribbon cable. You can directly wire the BINH line (pin 15 of the digital chip which is socketed on the board) to GND (pin 3 of the digital chip). This will eliminate the possibility of noise in the automatic blanking mode. Problems: My new board looks different from my old one! Old Polaroid 6500 boards were tan with through-hole components. Senscomp redesigned the 6500 boards for surface-mount components. These new boards are green. Apart from these differences, the process for getting range measurements from the boards has not changed. We've heard only one report of differences in behavior between the two boards. It affects Handyboard users. When using the Handyboard's standard Polaroid/Senscomp sonar software with the new 6500 boards, the sonar initialization code may need to set the BINH line to zero, as shown below: void sonar_init() {
bit_set(0x1009, 0x30); /* ddrd */
bit_clear(0x1008, 0x30); //set binh to zero
bit_set(0x1021, 1); /* at tctl2, */
bit_clear(0x1021, 2); /* set tic3 for rising edge */
}
Thanks go to Orin Hoffman for finding this problem and figuring out a fix. Salvaging Sonar Modules from Old Cameras The Senscomp Sonar Modules were originally designed for use in auto-focus cameras. Sometimes it is possible to find an old Polaroid camera for a few bucks at a garage sale. It might not take a picture, but the sonar may work fine. One problem with this approach to getting a sonar is that some of the units may differ slightly from the standard 6500 board. Jim Remington has dissected some of these old cameras and has a great web page about salvaging the sonar units and getting them to work Further Reading Johann Borenstein of the University of Michigan work on Error Eliminating Rapid Ultrasonic Firing . Credits and Contributions As usual, we want to provide the most accurate information possible. If you find errors in this article or would like to see something added, please contact us. You will be given full credit for your contribution or correction. We would like to thank Polaroid, Senscomp, and specifically, Phil Jackman who designed the 6500 ranging module, for providing information and giving us permission to reprint various pieces of the application notes. Above all, we would like to thank them for providing one of the most popular sensors used in robots today. | ||||||||
Related Links: Ideas: Driving a Series 9000 Transducer with a 6500 Ranging Board Ideas: Hacking the Polaroid 6500 Connector for Standard DIP Spacing BrainStem Tutorial to Log Sensor Readings to a File on the Host Related Examples: Interface between SensComp 6500 Ranging Module and BrainStem GP Example SensComp 6500 Module with 7000 Transducer Interface to Basic Stamp II SensComp 6500 Module with 7000 Transducer Interface to OOPic | |||||||||
| voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy © Copyright 1994-2012 Acroname, Inc., Boulder, Colorado. All rights reserved. |