Originally posted by scrungy_doolittle
View Post
Announcement
Collapse
No announcement yet.
Direct I/Q demodulation
Collapse
X
-
Originally posted by sled View PostTaking one sample every 0.18uSec needs your ADC to run at 1/(0.18*10^-6) Hz = 5.55MS/s, this fills up your buffer of 360 samples in 360*0.18uS = 64.80uS no?
For IQ demod Mr Nyquist says you have to sample a minimum of twice the highest frequency ( ie 2 "I" samples and 2 "Q" samples) for every cycle. So the sample frequency for 15 Khz is 30 Khz. The I and Q samples are separated in time by 90 degrees. There is no need to sample more than this per cycle. Gather up sufficient samples ( eg 1024 ) and then do an FFT / DFT .. this will give amplitude and phase.
The AD5933 does all this in one chip .... ;-)
and you can get it on a little pcb here ... http://store.digilentinc.com/pmod-ia...ance-analyzer/
Even though it is classed as an "impedance analyzer" ... it makes a superb dsp engine for a discrim detector.
Comment
-
Originally posted by sled View PostTaking one sample every 0.18uSec needs your ADC to run at 1/(0.18*10^-6) Hz = 5.55MS/s, this fills up your buffer of 360 samples in 360*0.18uS = 64.80uS no?
But what it does let you do, if you sample the input as well, is determine the phase shift trivially. Use a buffer that can hold two cycles. In the transmit buffer, find the first 0 value. whatever that
index is, becomes index 0 for the receive buffer. So if the transmit buffer hits a 0 at index 29 in the buffer, then you find the first zero in the receive buffer, and the difference in the index give you your phase shift directly in degrees.
Comment
-
Originally posted by moodz View PostFor IQ demod Mr Nyquist says you have to sample a minimum of twice the highest frequency ( ie 2 "I" samples and 2 "Q" samples) for every cycle. So the sample frequency for 15 Khz is 30 Khz. The I and Q samples are separated in time by 90 degrees. There is no need to sample more than this per cycle. Gather up sufficient samples ( eg 1024 ) and then do an FFT / DFT .. this will give amplitude and phase.
[ATTACH]38472[/ATTACH]
[ATTACH]38473[/ATTACH]
Comment
-
Originally posted by scrungy_doolittle View Postyes and no. To get 1 sample every degree, yes. That is why the 10 msample per second. ADC works. Now, do you need all of that? Well no.
But what it does let you do, if you sample the input as well, is determine the phase shift trivially. Use a buffer that can hold two cycles. In the transmit buffer, find the first 0 value. whatever that
index is, becomes index 0 for the receive buffer. So if the transmit buffer hits a 0 at index 29 in the buffer, then you find the first zero in the receive buffer, and the difference in the index give you your phase shift directly in degrees.
Comment
-
AD5933. Nice chip. I think I'll propose using that in one of the medical devices I work on.
It looks to me like this chip can generate the excitation frequency as well. Could it be as simple, as using this chip to generate the frequency, and feeding the resulting signal from the coil into the input, and then just reading the results directly over the I2C bus at 400,000 bits per second. I'd be happier if it were SPI, even though I hate SPI, it at lest will read much faster. I don't see how one would be able to track the data in real time, by reading the I2C at 400,000 bits per second....
So how does I and R (imaginary and real) relate to the X and Y channels or the X and R if you will.
Comment
-
Originally posted by scrungy_doolittle View PostAD5933. Nice chip. I think I'll propose using that in one of the medical devices I work on.
It looks to me like this chip can generate the excitation frequency as well. Could it be as simple, as using this chip to generate the frequency, and feeding the resulting signal from the coil into the input, and then just reading the results directly over the I2C bus at 400,000 bits per second. I'd be happier if it were SPI, even though I hate SPI, it at lest will read much faster. I don't see how one would be able to track the data in real time, by reading the I2C at 400,000 bits per second....
So how does I and R (imaginary and real) relate to the X and Y channels or the X and R if you will.
it's a really nice chip, the PGA allows to increase the dynamic range on demand. With a switch on the receive and transmit end we could characterize the TX and RX coil and adjust the parameters, a detector that could work with many existing coils like plug and play. Question is whether 12bits are enough
Comment
-
...a PC soundcard could do the TX and IQ RX ... try the audio tools from here ... I set the PC to internal sound loop using stereomix ... http://www.satsignal.eu/software/audio.html .
You dont have to register the tools to use them .... great for basic experiments ... see how the phase and amplitude varies on the vector scope ... compare response of capacitor / inductor and resistor ....
A real detector would require you to write code ;-) .....
Comment
-
.... this application note from Microchip makes development of an IQ TX / RX sampler easier than falling off a log ... http://ww1.microchip.com/downloads/e...tes/01115A.pdf
Particularly because the fully documented source code is available also.
Comment
-
Originally posted by moodz View Post.... this application note from Microchip makes development of an IQ TX / RX sampler easier than falling off a log ... http://ww1.microchip.com/downloads/e...tes/01115A.pdf
Particularly because the fully documented source code is available also.
What I do at the moment:
- Full sine wave table with 4096 entries, 16bit
- 32-bit phase accumulator for DDS
- Calculate phase increment for desired frequency
- Double buffer for RX and TX to hold samples for about 10ms (= 5ms double buffered)
- Configure ADC at 5.33MS/s with hardware oversampling, i.e samples are accumulated in hardware, using a 64x oversampling gives me 83kS/s maximum sample rate at 15bit.
- Configure DMA for both DAC and ADC in cycle mode with interrupt on half-full / half-empty
- Configure Timer3 to trigger at exactly four times the sampling frequency, starting both a ADC and DAC conversion simultaneously
- In half-full/half-empty interrupt (occurs at a rate of ~200Hz, every 5ms):
- I fill the DAC buffer with sine values (DDS)
- I get the RX samples in an array, interleaved - i.e samples[even_index] = I_i and samples[odd_index] = Q_i
- I downsample the I, Q values
- Write values to PC over UART for debugging
That's my goal for the moment, still missing the pre-amp and coil driver, only function generator + oscilloscope hooked up.
The tricky part is to find optimal values for the TX frequency, so that I can configure the timer to trigger at 4x the TX frequency (prescaler, period).
Not sure how much I gain by this batch processing, maybe a simple interrupt at 4x TX frequency would work fine too.
If somebody is interested in the hardware oversampling: http://www.st.com/content/ccc/resour...Analog_ADC.pdf
Comment
-
sounds reasonable, depending on how close to the zero crossing it triggers. I can see a problem with weak signals triggering it at the wrong time. I work with a medical device, where I have a simple zero crossing circuit that does this for a damped sinusoidal wave form. The problem is that the zero crossing is offset from where it actually occurs. You need to trim it. And we don't. In my case, I am just interested in the time between zero crossings, so it works.
In this case, one would probably want to use a DAC to be able to tweak the opamp comparator threshold. With the PIC24 gc010 having three built in comparators, and two opamps, it would be easy.
The comparator can trigger an interrupt directly. If your sinewave table has 360 values in it, then I believe this would work.
Comment
-
Thank you Carl. That makes everything else make sense.
So the real part is the same as the Y, or resistive channel? or is q the real part.
Lets redo that with the following notional differences.
r = resistive channel
R= real part of the number from the AD5933.
Would it be:
Y=r=Q or Y=R=Q
Q=quadrant
I=in-phase
i=imaginary.
how do these relate?
The ADC5933 produces a "real" value and an "imaginary" value. How do these relate to X,Y,r,I,Q
Comment
-
Originally posted by scrungy_doolittle View PostThank you Carl. That makes everything else make sense.
So the real part is the same as the Y, or resistive channel? or is q the real part.
Lets redo that with the following notional differences.
r = resistive channel
R= real part of the number from the AD5933.
Would it be:
Y=r=Q or Y=R=Q
Comment
Comment