Digital Heterodyning

Thread Starter

Prodigal

Joined Oct 12, 2006
10
Hi guys,

I'm trying to get the beat frequency (or something proportional to) from two digital signals but can't seem to be able to do it reliably. At the moment I have the two signals being fed into an XOR, the output averaged by a basic RC integrator and then I'm sticking it into a Schmitt trigger. The output is about right but with too much variation, I need quite a regular signal as it is then going to be sampled by a ucontroller for a sensitive application

Is there a better method of doing this?

Thanks,
Sam
 

Papabravo

Joined Feb 24, 2006
21,159
The notions of "quite a regular signal" and "sensitive application" are sufficiently imprecise as to make an answer difficult to impossible to formulate. I don't know what you think you have here but it doesnt sound all that useful.
 

Thread Starter

Prodigal

Joined Oct 12, 2006
10
Papabravo,

Yes, you're correct that I was vague but I didn't consider anymore information to be particuarly useful since I am only really interested in the different methods of obtaining said output (a signal proportional in frequency to the difference in frequency between two square waves).

I am trying to sense small (in the order of pF) variations in capacitance and hence am using a high frequency oscillator. The frequency of this signal to is too great and the variation too small to detect acurately using said microcontroller. Hence, I am trying to compare the signal with a fixed reference frequency to obtain a low frequency output proportional to the beat frequency which can then be presented to the microcontroller.

Thanks for your input.
 

Papabravo

Joined Feb 24, 2006
21,159
I don't think you can do that in that way with digital signals. As you are no doubt aware mixing analog signals involves the nonlinear process of multiplication. It is the multiplication of sine waves that produces the four mixing products. The four products are at the frequencies of the two input signals and the sum and the difference of the two input frequencies.

The XOR function is basically a phase error detector there are no mixing products in the XOR of square waves of arbitrary frequency and duty cycle.

I am not convinced that an exclusvie OR will ever produce the results that you are looking for. If there is a mathematical basis, which I doubt, for the technique, I invite any and all responses on the subject.
 

n9352527

Joined Oct 14, 2005
1,198
As Papabravo mentioned above, an XOR of two signals with different frequencies results in the phase difference. If the duty cycle is also arbitrary, then there would be a minimum limit, which is above zero, for the average of the phase difference. If not, then the minimum limit would be zero.

The frequency difference is actually embedded in the phase difference signal. However, it would be a much easier to extract when we don't have to account for substantial variation in duty cycle. Assuming that the duty cycle variance is not large enough over the period of one beat frequency cycle, then the frequency is represented by one cycle of rise and fall of average of phase difference signal. If integrator is used to process the phase difference signal, then this would be one cycle from steepest rise and most gentle rise. The reason is because a small frequency difference would cause an undulating phase difference that has the same frequency as the beat frequency.

Altough it is possible to measure this rise and fall in phase difference signal, it would be quite difficult to do it precisely. I think, if you need to measure a small beat frequency more accurately, what you should do is to detect which signal is leading and lagging in phase with a phase detector and then timed between one crossing from leading to lagging to the next crossing of lagging to leading or vice versa. The time would be equal to the period of the beat frequency. This is easy to do with a microcontroller and does not need an ADC.

As with a phase difference, a better implementation of leading/lagging uses a couple of FF with a few logic gates instead of using an XOR gate. Have a look at implementation of phase-frequency detector for an idea on how to do it.
 

beenthere

Joined Apr 20, 2004
15,819
Hi,

Just to ring in on this, there is an established way to make this measurement. You work with a sine wave oscillator and a PLL. The sine wave helps to see the capacitive effect, as funny things happen to square waves under the same circumstances. If the rise and fall times are changed, then it makes it harder to get an accurate hetrodyne difference.

The PLL uses the generated sine wave as the reference, and will produce an error voltage when presented with the test waveform, if it it shifted in phase with respect to the reference. The error voltage is proportional to the phase difference, and may be digitized and evaluated with very little programming effort.
 

Søren

Joined Sep 2, 2006
472
Hi,

The frequency of this signal to is too great and the variation too small to detect acurately using said microcontroller. Hence, I am trying to compare the signal with a fixed reference frequency to obtain a low frequency output proportional to the beat frequency which can then be presented to the microcontroller.
Did you consider feeding this signal into a counter counting up and using a fixed frequency counter to count down ? That should leave you with the difference, although it might sound a bit cumbersome.
 

Spoggles

Joined Dec 2, 2005
67
Hello:

May I ask what the value of the capacitance that you wish to test?
How are you going to connect the unknown capacitance to the circuit?
How much resolution do you require?
How much sample time do you need?
Thanks..just wondering

Spoggles
 
Top