Need help with phase detection

I have two Adafruit MAX4466 microphones, spaced at a distance of a few centimeters, that generate analog outputs of 5 V (peak to peak) centered at 2.5 V. In the video, I am driving the microphones with a ~2.5 kHz audio sine wave generated from my cell phone speaker. The output of each mic is shown on two different channels on the oscilloscope. When the cell phone speaker is centered over the two mics, there is no phase difference. However, as I move the speaker from one mic to the other, you can see the phase shift (and amplitude difference) between the two mic signals. What I want to do is to use a phase detector to convert these signals into a DC signal proportional to the phase difference.

Not shown in the movie:
My AD8302 phase detector chip isn't doing what I want it to because when I feed the two mic outputs into the input pins on the 8302, the Vphs pin shld report the phase shift as a DC offset. Unfortunately I don't see a change in the DC signal as I move my phone. The Vref pin (1.8 V) on the chip is working properly, so the chip is powered correctly.

I'm guessing the problem might be because there's a +2.5 V DC offset on each of the mic outputs since the mics are designed for Arduino (which has only +5V and no -5V to capture negative part of waveform). I don't know how the 8302 phase detector works, but if it's based on an XOR logic gate, it won't work because both signals are always "HIGH."

Two asks:

  1. I'd be grateful for advice on how to do phase detection on two signals with 0 to 5 V ppV centered at 2.5 V.

  2. Even with gain, the Adafruit mic doesn't seem very sensitive. Is this a general property of electrolet mics, and can anyone suggest a more sensitive mic? Also, despite the frequency range spec of the Adafruit MAX4466, there is no discernable response at 20 kHz, which is where I'd like to operate. In fairness, I have not independently verified that my cell phone app is actually generating a 20 kHz signal and I'm old enough that I can't hear it. Anyone know a mic that is sensitive at 20 kHz?

Thanks so much for your help!

Nick

You forgot to show the movie Nick.

You could possibly set up TWO different interrupt channels.

You could set up for falling edge detection. Use the falling edge on one channel to be a reference.... get reference time. And use the other channel...with the other falling edge to complete the picture. The two times could be used to determine a phase difference.

That is..... sinewave to square-wave converter (eg...comparator with hysteresis) for both sine waves. This is to give square-wave forms ... 0 to 5 Volt DC levels. Then use the arduino to detect falling edges with interrupts.

Sorry, video is posted now as a link in the text. It was 1.1 MB in size in mpg format (just over the forum limit) and after screwing around with trying to compress it, I decided to just upload to YouTube. Thanks for your suggestion!

Firstly that chip requres ac-coupling on the inputs, and has about 3k input impedance at low frequencies,
so for audio you’ll need something like 1uF input blocking caps to allow audio frequencies through - if
using electrolytics you’ll need to check which side has a higher DC voltage with a multimeter so you
get the right polarity, or use non-polarized electrolytics.

Secondly its inputs are rated for a maximum input level of 0dBm / -13dBV ie 220mV rms maximum.
Exceeeding that might not do its input amps any good, so make sure you can set the gain suitably.

Thirdly the time constant on the phase output pin is about 40ns, ie its not going to work below 50MHz
inputs or so without an external RC low pass filter, assuming its a simple XOR phase detector which it
appears to be.

There is a PFLT pin for adding an external integrating capacitor to allow phase to be measured at
lower frequencies, try adding 10uF to ground on that pin.

I don't know how the 8302 phase detector works

I googled it and the datasheet was the first hit. It goes into excruciating detail. Do you have the evaluation board? It should have come with information as well.

You should also investigate the CD4046B PLL.

nrconley:
2) Even with gain, the Adafruit mic doesn't seem very sensitive. Is this a general property of electrolet mics, and can anyone suggest a more sensitive mic?

Its a microphone, the signal levels are in the 100uV to 10mV range or so for most microphone
types. 60dB sound is only 1uW per square meter (ie 0.1nW per cm^2), which is all there is to
convert to electrical signal - hence the very low signal levels.

It doesn't say that the time constant on the phase output pin is 40ns. It says the response time is 40ns.

In any case, it appears that the default low frequency is 200MHz. You can extend that by adding capacitance in the feedback circuit. Page 15:

The nominal high-pass corner frequency, fHP, of this loop
is set internally at 200 MHz but can be lowered by adding external
capacitance to the OFSA and OFSB pins. Signals at frequencies
well below the high-pass corner are indistinguishable from dc
offsets and are also nulled.

The lowest frequency shown on the graphs is about 100MHz. See the Smith chart on page 17.

MarkT:
There is a PFLT pin for adding an external integrating capacitor to allow phase to be measured at
lower frequencies, try adding 10uF to ground on that pin.

Thanks Mark! I have this LM YN evaluation board. According to Table III of the data sheet, component C8 is connected to the PFLT pin and is listed as “open.” Forgive my ignorance, but can I solder onto the evaluation board?

AD8302.JPG

Do you have a schematic of the evaluation board? It uses input coupling caps. They probably aren't specified for 2.5kHz. But the cap you need to change to alter the phase detector low pass filter is the one connected to PFLT on pin 8.

Do not assume that the board you have follows exactly the evaluation circuit in the data sheet. I would recommend measuring the input load resistors, they may be 50 ohms. What impedance are you driving it with?

You will need to examine all the components in the circuit to ensure that they are compatible with your low frequency and unconventional connection to audio circuits. It is designed for RF use.

aarg:
You will need to examine all the components in the circuit to ensure that they are compatible with your low frequency and unconventional connection to audio circuits. It is designed for RF use.

Unfortunately, I can't find a schematic. Looks like I should just go with a more conventional mixer/phase detector for audio frequencies. Thanks for the help.

Why would you use the evaluation board for audio frequencies though? No need for impedance
matched traces or SMA connectors surely?

see http://sound.whsites.net/project135.htm

Allan