Ultrasonic Sensory
Philldapill
Posts: 1,283
First off, I'm too cheap for the PING))) device sold here on Parallax. The other thing is that I want to go through the whole process of learning how it works. For this reason, I've purchased a couple of ultrasonic sensors from Futurlec.com. They came in today, but I'm all out of Propellers at the moment to get started(5V was connected to the last one and poof).
I've thought about how I would go about doing this, and the·idea is fairly·simple. If I hit the first·sensor with a 40kHz sinewave for a few cycles, I can have the other sensor pick this signal up when it bounches off the object that I'm trying to measure distance to. I think that if I have these two sensors placed side by side, the pickup sensor will "hear" the outgoing signal, the "hear" the echo signal. This should be ok since I can just measure the time between the start of each pulse. Producing the signal and "decoding" it, isn't so easy it seems. I can produce a 40kHz signal from a couple op-amps, but I'm not sure how I would go about doing the recieving circuit. What I imagine doing is using the propeller to connect the·op-amp circuit·to the sensor so it produces the signal, and record the time. The Propeller would then somehow listen to another circuit for the return signal. I think this is sort of how the PING))) device works, but Parallax makes it so easy and simple that I can't reproduce it easily.·[noparse]:)[/noparse]
Any thoughts beyond just purchasing a PING?
I've thought about how I would go about doing this, and the·idea is fairly·simple. If I hit the first·sensor with a 40kHz sinewave for a few cycles, I can have the other sensor pick this signal up when it bounches off the object that I'm trying to measure distance to. I think that if I have these two sensors placed side by side, the pickup sensor will "hear" the outgoing signal, the "hear" the echo signal. This should be ok since I can just measure the time between the start of each pulse. Producing the signal and "decoding" it, isn't so easy it seems. I can produce a 40kHz signal from a couple op-amps, but I'm not sure how I would go about doing the recieving circuit. What I imagine doing is using the propeller to connect the·op-amp circuit·to the sensor so it produces the signal, and record the time. The Propeller would then somehow listen to another circuit for the return signal. I think this is sort of how the PING))) device works, but Parallax makes it so easy and simple that I can't reproduce it easily.·[noparse]:)[/noparse]
Any thoughts beyond just purchasing a PING?
Comments
No, the real reason is to build one and understand how it works. Plus, the sensors I got are supposed to have a range of almost 50'.
I'm just doing a simple expirement on the sensor right now. i hooked it up to my scope and turned the sensitivity way up. I blow in it and the voltage rises so I figure its just a constant pressure... I put my mouth on it... nothing. I don't get it.
If you generate a 1 millisecond pulse it will have a wavelength of one foot / 0.3 meters IN AIR.
It will move one foot per millisecond.
So... If you had an oscilloscope, then do this...
Generate a pulse 1 millisecond long with the transmitter transducer and at the same time trigger the o-scope.
Count milliseconds until the receiver transducer receives. (Oops, not quite yet but that is the trick.)
Measure the Receiving transducer with the o-scope even though the transmitting one triggered it.
Generate new pulses every so many milliseconds beyond the maximum range of feet you expect.
This will give a very rough display of ping distances and echos;
things farther away will "make waves" more to the right of the scope trace with increasing distance of a wall or something.
There will probably need to be amplifiers on both transducers; they might be very inefficient.
Since a 1 millisecond pulse will ring at 1000 Hz you might improve results by filtering this frequency the way
a graphic equalizer does. (Bandpass filter). Don't worry about this unless your results need improvement.
The resolution at 1000 hz will be 1 foot, but maybe better if the phase of the echo's leading edge is detected.
The resolution at 10000 hz would be something around 3 cm.
Since your transducers are made for higher frequencies,pulse the wavelength of that frequency instead.
40000hz (40 khz) would be a 25 microsecond pulse I think, which(this doesn't matter)is somewhere around 1 cm long.
If you have a scope,
and you transmit a strong pulse (generate it with Prop but amplify it's voltage),
and you amplify the receiving transducer so that you get useable 3 volt pulses from distant echos,
you probably end up with a sonar.
If you don't have a scope (I assume), an idea is to modify the scope object for the Propeller.
Just be sure to limit the voltage from the receiving transducer's amplifier so it doesn't blow the Propeller.
You don't want to look at a scope, you want to count time of echoes after the ping pulse,
(like I wrote and then crossed out), and the times of the echoes after the pulse is how far away things are.
I hope some of this makes sense.
It is like figuring the distance of a lightning strike by timing between the flash and thunder. (5 seconds per mile, right?)
One difference though.
Ping echoes go and come back,so they go twice the distance. That actually helps by giving you more time to measure.
I have recently mentioned that it is possible to substitute a small piezo disc for the transmitting transducer,
and an electret mic for the receiving transducer. (WARNING:ELECTRET MICS GET DESTROYED BY WATER)
I have done these experiments in the past with these parts and they worked better for ME than
the ultrasonic transducers did. (I didn't know enough about the transducers to make them work at all!)
If you do sonar in water, it's important to know the differences.
If I remember correctly, sound goes 5 times faster in water, something like a mile a second.
As a result, higher frequencies are more useful in water. 40khz is OK but 100Khz or 250khz would be better.
The higher frequencies generally are basically more accurate but have less range.
For example, Ultrasound medical imaging works best at around 3.5 Mhz.
In that case, lower frequencies make blurry images and higher ones don't go deep enough.
My situation is a little different from yours, I am using the US for navigation. I have the RX side on my 'bot and the TX is on 3 beacons. I can request a burst of US from each beacon and get the range from the bot to the beacons. I am currently working on the trig required to use this info for navigating a room, but the goal is to make a relative positioning system.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
If you do use the prop (when you get one going again) to drive it directly at 40 kHz, use a differential output with the transducer hooked between two pins, which effectively boosts the drive to over 6 volts peak to peak. More drive voltage more signal.
One helpful experiment for understanding is to leave your receiving transducer connected directly to the 'scope input while the transmitter is driven at 40 kHz. Apply drive signal also either to the 'scope horizontal trigger, or else directly to the horizontal to get a Lissajous pattern. Then as you move the transducers in relation to one another, you will be able to visualize the changing phase relation that comes from the difference in time that it takes for the ultrasound to travel the distance. The wavelength of the 40kHz sound is less than 1 centimeter, and on the 'scope screen, you will see the phase change through one full cycle as the distance between the transducers changes by one wavelength. Also, some situations with reflecting objects can set up standing waves, so the amplitude too can change.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I made a simple triangle wave generator using two opamps with a Peak-toPeak voltage of about 8 volts, with 3V DC offset. I hooked this signal up to the sensor, tuned it to ~40kHz, and connected my scope up to the other sensor. When I have the sensors a foot apart or so, I'm getting about 4Vpp with a perfect sinewave output. If I have the sensors both on the breadboard side by side, I don't get any interference, contrary to what I expected. If I move my hand a few inches above them so that the US bounces, I see a good size sinewave on the scope again. [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com