Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Demo: Frequency Phase Detector — Parallax Forums

Propeller Demo: Frequency Phase Detector

Beau SchwabeBeau Schwabe Posts: 6,550
edited 2007-07-09 05:41 in Propeller 1
Here is something that I am using for a differential sensor idea that I thought might be helpful to others.

Honestly by itself the demo isn't very exciting, but it provides a nice building block for other applications
to exploit.

A couple of examples that a Frequency Phase Detector could be used for...

1) Communication using constellation techniques (Receiver end)
2) Quadrature Encoder (direction and speed)
3) High Speed Event timing from point A to point B
4) Theremin? (try connecting a 3 inch piece of wire across the input pins and just wave your hand near the wire 'loop' - interesting results)
5) Myo-Electric sensor possibilities



Basically the DEMO is capable of taking two input signals of the SAME frequency with different phase
relationships to one another... the returned result is equal to 1/2 of the input frequency Period and can
be computed as...

HalfPeriod = System_Clock_Speed / ( Input_Frequency x 2 )

Since the input frequencies are the same, the furthest phase difference between the two inputs can only
be +/-180 Deg apart so the resulting range is +/- HalfPeriod

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 7/8/2007 1:56:51 PM GMT

Comments

  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-08 22:45
    I'm sure this will come in handy with an audio/audio tunning project. Like when your trying to hook up or tune car audio, you could connect directly to speaker wires with comparators or transistors to keep Vin at around 3V, and it could turn on a led to let you know the speakers are in phase, or output to an lcd for phase difference in a number form.

    Another cool audio application would be to make a 5 channel audio delay box, 4 mics positioned where your ears would be, and using this code to provide measurement data to a parent object that would calculate left/right front/back phase differences and adjust the delay box accordingly. You could even add some more code that would adjust each channels volume, so that when it hits your ears one channel won't wash out the others.

    I would definitely be interested in how one would go about making an audio delay with the prop, that would probably be the most difficult part.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! The average PC while browsing the internet typically uses less than 30% of it's potential, why not donate a portion of the rest for cancer resaerch?
  • Beau SchwabeBeau Schwabe Posts: 6,550
    edited 2007-07-08 23:21
    "I would definitely be interested in how one would go about making an audio delay with the prop, that would probably be the most difficult part."

    RinksCustoms,

    You already can... I played around with Chip's microphone to headphone object and did something just like that.· I think I was able to get almost 1/4 a second delay.
    ·

    Edit....


    What you will experience with any audio, is that the Phase delay idea that you propose will only work for ONE frequency and any multiple harmonic of that frequency.· Different frequencies will have different Phase delays and while you can "tune" a specific resonate frequency (<--essentially what you are doing), it will not encompass the audio range that you are looking for.



    ·



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 7/9/2007 2:16:29 AM GMT
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-09 05:41
    That's definitely something ima have to chew on. You see, I bought this DEH-9400 Pioneer car stereo a fw years ago and a few of the nicer features on it was the digital time alignment and auto eq. The digital time alignment let you input the distance from your speakers to your ears and it took care of the rest. It did bring out more detail and the DSP environments were realistic.

    Your description of this phase detector object made me think of that. By outputting a test tone of a fixed freq on any two channels - assuming they're in phase - would hit your ear ( or mics) at slightly different times allowing you to measure the sonic differential distance between the two speakers. I'm not exactly sure how pioneer managed a digital audio delay on 5 channels in a car stereo at what sounds like at least 48KHz sampling, that's gotta be alot of memory, grant it that the delays needed for a car would likely be much shorter than those needed for a home studio/theatre setup.

    But perhaps this code would be useful as a tool for tunning my studio surround. I'm sure it could be done with a few mics and a·VGA screen or something for a readout.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! The average PC while browsing the internet typically uses less than 30% of it's potential, why not donate a portion of the rest for cancer resaerch?
Sign In or Register to comment.