DSPRelated.com
Forums

High frequency and time resolution phase detection

Started by bogdanl March 29, 2011
>Yeah, most of the links are either dead or in German, but the fourth you
might find useful:
>http://det.bi.ehu.es/~jtpjatae/pdf/p31g3plx.pdf - especially page 4, which
shows an example of a demodulator.
> >Chris >
I know that document too. In fact, it's the first one I've read when I started this. Unfortunately, I don't see how that block diagram helps me.
On 03/29/2011 11:45 PM, HardySpicer wrote:
> On Mar 30, 10:02 am, Tim Wescott<t...@seemywebsite.com> wrote: >> On 03/29/2011 12:24 PM, bogdanl wrote: >> >> >> >>> Hello all! >> >>> Before getting to the point, I'd like to mention that I'm a beginner in >>> DSP, so please, don't throw anything at me. >> >>> Lately I've been spending my spare time trying to write a program (in Qt, >>> if it matters) to detect rapid phase changes in a tone. By rapid, I mean >>> once every 32 ms, 16 ms, 8 ms, 4 ms, or even 2 ms. But, at the same time, I >>> need to have a high frequency resolution (1 Hz, or possibly 0.1 Hz). I use >>> FFT to display a spectrogram, but from what I know, it's not a solution for >>> rapid phase changes detection. >> >>> While researching this, I came across Goertzel's algorithm, and I've tried >>> it, but some (many :D) things are not clear to me. For example, for a >>> sample rate of 32000, if I want to check the phase every 32 ms, I need to >>> run Goertzel for 1024 points, right? But that would give me a frequency >>> resolution of 31.25 Hz. If I decrease the sampling interval to 16 ms, that >>> would mean running Goertzel for 512 points and a frequency resolution of >>> 62.5 Hz. I'm not sure if all this is correct, or not. >> >>> From what I get, the higher the time resolution, the lower the frequency >>> resolution gets, and vice-versa. >> >>> So, how should I tackle this problem? If you need any more details, please >>> let me know. >> >>> Thanks in advance for your time. >> >> Well, you appear to be a second-stage beginner -- you've progressed >> beyond thinking "how can I use the FFT to solve this" to "how can I >> solve this with either the FFT or the Goertzel", or even as far as "wait >> a minute, there's got to be more to it than that!". >> >> Someone needs to ask "phase relative to what"? -- I guess I'll elect myself. >> >> If you mean phase relative to the incoming signal's average phase, and >> unless you have some confounding issues in your signal, I think I'd make >> PLL follower. This would show zero degrees phase difference once it had >> settled on a steady tone, but it would quickly show phase differences >> between it's following tone and the incoming tone. This would not only >> be used by the PLL to correct its following tone's phase, but you'd use >> it to estimate your phase difference. >> >> -- >> >> Tim Wescott >> Wescott Design Serviceshttp://www.wescottdesign.com >> >> Do you need to implement control loops in software? >> "Applied Control Theory for Embedded Systems" was written for you. >> See details athttp://www.wescottdesign.com/actfes/actfes.html > > He would need to integrate the phase dector output of course since the > PD gives rate of change of phase.
Hit the books again -- a phase detector gives phase error. It may be some trig function of phase error, but it's not been integrated or differentiated. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On 03/29/2011 10:00 PM, Rune Allnor wrote:
> On Mar 29, 9:24 pm, "bogdanl"<bogdanlazanu@n_o_s_p_a_m.yahoo.com> > wrote: >> Hello all! >> >> Before getting to the point, I'd like to mention that I'm a beginner in >> DSP, so please, don't throw anything at me. >> >> Lately I've been spending my spare time trying to write a program (in Qt, >> if it matters) to detect rapid phase changes in a tone. By rapid, I mean >> once every 32 ms, 16 ms, 8 ms, 4 ms, or even 2 ms. But, at the same time, I >> need to have a high frequency resolution (1 Hz, or possibly 0.1 Hz). I use >> FFT to display a spectrogram, but from what I know, it's not a solution for >> rapid phase changes detection. > > Contrary to popular belief, DSP is about engineering. That is, > what a DSP engineer does is utalitarian rather than entertaining. > With that in mind:
Oh, I don't know, Rune. I always assumed that when I'm on site at a customer's establishment, wandering the corridors muttering to myself and waving my hands, staring off into space and not even noticing the pretty girls, that _someone_ is going to be entertained. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On 03/29/2011 11:50 PM, bogdanl wrote:
> First of all, I've noticed that I've made a mistake in my earlier post. The > phase difference is pi, not pi/2. > >> >> No, you don't. If BPSK is what you play with, you need to read >> up on BPSK modulation techniques. >> > > Can you suggest some starting points on BPSK modulation? Some > books/articles, maybe?
Try searching on PSK. The classic PSK demodulator has a phase locked loop that locks onto the carrier over the long term (_not_ just the last bit!), and demodulates the binary data stream against that phase reference. The two classical ways of implementing the PLL are to square the signal and lock to twice the carrier frequency, or to use a Costas loop. The ARRL Handbook used to be a good practical reference for this, and probably still is. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
You say you want a demodulator for BPSK - on page 4 of the link there is a =
picture of the demodulator for BPSK. It may not seem obvious, but that give=
s you what you want. The important part is the delay line and modulator, yo=
u can temporarily ignore everything else - the output is proportional to th=
e change in phase. Try it.

Alternatively, see Tim's post about using a PLL.

Chris