Author Topic: How do I do phase detection for a Bode Plotter  (Read 859 times)

0 Members and 1 Guest are viewing this topic.

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
How do I do phase detection for a Bode Plotter
« on: April 18, 2021, 09:29:16 am »
So I'm currently trying to come up with a way to do bode plots without spending copious amounts of money on a function generator (I know there are cheap func gens on Ali, unfortunately our  govt has banned them).
I have an AD9833 based function generator up and running. Magnitude measurement will be easy with a peak detector. However, I'm worried about the phase part. I know a XOR gate can be used to build
a phase detector, but will it be accurate enough? Even before that I would need to convert it into a square wave, but most comparators are pretty slow (And a few that aren't are quite pricey). Can I just drive a high gain
common emitter amplifier into saturation? Would the propagation delay be low enough? (The max frequency from the AD9833 will be 12.5MHz so I'm assuming a few ns of delay is what I require)

Or is this just a fool's errand?
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #1 on: April 18, 2021, 10:38:50 am »
Do you have more info on the mixer method?
As for the ADC, I'm assuming 2 25MSPS ADCs will be enough to measure the phase difference. Is that correct?

Thanks, btw
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6175
  • Country: ro
Re: How do I do phase detection for a Bode Plotter
« Reply #2 on: April 18, 2021, 11:03:46 am »
If you have a dual 25MHz ADC, then you don't need any mixer.  Just digitize the input and the output of the device under test, and extract phase numerically (since the AD9833 is digitally controlled, I assume a processor is available somewhere to crunch the numbers from the ADC).

Also, I am curious why, or what method do you have in mind where an AWG will help more than the AD9833.  Do you have a dual channel oscilloscope?  That would make the task much easier.

There are many ways to measure phase.  What tools/parts are available?  And what do you want to measure, mostly audio, or RF/ham radio?
« Last Edit: April 18, 2021, 11:11:39 am by RoGeorge »
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #3 on: April 18, 2021, 11:17:31 am »
I'm just looking to characterize fairly low frequency (~10MHz and less. Mainly audio stuff though) filters and amplifiers. I wish I could get an AWG at reasonable prices, but I'm a student, and Aliexpress is not
available to me anymore so the 60MHz cheapies aren't something I can buy.

As for the ADCs, if they're the only ways to get the phase difference, I'll go that way, but if not I'd like to go the mixer way. Makes things much cheaper. ADCs at that sampling rate basically require a very fast microcontroller or
an FPGA, either of which would balloon the budget. Again, if that's the only way to achieve my goal, I'll do it. On the other hand, if there's a cheaper way that works, I'd like to go that way.
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #4 on: April 18, 2021, 11:28:26 am »
That is definitely outside of my budget. Around $100 maximum is what I can afford as a broke student.
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #5 on: April 18, 2021, 11:32:50 am »
Are you sure it's $200? Where I live it retails for $500
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6175
  • Country: ro
Re: How do I do phase detection for a Bode Plotter
« Reply #6 on: April 18, 2021, 11:47:57 am »
For audio you can also use the sound card, both as a generator and as an oscilloscope, either by controlling it from your preferred programming language, or by using ready made programs like this one:  https://www.zeitnitz.eu/scope_en

Some sound cards are capable of recording at much higher sample rates than the Nyquist criteria would sugest, e.g. 24bits/192kHz. (beware some soundcards are advertised as 24/192 but they are able only to play, and not able to record at 24bits/192kHz).
« Last Edit: April 18, 2021, 12:03:41 pm by RoGeorge »
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #7 on: April 18, 2021, 12:03:21 pm »
A soundcard would be fairly limiting. While most of the filters I'll be working on will be in the AF spectrum, for amplifiers it's going to be significantly higher most of the time.
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6175
  • Country: ro
Re: How do I do phase detection for a Bode Plotter
« Reply #8 on: April 18, 2021, 12:03:56 pm »
As for the ADCs, if they're the only ways to get the phase difference, I'll go that way, but if not I'd like to go the mixer way. Makes things much cheaper. ADCs at that sampling rate basically require a very fast microcontroller or
an FPGA, either of which would balloon the budget. Again, if that's the only way to achieve my goal, I'll do it. On the other hand, if there's a cheaper way that works, I'd like to go that way.

Sure it can be made without ADC.  First, speaking of FPGA's with ADC (and audio, too) less than $100:
https://www.eevblog.com/forum/fpga/arrow-deca-max-10-board-for-$37/
https://www.arrow.com/en/products/deca/arrow-development-tools
Can easily beat an Analog Discovery, but will be harder to use and with less community support.  Thought, for a student it will be much more to learn, and explore when dealing with FPGA's + ADC/DAC + MB of local memory and local DSP capabilities.  Can even run Linux.   :D




Back to the XOR gate, a transistor based amplifier would be enough, just that I wouldn't drive it into saturation, because recovering from saturation might take too long.  Better use it as an amplitude limiter circuit (aka compressor).
« Last Edit: April 18, 2021, 12:06:22 pm by RoGeorge »
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #9 on: April 18, 2021, 12:20:37 pm »
I was literally looking to buy one, so that's quite nice.
I would however like more details on the mixer method, as I'd like something to use for now while I learn all about the FPGA and the ADC.

Thanks guys
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #10 on: April 18, 2021, 01:03:50 pm »
Oh no, it's definitely not anything high frequency. We're talking sinusoids of max 12.5MHz
 

Offline shaheansarTopic starter

  • Contributor
  • Posts: 36
  • Country: in
Re: How do I do phase detection for a Bode Plotter
« Reply #11 on: April 18, 2021, 01:07:14 pm »
As for the ADCs, if they're the only ways to get the phase difference, I'll go that way, but if not I'd like to go the mixer way. Makes things much cheaper. ADCs at that sampling rate basically require a very fast microcontroller or
an FPGA, either of which would balloon the budget. Again, if that's the only way to achieve my goal, I'll do it. On the other hand, if there's a cheaper way that works, I'd like to go that way.

Sure it can be made without ADC.  First, speaking of FPGA's with ADC (and audio, too) less than $100:
https://www.eevblog.com/forum/fpga/arrow-deca-max-10-board-for-$37/
https://www.arrow.com/en/products/deca/arrow-development-tools
Can easily beat an Analog Discovery, but will be harder to use and with less community support.  Thought, for a student it will be much more to learn, and explore when dealing with FPGA's + ADC/DAC + MB of local memory and local DSP capabilities.  Can even run Linux.   :D




Back to the XOR gate, a transistor based amplifier would be enough, just that I wouldn't drive it into saturation, because recovering from saturation might take too long.  Better use it as an amplitude limiter circuit (aka compressor).

How would I make a transistor amplifier that limits the amplitude but not saturate? I guess I could use diodes, but then wouldn't that cause the same issues?
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6175
  • Country: ro
Re: How do I do phase detection for a Bode Plotter
« Reply #12 on: April 18, 2021, 02:02:50 pm »
An intuitive explanation (but sloppy) would be that the BC junction switches between direct and reverse polarization when switching between saturation and amplification regimes.  There are ways to avoid saturation.
https://www.physicsforums.com/threads/why-does-my-transistor-desaturate-so-slowly.577557/

(random pdf sourced with Google from a .edu domain to define active/saturation regions https://www.pitt.edu/~qiw4/Academic/ME2082/Transistor%20Basics.pdf ).


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf