How do I do phase detection for a Bode Plotter - Page 1
Forum section: electronics / beginners

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 09:29:16 am
content: 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 builda 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 gaincommon 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?

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 10:38:50 am
content: 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

author: RoGeorge
author_rank: Super Contributor
timestamp: April 18, 2021, 11:03:46 am
content: 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?

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 11:17:31 am
content: 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 notavailable 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 oran 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.

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 11:28:26 am
content: That is definitely outside of my budget. Around $100 maximum is what I can afford as a broke student.

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 11:32:50 am
content: Are you sure it's $200? Where I live it retails for $500

author: RoGeorge
author_rank: Super Contributor
timestamp: April 18, 2021, 11:47:57 am
content: 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_enSome 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).

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 12:03:21 pm
content: 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.

author: RoGeorge
author_rank: Super Contributor
timestamp: April 18, 2021, 12:03:56 pm
content: Quote from: shaheansar on April 18, 2021, 11:17:31 amSure 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-toolsCan 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.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).

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 12:20:37 pm
content: 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

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 01:03:50 pm
content: Oh no, it's definitely not anything high frequency. We're talking sinusoids of max 12.5MHz

author: shaheansar
author_rank: Contributor
timestamp: April 18, 2021, 01:07:14 pm
content: Quote from: RoGeorge on April 18, 2021, 12:03:56 pmHow 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?

author: RoGeorge
author_rank: Super Contributor
timestamp: April 18, 2021, 02:02:50 pm
content: 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 regionshttps://www.pitt.edu/~qiw4/Academic/ME2082/Transistor%20Basics.pdf).