ultrasonic distance measurement using 89c51

Hey folks! I am set out to build an ultrasonic distance measurement module using 89c51. The range I hav in my mind is about 1 inch to say 25 inches. Is the speed 89c51 offers enough for such kind of ventures? If not what would be the solution? Also some help regarding which trasducers to use would be welcomed. Regards!

Reply to
chetanthegreat
Loading thread data ...

--
The velocity of sound in air is about 1100 feet per second, which is
about 76 microseconds per inch.  That means that for a two-way path
 Click to see the full signature
Reply to
John Fields

Just to be a little clear(maybe for my own benefit than others) is that speed of sound through air is 344 m/s = 13540 in/s. (it doesn't mater how far the distance is except for atmospheric effects and such)

Assuming a resolution of x in, one has 13540/x hz. So if you want an accuracy of 1 micron = 1/1000 in then that is 1.35*10^7 or 13 mhz. There is going to be a point where its useless to get a faster clock but I have no idea what this is.

Thats pretty resonable for the accuracy. Ofcourse I doubt one could get that accuracy but maybe.

I'm not sure how accuracy one can do this using passive components but maybe its worth a shot? If one can get a precise current source and charge up a capacitor and then read the voltage precisely then the voltage will be proportional to the distance(charge rate would depend on C and R which can be used to keep the voltage in range of an ADC if needed).

Also, since your distances measured is fairly short maybe you can use an laser? (not sure if it works with your application but I thought I'd mention it. )

Reply to
Jon Slaughter

--
1 micron = 1E-6 meter, not 1E-3 inch
Reply to
John Fields

don't forget that the accuracy in this practical case is mainly limited by the bandwidth of the ultrasonic transducer, which isn't much at 40 kHz (and can't go much higher than a few hundred kHz). Or you can use special tricks to create US, like electronic generated sparks (works great) and use high frequency US receivers.

Stef

Reply to
Stef Mientki

--
I hadn\'t even thought of that, thanks!
Reply to
John Fields

yeah, I ment a mil ;/ Was converting from speed of light in m/s to in and guess I got the units mixed up.

I never said its reasonable. I said its resonable for accuracy. I guess YOU didn't CARE to read the SECOND SENTENCE?

Yes, but you do not know the conditions in which the device will be used so this is all speculation. You might be entirely right. I was just trying to give him an estimate on the clock speed that he asked for. What it does show is that its entirely reasonable because its not like 13Thz or something.

13Mhz for a mil accuracy is pretty reasonable. This means that should easily be able to get it within reasonable conditions. (I mean get within good accruacy, maybe 1/100 in)
Reply to
Jon Slaughter

Including time for the echo return, sound takes about 170us per inch. I'd assume you can get reasonable accuracy with just about any uC timer.

I'd guess your biggest difficulty is going to be with your minimum distance. It's going to be difficult to separate sensing the chirp echo from the chirp itself at that distance. If you were to change your specs to, say, 4" to 100", it will be a pretty simple project.

If you're looking for an easy, "spam-in-a-can" ultrasonic setup, you could do worse than the Parallax "PING))) Ultrasonic Sensor". It will give you the whole thing (transmitter, interface circuitry, and receiver) for less than $30 USD. Just hook up one bidirectional I/O pin from your uC, and you're ready to program. This is a pretty good deal. And if nothing else, you might want to take a look at it to give you some ideas.

formatting link

Of course, if this is a school project, you'll have to make the interface circuitry on your own.

Good luck Chris

Reply to
Chris

the short distance problem can relative simply be solved, by a piece of cardboard, foam or whatever blocks sound, place it in such a way, so half of the soundwave has travel distance x, and the other half of the wave has distance x + half wavelength.

cheers, Stef Mientki

Reply to
Stef Mientki

Hi, Stef. Underpromise, overperform. I'm thinking the OP might be looking at doing a school project. As a practical matter, it is usually difficult to get close-in measurements with standard send/ receive 40KHz transducers. I'm hoping he can tweak his project spec to make things easier for himself.

But if not, it's not outside the realm of possibility, as you mention. It's just more difficult. Class projects should be straightforward if at all possible.

Cheers Chris

Reply to
Chris

--
Not at all.  What I was pointing out was that in order to be able to
attain +/- 0.05% accuracy (your +/- 0.001" example) environmental
 Click to see the full signature
Reply to
John Fields

You can be very annoying John. I was talking about the clock speed only since that is what he asked. If we were dealing with light then it would be on the order of 13 THz instead of 13mhz for the same accuracy. (hence even at 1000 times worse accuracy your still dealing with a 13ghz clock.)

You seem to read what you want just so you can make a point that doesn't exist. (I never claimed that one could get accuracy of 0.05% in the real world)

My claim is simply to give a reasonable upper bound on the clock speed for accuracy given everything else is ideal. When it is computed it is perfectly reasonable. Do the same with the speed of light and it is not.

WHAT DOES THIS MEAN? It means he can use a 20mhz clock and not have any issues(except maybe one of latency but thats not the clocks fault). 20mhz clocks are easy to come by but 13Thz clocks are not.

You seem to think that I am saying that it is reasonable to actually get that type of accuracy in the real world. I assume you do this for attention or to feed your ego because you ignore my statements that say its probably not.

formatting link

They seem to get 0.05% accuracy.

formatting link
formatting link

Read the first sentence of the introduction and compute the accuracy requirements they are required to get. Ofcourse I'm sure you'll claim that these guys are fools and your the genius. (note that when they talk about the much larger accuracy on cm's they are refering to the robot and not the ultrasonic senser)

You realy need to stop making such a fool of yourself. When you claim that such things aleast get them right. You think such things are impossible AND THEREFORE THEY ARE!!!

Please, just because you think it can't be done doesn't mean it can't. This is not to say that it can't but instead of presenting facts you present your opinion as fact. I doubt you have ever messed with an ultrasonic sensor yet you seem to know all about them. Oh, ok. Maybe you have messed with them but since you couldn't get accuracy better than 10% it means that it can't be done any better, huh?

My original post stated nothing about the real world accuracy of a ultrasonic sound system but only about the clock speed needed to obtain it. Instead you start talking about how in the real world one can't get that accuracy. Hey!! GUESS WHAT!!! I EVEN MENTIONED THAT IN MY ORIGINAL POST!!! You seem to pick and choose what you want to read and it happens all the time. Sheesh sometimes I doubt your sanity John. I used to think you were someone intelligent but I'm not sure if its an ego trip or maybe your just not as smart as I thought. That or maybe you need new glasses?

Reply to
Jon Slaughter

--
You\'re a liar.  Here\'s his post, in toto:



Hey folks!
 Click to see the full signature
Reply to
John Fields

...

I'm wondering if, in a case like this, "chirping" rather than "pinging" might be of use. I've read that they do that for doppler radars, albeit this isn't a velocity measurement, but if, say, you sweep the transmit frequency, would the phase relationship between it and the received signal be useful? I would think it would take a ceratain amount of analog processing, but how hard would it be, and what kind of resolution could you get, or am I in fantasyland? ;-)

Thanks! Rich

Reply to
Rich Grise

Rich Grise wrote:

The idea is very good and even works in practice, but it's not very practical ;-) The basic idea to increase resolution is always to increase the information content, i.e. increase bandwidth and increase measurement (correlation) time, because information content = bandwidth * time. The main advantage of chirp or whatever unique modulation you want to choose, is that you can spread the power (=information) over time, giving you a much better signal to noise ratio (e.g. ADSL makes use of this). For ultrasonic transducers chirping can increase the bandwidth too, but because they have a very high Q, this is not very effective. One of the posts in this thread mentioned an article of a bifrequent modulation, showing indeed a very high resolution. In a lab environment I once managed to realize (with normal 40 kHz transducers, but very well damped, and phase detection over several periods) an accuracy of 1/500 of a wavelength. Unfortunately this is the short term stability and the long term stability (hours) is much worse. With sparks as the transmitter (very short and hard ultrasonic pulses), you can achieve about 10um accuary (this was used in a commercial products about 20 years ago: the first high resolution graphical tablets). But for simple electronics, the ideas behind MAXSONAR are quiet good. Although I would use 2 transducers with a mechanical splitter, to increase close range, like done here

formatting link
If you can get hold of ultrasonic transducers of a 100..200kHz (higher has to much damping in air), you can easily increase your resolution (the bandwidth of these transducers is much better).

cheers, Stef Mientki

Reply to
Stef Mientki

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