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

Ultrasonic

curtisdcurtisd Posts: 8
edited 2011-05-22 13:26 in Propeller 1
Hello,
I am trying to experiment with ultrasonic sensors for non-destructive testing. My experiments are promising using a signal generator ans oscilloscope. I want to use the propeller to:
1.) send a 40 khz burst that last between 5 us and 200 us.
2.) wait for the return pulse, I am using only one sensor.
3.) I can take things from there.
I looked in the OBEX for PWM and there were a few, but they offered too many features. Is there a simple method for producing a burst and then waiting for a pulse?
One pin on my sensor is ground and the other is connected through 220 ohm resistor for sending and receiving the signal.
Thanks for any help,
Curtis

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-05-22 12:28
    You don't need a PWM object. Look at the frequency synthesis object (here) for a starting point or look in the "BS2_Functions" object for a similar function. Detecting a returning pulse is more complex, particularly if you want to reject noise and get a nice clean "start of echo". You're not going to find a "ready to go" receive example.
  • LeonLeon Posts: 7,620
    edited 2011-05-22 12:28
    I once designed an ultrasonic generator system for a client that used a software DDS running on a little AT90S2313 AVR, you should be able to do something similar with the Propeller. You will need an amplifier for the return signal, and some signal processing.
  • curtisdcurtisd Posts: 8
    edited 2011-05-22 12:34
    Thanks Mike,
    I have used this object, but how do I control how long the burst is? I usually use synth to resonate coils, but this is usually a continuous pulse using repeat.
    Thanks,
    Curtis
  • Mike GreenMike Green Posts: 23,101
    edited 2011-05-22 12:49
    It's very simple. You start the burst by calling the frequency synthesis routine. This sets up one of the cog counters to generate the burst. You wait until the desired amount of time passes (look at the PAUSE routine in BS2_Functions for an example of how), then you turn off the counter you're using for generating the burst (CNTx := 0).
  • PerryPerry Posts: 253
    edited 2011-05-22 13:26
    curtisd wrote: »
    Thanks Mike,
    I have used this object, but how do I control how long the burst is? I usually use synth to resonate coils, but this is usually a continuous pulse using repeat.
    Thanks,
    Curtis

    Perhaps this might get you started.

    When I was working on a keyboard to IR project http://forums.parallax.com/showthread.php?130282-I-think-I-burnt-my-Dongle!&highlight=burnt+dongle I had problems with the return signal when in the same room as the transmitter.

    You could use some thing like the IR drivers, they go at 38KHz to encode your pulses so that the receiver can tell that it has a valid signal.

    Use the device code part to confirm valid reception and the key code part to tell which pulse was received. Pick up the the cnt variable for timing or use a PLL mode for more accurate information.

    Good Luck
    Perry
Sign In or Register to comment.