Shop OBEX P1 Docs P2 Docs Learn Events
Ultrasonic Sensory — Parallax Forums

Ultrasonic Sensory

PhilldapillPhilldapill Posts: 1,283
edited 2008-08-10 23:06 in Propeller 1
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?

Comments

  • TimmooreTimmoore Posts: 1,031
    edited 2008-08-10 04:44
    Why not use the prop for the tx 40Khz? The sensor probably needs more than 3.3 to drive it but I have seen a the max2232 chip used to drive the sensor. The receive side will need op-amp to amplify the signal before detecting but I dont see why the prop cant be used to detect the 40khz signal.
  • SRLMSRLM Posts: 5,045
    edited 2008-08-10 05:49
    Too cheap for a $30 dollar sensor that works perfectly? Wow...
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-08-10 05:51
    hey, I was almost too cheap for the $4.95 sensor but I'm not so gimme credit!

    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'.
  • TimmooreTimmoore Posts: 1,031
    edited 2008-08-10 06:30
    Can you post the datasheet for the sensors, I dont see it on futurlec's website?
  • SRLMSRLM Posts: 5,045
    edited 2008-08-10 06:56
    50 feet sounds unlikely for ultrasonics. You'll have to foccus the sound very well, have it shout, and listen very acutely. However, if you can get the system to work, you could market it as the best and cheapest ultrasonic range finder on the market: an impressive accomplishment to get both in one go.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-08-10 07:20
    yeah, 50' sounded a little bit high and unlikely... And no, Tim, I don't have a spec sheet. That's what's frustrating sometimes about cheap buys like on futurlec - lack of any specs.

    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.
  • TimmooreTimmoore Posts: 1,031
    edited 2008-08-10 07:56
    I believe most of these sensors use piezoelectric crystals which means they only react to changes in pressure especally close to their resonate frequency or 40KHz. Play a high frequency tony close to the sensor and you should see something then.
  • VIRANDVIRAND Posts: 656
    edited 2008-08-10 08:11
    I have some hints for you about sonar, probably too much actually. And I could be wrong about some things.

    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. confused.gif
    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.
  • JonathanJonathan Posts: 1,023
    edited 2008-08-10 15:39
    I use a CD4049 to drive the TX transducer at ~ 20vPP. I send out a burst of 10 cycles at 40kHz. The RX side goes to a single supply opamp, then to a comparator.

    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
  • Tracy AllenTracy Allen Posts: 6,660
    edited 2008-08-10 16:55
    When you have that sensor hooked up to your 'scope, you noticed a response when you blew on it but not when you applieed constant air pressure. The reason for that is I think that hissing noises from aspiration have a rather large ultrasound content. Plain speaking does not until you hit the s'es' You could might get a good response by jangling keys in front of the sensor. Lots of ultrasound.

    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
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-08-10 21:12
    Tracy, my thoughts exactly. I noticed a slight bit of air escaping from the sensor, and figured that was the case.

    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 AllenTracy Allen Posts: 6,660
    edited 2008-08-10 23:06
    Did you try hooking the triangle wave generator to the trigger input of your 'scope? If the scope is triggered by the source, you will be able to see the phase change between the transmitted and received signals. It is possible to measure changes in distance by observing the change in phase angle.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.