Author Topic: Measuring phase difference with 4046B phase comparator II  (Read 8347 times)

0 Members and 1 Guest are viewing this topic.

Offline saintTopic starter

  • Contributor
  • Posts: 11
Measuring phase difference with 4046B phase comparator II
« on: July 17, 2014, 04:32:20 pm »
Hi, in my project i have two sin waves (few Hz to about 2kHz) that are 90 deg out of phase (TLL levels). What I need to do is determine if wave A is currently leading or trailing wave B so naturally after using LM393 I wanted to use 4046B and its Phase Comparator II output. Wave A goes to pin 14, and B to pin 3 of 4046. At pin 13 i put resistor divider (1M + 2k/2k) as suggested here  but I'm pretty sure it should be the other way around eg. 10k + 1M/1M) so that the 1M can actually pull the output close to VCC or GND.
But no matter what I do the PC2 doesn't stay an VCC/2 when Wave A & B are at VCC/2 (DC), sometimes PC2 sticks to VCC sometimes to GND and occasionally I see VCC/2 (on PC2) when generating Wave A & B. What am I doing wrong?

Resistor divider used for measurments is 10k + 1M/1M.
SIG (ch. 1) and COMP (ch. 2)


From separate measurment, PCP (1), PC2 (2)


One more thing is that PCP is Low when SIG & COMP are VCC/2, according to the datasheet (page 8) it should be High. Any ideas why?

Everything was tested with my Rigol oscilloscope (only 2-ch. :-() and the singnals on pin 3 & 14 are clean (not exactly 50% duty but this doesn't matter for PC2 as far as I know).

Do I need to connect C1, C2, R1,R2, RS, looking at the datasheet (page 4, fig. 2) I don't
think I'm using any of them.

What should one do with unused pins on 4046, leave them floating?
 

Offline w2aew

  • Super Contributor
  • ***
  • Posts: 1780
  • Country: us
  • I usTa cuDnt speL enjinere, noW I aR wuN
    • My YouTube Channel
Re: Measuring phase difference with 4046B phase comparator II
« Reply #1 on: July 17, 2014, 11:08:48 pm »
Not sure if this will be helpful, but you may want to view my video (or parts of it) that reviews PLLs in general, and uses the 4046 as the example.  I discuss and demonstrate each circuit block, including the phase detectors.  For my test, I simply connected the signal generator outputs (0-5V square waves) directly to the phase detector inputs.  Phase Detector II starts at about 10:15 in the video:

« Last Edit: July 17, 2014, 11:19:50 pm by w2aew »
YouTube channel: https://www.youtube.com/w2aew
FAE for Tektronix
Technical Coordinator for the ARRL Northern NJ Section
 

Online moffy

  • Super Contributor
  • ***
  • Posts: 1775
  • Country: au
Re: Measuring phase difference with 4046B phase comparator II
« Reply #2 on: July 18, 2014, 02:22:02 am »
Use a D type flip flop. One signal goes to the D input the other is the clock. The output HIGH or LOW will tell which signal is leading which.
 

Offline saintTopic starter

  • Contributor
  • Posts: 11
Re: Measuring phase difference with 4046B phase comparator II
« Reply #3 on: July 18, 2014, 10:26:01 am »
Use a D type flip flop. One signal goes to the D input the other is the clock. The output HIGH or LOW will tell which signal is leading which.
Thank's got the same suggestion elsewhere plus a XOR for determining if there is a lag (basilly PCP output circuit).

I'd swing by a local shop a bought a few parts (CD4013B, 74LS86).
I've used my sniffer. Wave A goes to input D of flip-flop, B goes to CLK.
#1
#2
#3
Any ideas how to make XOR only work on leading edge.
« Last Edit: July 19, 2014, 07:05:17 pm by saint »
 

Online moffy

  • Super Contributor
  • ***
  • Posts: 1775
  • Country: au
Re: Measuring phase difference with 4046B phase comparator II
« Reply #4 on: July 20, 2014, 05:55:42 am »
What is a PCP output circuit? Never heard of it before.
 

Offline saintTopic starter

  • Contributor
  • Posts: 11
Re: Measuring phase difference with 4046B phase comparator II
« Reply #5 on: July 20, 2014, 06:00:42 am »
What is a PCP output circuit? Never heard of it before.
Sorry my bad, I was thinking about Phase Pulse (Terminal 1) and looked at the PC1 (XOR) in the datasheet.

Anyway what type of filter would get rid of this 1/4 pi low state on the XOR output?
« Last Edit: July 20, 2014, 06:04:30 am by saint »
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3244
  • Country: gb
Re: Measuring phase difference with 4046B phase comparator II
« Reply #6 on: July 20, 2014, 07:44:20 am »
Hi, in my project i have two sin waves (few Hz to about 2kHz) that are 90 deg out of phase (TLL levels). What I need to do is determine if wave A is currently leading or trailing wave B so naturally after using LM393 I wanted to use 4046B and its Phase Comparator II output. Wave A goes to pin 14, and B to pin 3 of 4046. At pin 13 i put resistor divider (1M + 2k/2k) as suggested here  but I'm pretty sure it should be the other way around eg. 10k + 1M/1M) so that the 1M can actually pull the output close to VCC or GND.

I'm probably missing something, but that link shows a schematic with 20k +2k/2k, which someone rightly pointed out is functionally equivalent to two 42k resistors.  Using a 1M resistor is going to give a very high output impedance, possibly whatever you are driving into is loading it down.
 

Online moffy

  • Super Contributor
  • ***
  • Posts: 1775
  • Country: au
Re: Measuring phase difference with 4046B phase comparator II
« Reply #7 on: July 22, 2014, 12:10:48 am »
Could you please describe in words what you are trying to accomplish? I don't understand the final objective.
 

Offline saintTopic starter

  • Contributor
  • Posts: 11
Re: Measuring phase difference with 4046B phase comparator II
« Reply #8 on: July 22, 2014, 05:31:12 am »
Could you please describe in words what you are trying to accomplish? I don't understand the final objective.
1) I have a module (doppler radar) with two outputs, let's call them A, B. They are bias at VCC/2, when the module detects a moving object A and B start outputting a sine wave proportional in amplitude to object size/distance and frequency is proportional to its speed.
2) The module offsets A, B waves exactly 90 deg., if object is approaching wave A is leading if receding B is leading.
3) So after passing A, B through op amps and simple comparators I get a nice clean square wave (GND or VCC) but the duty of square wave is proportional to the amplitude of the sine wave.
4) Using a D flip-flop A goes to input D of flip-flop, B goes to CLK, Q tells me with one is leading.
5) a XOR from A, B square waves should tell me if the A, B are actually producing any sine waves or just idle (bias at VCC/2).
The problem is that gain of op amps is fixed but as the object approaches the amplitude of of A/B increases so does the duty from comparator(s). When the duty is small (<25%) the XOR produces a pair of pulses but only the first one is valid (the Q from D flip-flop is valid at that time).
 

Online moffy

  • Super Contributor
  • ***
  • Posts: 1775
  • Country: au
Re: Measuring phase difference with 4046B phase comparator II
« Reply #9 on: July 23, 2014, 12:09:15 am »
Is the duty cycle problem when the signal is small or large, not quite sure? Could you divide both A and B by 2 and do your phase detection on that?
 

Offline saintTopic starter

  • Contributor
  • Posts: 11
Re: Measuring phase difference with 4046B phase comparator II
« Reply #10 on: July 23, 2014, 05:06:20 am »
Is the duty cycle problem when the signal is small or large, not quite sure?
The problem is that there has to be a time when both A and B are high as in 4046 datasheet fig. 6 so higher duty would help

Could you divide both A and B by 2 and do your phase detection on that?
It could but it might also produce some error as the comparator aren't perfect (extra pulses on A or B square wave).

I can't say I am sure this is directly relevant but it is something I happened across yesterday. It mentions Sine waves, quadrature and phase difference.
Thanks but I'm not sure if this does give me a lead/lag information that I'm after. It just says 0V output for 90 deg, at <90 deg it'll give a negative voltage and positive for >90 deg. Won't it just give 0V on matter which wave is leading?

I've also found an old National chip MM54C932/MM74C932 but it looks like it's just a part of 4046 nowadays.

Ok I feel like am stuck on this one. Any brilliant ideas, maybe there is a better way to get the lead/lag information? Analog gurus I'm counting on you.
« Last Edit: July 23, 2014, 12:07:56 pm by saint »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf