EmbeddedRelated.com
Forums

8051 and sonar (depth finder)

Started by Unknown December 28, 2004
Hi all,

Recently I am stuck on my first microcontroller project. I think I have
everything nailed down to the absolute last detail, but have not yet
been able to find a solution to this - after about 6 weeks of looking.

My 8051 microcontroller is trying to determine the ocean floor depth.
To do this, it sends out a ping, enables a timer, and counts how long
until the echo is returned. Simple enough - right?

My problem is not in the sending of the ping - or in counting the echo
return (I use timer0 and expect no overflows), it is simply in getting
back a consistant echo. Echos that I do recieve range in time from 500
ticks to 60000. When I turn off my labview echo simulator - I still get
the wildly varying and inconsistent results! Help!

I can provide schematics if necessery. For now I will keep it simple by
saying I detect echo signals generated from the comparator1 interrupt.
An active low indicates a echo.
Any help would be greatly greatly appreciated.
-David

jentzd@gmail.com wrote:

> Hi all, > > Recently I am stuck on my first microcontroller project. I think I have > everything nailed down to the absolute last detail, but have not yet > been able to find a solution to this - after about 6 weeks of looking. > > My 8051 microcontroller is trying to determine the ocean floor depth. > To do this, it sends out a ping, enables a timer, and counts how long > until the echo is returned. Simple enough - right? > > My problem is not in the sending of the ping - or in counting the echo > return (I use timer0 and expect no overflows), it is simply in getting > back a consistant echo. Echos that I do recieve range in time from 500 > ticks to 60000. When I turn off my labview echo simulator - I still get > the wildly varying and inconsistent results! Help! > > I can provide schematics if necessery. For now I will keep it simple by > saying I detect echo signals generated from the comparator1 interrupt. > An active low indicates a echo. > Any help would be greatly greatly appreciated. > -David >
Labview echo simulator? Does the input signal look good on an oscilloscope? Are you _sure_ you're not getting overflows? If you're getting up to 60000 ticks on a 16 bit timer then you're darn close. Perhaps you have a prescaler set incorrectly and you're just getting the remainder? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Hi David,

Posting a schematic link on your web server or on a.b.s.e. would help.

Normally you need some kind of preamp and filter. The filter would be 
matched to the length of the pulse train you are sending. Since I don't 
know what kind of transducer you are using I suggest you inspect the 
echoes with a scope. I suspect it won't look pretty unless the ocean 
floor is very smooth and flat and no fish are holding a meeting under 
the boat. Even then the finite beam width will disperse the echo a bit.

Regards, Joerg

http://www.analogconsultants.com
"Joerg" <notthisjoergsch@removethispacbell.net> wrote in message
news:kTnAd.3564$wZ2.2248@newssvr13.news.prodigy.com...
> Hi David, > > Posting a schematic link on your web server or on a.b.s.e. would help. > > Normally you need some kind of preamp and filter. The filter would be > matched to the length of the pulse train you are sending. Since I don't > know what kind of transducer you are using I suggest you inspect the > echoes with a scope. I suspect it won't look pretty unless the ocean > floor is very smooth and flat and no fish are holding a meeting under > the boat. Even then the finite beam width will disperse the echo a bit. > > Regards, Joerg > > http://www.analogconsultants.com
Most of the depth sounder circuits I have seen had a variable gain on the front end .. starts out low for near by echoes and increases over time to compensate for the weaker echoes from distant objects. One big problem with digital (and why I prefer analog "chart type" is a fish, thermocline, change in salinity or any of a number of other "thingies" will give you a false reading shallower than the actual bottom. mikey
Hi Mike,

>Most of the depth sounder circuits I have seen had a variable gain >on the front end .. starts out low for near by echoes and increases >over time to compensate for the weaker echoes from distant objects. > >
Yes, a time gain control is essential. Nowadays the AD603 is a good chip to do that with. I designed many ultrasound front end circuits for medical and it's the same there, except that we have to be able to see really close up to the transducer. Probably it would be the same in a boat if entering shallow waters without banging up the hull.
>One big problem with digital (and why I prefer analog "chart type" >is a fish, thermocline, change in salinity or any of a number of other >"thingies" will give you a false reading shallower than the actual >bottom. > >
Yes, I'd want the same. It is amazing what lays at the bottom of a body of water that is near roads. Whole cars, fridges, piles of discarded concrete and so on. With a really nifty algorithm it should still be possible to calculate where the bottom is but not as good as a true 'M-Mode' readout on a screen. Probably an old laptop would do just fine for that but the question is how long that'll last in a salty environment. Regards, Joerg http://www.analogconsultants.com
jentzd@gmail.com wrote:

> Hi all, > > Recently I am stuck on my first microcontroller project. I think I have > everything nailed down to the absolute last detail, but have not yet > been able to find a solution to this - after about 6 weeks of looking. > > My 8051 microcontroller is trying to determine the ocean floor depth. > To do this, it sends out a ping, enables a timer, and counts how long > until the echo is returned. Simple enough - right? > > My problem is not in the sending of the ping - or in counting the echo > return (I use timer0 and expect no overflows), it is simply in getting > back a consistant echo. Echos that I do recieve range in time from 500 > ticks to 60000. When I turn off my labview echo simulator - I still get > the wildly varying and inconsistent results! Help! > > I can provide schematics if necessery. For now I will keep it simple by > saying I detect echo signals generated from the comparator1 interrupt. > An active low indicates a echo. > Any help would be greatly greatly appreciated. > -David
David, One big question is, "what kind of transducer are you using?" I designed a system about 10 years ago that worked at 400KHz using a tuned piezoelectric crystal. Believe it or not, the transducer itself was fundamental in filtering the echos. By today's fish-finder standards, it was not a very sophisticated device. However it did a great job of determining depth. Noel
"Mike F" <spam_me_not_mr.gadget2@comcast.net> wrote:

> >"Joerg" <notthisjoergsch@removethispacbell.net> wrote in message >news:kTnAd.3564$wZ2.2248@newssvr13.news.prodigy.com... >> Hi David, >> >> Posting a schematic link on your web server or on a.b.s.e. would help. >> >> Normally you need some kind of preamp and filter. The filter would be >> matched to the length of the pulse train you are sending. Since I don't >> know what kind of transducer you are using I suggest you inspect the >> echoes with a scope. I suspect it won't look pretty unless the ocean >> floor is very smooth and flat and no fish are holding a meeting under >> the boat. Even then the finite beam width will disperse the echo a bit. >> >> Regards, Joerg >> >> http://www.analogconsultants.com > >Most of the depth sounder circuits I have seen had a variable gain >on the front end .. starts out low for near by echoes and increases >over time to compensate for the weaker echoes from distant objects. >One big problem with digital (and why I prefer analog "chart type" >is a fish, thermocline, change in salinity or any of a number of other >"thingies" will give you a false reading shallower than the actual >bottom. > >mikey >
The last boat I was on had a depth meter with some rotating device inside. Probably a rotating mirror. The round scale showed various echos at different depths of which the 'real one' was usually of maximum light output. Knobs were present for depth range (probably different rotation speed) and gain (to set a threshold for the scale to start illuminating) I guess as a human you know how to read this instrument and ignore 'false' echos. For a uC to do this might be difficult. Joop
Hi Joop,

>The last boat I was on had a depth meter with some rotating device >inside. Probably a rotating mirror. The round scale showed various >echos at different depths of which the 'real one' was usually of >maximum light output. > >
That was a real classic. I believe it is a little neon bulb on a rotating disk. Echoes are amplified and the bulb hangs on the output of the amp. I vaguely remember that Heathkit offered on of these. But I didn't have a boat... Regards, Joerg http://www.analogconsultants.com
Joerg wrote:
> Hi Joop, > >> The last boat I was on had a depth meter with some rotating device >> inside. Probably a rotating mirror. The round scale showed various >> echos at different depths of which the 'real one' was usually of >> maximum light output. >> >> > > That was a real classic. I believe it is a little neon bulb on a > rotating disk. Echoes are amplified and the bulb hangs on the output of > the amp. I vaguely remember that Heathkit offered on of these. But I > didn't have a boat... > > Regards, Joerg > > http://www.analogconsultants.com
The Neon light and rotating disk was a pretty nice solution to the problem in simple digital depth sounders of which echo do you call the bottom? With the disk rotating at a constant speed, it would "time" the echoes for you and show all of them. Years ago I built a similar system for scuba diving, but it used a set of counters selecting LED's out of a matrix, with the detections, illuminating the selected LED. I started testing this thing in a pool and found that the pool surfaces were so reflective that the entire pool (olympic size) saturated with sound. I put a scope on the receiver and it showed continuous output. First I thought that the receiver was oscillating, so I took another transducer to the far end of the pool and the amplitude on the second transducer showed the same continuous signal. The amplitude change from the transmit pulses was not visible at all. The same piece of equipment worked fine in a local quarry. Bob
In article <pHHAd.3895$wZ2.3296@newssvr13.news.prodigy.com>, 
notthisjoergsch@removethispacbell.net says...
> Hi Joop, > > >The last boat I was on had a depth meter with some rotating device > >inside. Probably a rotating mirror. The round scale showed various > >echos at different depths of which the 'real one' was usually of > >maximum light output. > > > > > > That was a real classic. I believe it is a little neon bulb on a > rotating disk. Echoes are amplified and the bulb hangs on the output of > the amp. I vaguely remember that Heathkit offered on of these. But I > didn't have a boat...
Yep, it was Heathkit. I put one together for my first sailboat in 1974. It did, indeed, use a neon bulb on the rotating disk. The rotation speed of the disk translated to the time for the round trip of the sonar pulse. IIRC, it was calibrated by adjusting the disk rotation speed, and the disk triggered the output pulse at the index position. There was also a receiver gain control that you could adjust to limit multipath echoes and noise. Mark Borgerson