Having trouble with a Sonar

Hello to the group,

I built a sonar just as a rangefinding instrument for now. Eventually, I will be wanting to install one on a bot I am working on. This one has an LCD so I can read the range right off it.

I am using 40Khz matched pairs from Jameco. It worked on the breadboard, and even when I put it onto pc boards. Now that it is in the box, and the 2 sensors are mounted on the front, I keep getting the same number of digital counts, no matter what the range. The number of counts corresponds to the 3 milliseconds my micro is waiting before it checks for the echo.

When I changed the software to wait 6 milliseconds, I get the number of digital counts (from the clock, that is) that correspond to 6 milliseconds.

Does this sound like a damping problem with the transducers? If so, does anyone know of a material I can use to isolate the two transducers?

I am using the Atmel avr ATmega8515 for my microcontroller.

I am thinking it must be that , since they are piezo, the transmitter doesn't just stop transmitting as soon as it is turned off , it 'rings' for awhile, but I have O rings mounted under each transducer to try and dampen the effect. I am not sure what material they are made of.

Summary, worked fine till I mounted both sensors and everything else into an abs plastic box. I can still work on it. I have not closed it up, I just thought I would test it before I did close it up to make sure I did not make any wiring mistakes.

If anyone has any links, info, suggestions, would be much appreciated.

Thanks, Joe

Reply to
Joe
Loading thread data ...

Did you try taking it back out of the box to see if it started working again? This would rule out the breaking of the thing while mounting it in the box.

BRW

Reply to
BRW

So how does the receive side work? Do you have an amplifier with increasing gain over time? Are you watching for the pulse pattern the send side sends? These things aren't digital devices. They need a receiver with some smarts, or they either won't trigger or will trigger on every bit of noise, mechanical or electrical, around.

Devantech and several others sell sonar ranging modules built around those things.

John Nagle

Reply to
John Nagle

Hello gents,

Sorry I took so long to get back to you.

Actually, last night I started to remove the boards from the box while I was monitoring the receiver output, which should have been at a steady 5Volts (It is active low), but was pulsing away at 250 Khz.

When I took the wire from the micro "echo" pin, ie the pin that detects when the receiver goes low, away from the front of the receiver, the 250Khz signal just stopped. When I put it back, it started up again.

OK, so I kept it there and tried to trace it back thru the circuit. I will give you a brief summary of how the circuit is constructed. Receiver Transducer is capacitively coupled to a TL082 opamp with gain = 75 (the max it will do for 40Khz). That output is capacitively coupled to the 2nd TL082 with a gain of about 40 (470K feedback, 22k input resistor). Now from about 2 meters, the output from the amplifier section is saturated at 3.8 volts.

These opamps are only spec'd at Vcc-1.5 or so. My output at this point is a square wave that is approximately symmetric about zero. A reverse bias diode to ground clamps the negative portion and I now have a square wave from ground to 3.8 volts.

That 3.8volt square wave then goes thru a common emitter transistor (2N2222) amplifier with a gain of 3, just to increase it to a nice 5V square wave. That signal is fed to a 2N 4401 in a switch configuration. So it is held high by a 10K resistor , till the signal comes in. The 'echo' pin wire has to go to a 300 ohm resistor between the 10K and the collector of the switch so the micro won't sink too much current when the transistor switch goes low.

When the transistor switch goes low, it tells the micro that an echo has been detected.

If you are not all totally lost by now, this is the fun part. The micro pin that detects the low output is pulled up by an internal pullup resistor (internal to the micro). My micro is running at 8 MHz, but I had to scale it back by 64, so the actual clock frequency is

125Khz. You see what's coming. 250 Khz is the second harmonic of the clock, and somehow it is coupling into the last stage ( the transistor switch) , but only when the wire is in front of the receiver board, not when it is between the receiver and micro boards.

Only the last stage of the receiver board was affected. When I checked the common emitter transistor amp, and the outputs of the 2 opamps, there was nothing.

Hey, I am not complaining. The fix was easy. Just move the wire.

I need to visit the Atmel site though. They definitely have EMC issues with this micro anyway, and maybe others.

John, to answer your questions,

I believe I answered the first part of your question already. The send side is sending a 600 microsecond pulse train, rather then a continuous stream of pulses. It sends about 16 pulses to the target. And, yes, that was working fine.

These things aren't digital devices. They

Yes, I know that. I tried using the 24 Khz modules and I discovered they were picking up audio frequencies. My dog happened to come into my workshop while I was monitoring one of the amplifiers, shook his collar with his tags on, and my scope trace went wild. So I took off his collar and tried it a few more times, same thing. That is why I went back to 40Khz. Hell of a lot less noise up there.

Yes, several companies sell them. I like to build all my own stuff though. That way, when something goes wrong, I can usually fix it. This has been an ongoing project for the past 3 months or so. Testing and trying this and that on breadboard till I had a good long range sonar candidate for my outdoor bot.

Thank you for the suggestions. I am glad I could fix this one myself. Beware avr users though.

Joe

Reply to
Joe

Joe, I applaud your initiative. My former company made autmotive bumper products. We were very intersted in marketing a backup up indicator. It would use these same Ultrasonic sensors (40K), with a control head indicating the distance behind the vehicle. We purchased this as a kit (Sensors, Wiring Harness and Control Head). The control head had a digital display. Out of the package, we were able to sense out about 15 feet (15.0 on the display). When we installed it in the bumper, the sensitivity went down. We had to electrically and mechanically isolate the sensors, otherwise they would give false readings. Again, these are mechnanical devices. The moral is that these are very sensitive instruments, and they work differently, when they are installed. You may have to install them before you test them...then tune the circuitry to the prebuilt system. The botttom line is that we could not depend on them...sometimes they would work, other times not. That could be disasterous if a Kid on a bike, or a little ol' grandmwa was behind you. We ended up scrapping the whole idea.

Reply to
The Computer Dood

Thanks dood,

I can see how a company may be liable if a tragedy such as you describe above happened. I built this from just the 2 sensors I bought from Jameco. It has been a fun project.

It works now. It's good to about 5 meters one way. After studying the physics of piezoelectricity, I knew I had to isolate them from each other. I know piezo rings for awhile after you take the voltage away (mechanically). This ringing would cause the receiver to get a false reading. They could also electrically couple, but my receiver stays off till the transmitter is finished sending its burst.

I was just analyzing some data I took over the past few days. It is great out to 400 cm or so, then I start to get false readings, and crazy stuff happens. I was thinking that since the attenuation in dB/ ft for sound is proportional to the frequency, maybe I will go with just regular audio, around 10Khz.

That's after I perfect the optical rangefinder I have started.

Later, Joe

Reply to
Joe

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.