Sonar in a chip? I think I need a PIC programer....

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Mike6158
Posts: 409
Joined: Fri Nov 12, 2004 1:01 am
Location: Weimar, Texas
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by Mike6158 » Sun Jan 09, 2005 5:46 pm

Ok... The PIC will do what you want it to do. I'm almost sure of that. It can be programmed in ASM, Basic, C, ? Those are the languages that I know about. ASM is probably the least intuitive, Basic is easy, and I have no experience with C but I'm told that it's not too difficult. The PIC (and Basic Stamp) have a small instruction set so they aren't particularly difficult to figure out. The xmitter / sensor is the issue (or it would be for me. <p>That said, Bushnell makes a laser rangefinder that works out to 1,000 - 1,200 yards. Exactly what makes it tic I don't know but it's a compact device and it seems to be very accurate. Their older version was pretty good out to a couple of hundred yards (I have one of the older ones) If you could somehow find out what makes that tic then I think that your search would be over. The package size is pretty small but probably larger than what you are looking for. However, if you were to strip away the optics you would probably find that it's "brains" are pretty small and probably PIClike. Just a thought.<p>Here's a link- Laser Range Finder<p><EDIT> Just saw Stephen's post. Aparently we posted near the same time.. He's right... I didn't think about the laser needing nanosecond time measurements. For some reason light is faster than sound. Go figure. Anyway. If they make a PIC that will do that I don't know what it is. That said... someone makes the guts of the Bushnell range finder so what you want to do is within the realm of possible.<p>[ January 09, 2005: Message edited by: NE5U ]</p>
"If the nucleus of a sodium atom were the size of a golf ball, the outermost electrons would lie 2 miles away. Atoms, like galaxies, are cathedrals of cavernous space. Matter is energy."

rshayes
Posts: 1286
Joined: Tue Mar 04, 2003 1:01 am
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by rshayes » Sun Jan 09, 2005 7:29 pm

The Microchip web site (ww1.microchip.com) has an ap note on ultrasonic ranging (AN-597). They use a Polaroid module for the transmission and reception and only do the timing in the precessor. Code for this is also included.<p>If you have a clean, well defined pulse that needs to be timed, the PIC will probably work. If you need to do signal processing to detect the signal, a PIC may or may not work.<p>The highest clock frequency for the PIC products is 48 MHz, with most of them 40 MHz and slower. Another ap note (AN-526) gives routines for software multiplies. An 8 x 8 multiply takes 37 cycles and a 16 x 16 multiply takes 233 cycles. With a 40 MHz clock, these will take 925 nS and 5.825 uS respectively. One cycle of a 40 KHz signal takes 25 uS. Thus only twenty five 8 x 8 multiplies would be possible per cycle of the processed signal. That may be enough to detect the signal if the signal to noise ratio was good. A poor signal to noise ratio would require the additional dynamic range of the 16 x 16 multiply, and the PIC simply wouldn't be fast enough.<p>For an optical rangefinder, the PIC isn't even fast enough to function as a timer. One 40 MHz clock period corresponds to a distance of 25 feet. Incrementing a register and polling an input line might take several clock cycles, so the resolution might be as poor as 100 feet or more.<p>[ January 09, 2005: Message edited by: stephen ]</p>

User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by philba » Sun Jan 09, 2005 11:38 pm

With that much distance, I doubt that sonic ranging (ultra or otherwise) will work very well, if at all. Certainly you would need highly sensitive directional tx and rx. Ambient noise rejection will be a huge issue. Also PC sound systems microphone input isn't that good. I wouldn't expect it to pick up a sound from more than 30-40 feet away even with a good mic, probably less.<p>Ignoring the distance issue, a PIC can do this really easily. The ultrasonic designs are applicable to any frequency (even below the ultrasonic range). Use a comparator to detect when the input signal goes high (echo). You will need an amp+directional speaker for the "chirp" generation and a directional mic + amp on the receive side. Start a timer running when you generate the chirp (or what ever you call it) and when the comparator input goes high, stop the timer and you have time-of-flight. There are things you can do to improve the quality of the detection (modulate the chirp and reject unmodulated echos, for example). <p>The echo will have to stand out from the noise for the comparator to work. I am pretty sure this is your biggest challenge.<p>Good luck.
Phil

User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by philba » Sun Jan 09, 2005 11:57 pm

I though laser rangers used phase shift to measure distance.

Mike6158
Posts: 409
Joined: Fri Nov 12, 2004 1:01 am
Location: Weimar, Texas
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by Mike6158 » Mon Jan 10, 2005 3:59 am

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by philba:
I though laser rangers used phase shift to measure distance.<hr></blockquote><p>I have no idea. I know that the new 1,200 yard models are surprisingly very accurate. I know a couple of long range shooters, 1,000 yards, and they love them.
"If the nucleus of a sodium atom were the size of a golf ball, the outermost electrons would lie 2 miles away. Atoms, like galaxies, are cathedrals of cavernous space. Matter is energy."

rocket scientist
Posts: 25
Joined: Mon Jan 03, 2005 1:01 am
Location: san diego
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by rocket scientist » Mon Jan 10, 2005 2:42 pm

As long as the mic is acoutic noise limited, not self noise limited, it is good enough. I have never found the inexpensive ECM's that you find all over the place lacking in this respect (e.g. the Panasonic WM-64).<p>I think Tinkerer wanted to generate an echo as funciton of range as one would in a sonar, and not the range to the first big thing as in a range finder. These are two differnt problems, and I am not sure now which one he needs solved. <p>Estimating distance by phase change would have an ambiguity of an integer number of wavelengths. This is great for measureing very small changes in distance, but no good for measuring actual distance, unless you know its less than a wavelength.

Tinkerer
Posts: 21
Joined: Sat Jan 08, 2005 1:01 am
Location: Pennsylvania
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by Tinkerer » Mon Jan 10, 2005 3:39 pm

I do appreciate all the input, but let me repeat: ultrasound and light _will_not_ work in my application. I have already explored both and I'm developing something else specificly because they won't. I'm not going say any more about what I'm trying to do because I believe it to be patentable and more importantly, marketable, and you guys reading this are way too bright!<p>I'm only asking for help in processing the signal to get the distance. I'll handle the instrumentation end.<p>I think using my sound card is my best option for now. If I can make it work in a desktop THEN I can try to figure out how to cram the same function into a basic stamp.<p><I am almost sure you can read the sound card digital output in BASIC, but I use Matlab to read wave files from the sound card so I can't help you there. Find someone that can help you do this in BASIC and you've got it.><p>Ok, now we're getting somewhere. Can anyone tell me how to input/output/read/control a sound card with BASIC? I can write BASIC, but I don't know anything about the wav file format or sound cards.

Tinkerer
Posts: 21
Joined: Sat Jan 08, 2005 1:01 am
Location: Pennsylvania
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by Tinkerer » Mon Jan 10, 2005 5:41 pm

I just learned that sound cards have Automatic Gain Control. That's going to mess me up. Measuring amplitude peaks is vital, if I can't pick out peaks this won't work. AGC is going to equalize everything! Drat, and I was so close.

rocket scientist
Posts: 25
Joined: Mon Jan 03, 2005 1:01 am
Location: san diego
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by rocket scientist » Mon Jan 10, 2005 5:53 pm

Don't give up yet. I have used my soundblaster for research quality, calibrated sound measurements, and I have never seen anything that looks like and AGC effect. Where did you get this information?<p>Also, if you patent, you know you will have to include all of us as joint inventors. That is why we are so eager to help!

Tinkerer
Posts: 21
Joined: Sat Jan 08, 2005 1:01 am
Location: Pennsylvania
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by Tinkerer » Tue Jan 11, 2005 6:19 pm

It may be that some cards do it and others don't. I might have to invest some research time on various cards and their abilities. What kind do you use?

DakotaSIG
Posts: 1
Joined: Wed Jan 26, 2005 1:01 am
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by DakotaSIG » Wed Jan 26, 2005 12:37 pm

Here's a homemade sonar that uses a PC and soundcard:<p>http://eddiem.com/projects/chirp/chirp.htm<p>Scroll all the down the page. He's got source code to download too.

User avatar
Externet
Posts: 1862
Joined: Fri Feb 01, 2002 1:01 am
Location: Mideast USA
Contact:

Re: Sonar in a chip? I think I need a PIC programer....

Post by Externet » Wed Jan 26, 2005 1:57 pm

Hi.
Sonar on a chip :
National LM1812.
Miguel<p>Ω
- Abolish the deciBel ! -

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests