Oscilloscope bode plots - Page 1
Forum section: electronics / beginners

author: skysurf76
author_rank: Regular Contributor
timestamp: September 24, 2016, 09:33:48 am
content: I am an electrical engineering major and had a lab this week where we had to make a Bode plot for a filter response and I wanted to put something on the internet that google could find for "Oscilloscope Bode plot" due to my difficulties in finding information this week. I think Dave made a video about this, but he can be a bit long winded (love you Dave) and I wanted to give people a quick resource to find a solution.What you do is set your time base on the horizontal axis so that your frequency sweep time on your arbitrary function generator is equal to same time on the horizontal time base on your oscilloscope.Example 1)If you are sweeping from 0 to 40kHz in 40ms on your function generator then you set your time base to 4ms per major division on your oscilloscope. That way you have 40ms in total across your horizontal time base so you know 1ms is equal to 1kHz. Every oscilloscope has 10 major divisions from left to right, so if you set your time base to 40ms, then you know each division is equal to 4ms. But you also know each ms is equal to 1kHz. Each division is equal to 4Khz, and each minor division is equal to 4kHz/5.Example 2)If you are sweeping from 0 to 50kHz in 50ms on your function generator then you set your time base to 5ms per division on your oscilloscope and you know the frequency range between each horizontal division is equal to 5kHz. Each minor division is equal 1kHz.As an example of major and minor divisions see the following...|''''|''''|''''|''''|''''|''''|''''|''''|''''|''''|That is how the horizontal divisions on oscilloscope looks. | are major divisions (ten of them) and ' are minor divisions (technically 100 of them because each major counts as one minor).Also you have to get your triggering right so that your function generator sweep starts at the far left of your oscilloscope. What I did was hook up the trigger output on the function generator to a channel on the oscilloscope and triggered from that channel on the rising edge I believe. If that doesn't work try triggering from the falling edge of the trigger output of the function generator. The function generator will put out a square wave that will have a rising or falling edge at the beginning of the sweep. I just know my sweep initially started at the middle of my oscilloscope and my professor changed the trigger to the other edge and then the sweep started at the far left side. I'm sure there will be a post following this that will explain it.If anyone can add anything to make this more clear please post. Also please explain the triggering as I am a bit shaky on that point.Edit: It has been pointed out in replies to this post that the result of this method won't actually give a true Bode Plot, it does allow you to quickly take readings from the display which can be put into a spreadsheet however. It then becomes trivial to graph the data using whatever scale fits what you're trying to show. In my case I took the data and entered it into excel and made a bode plot by making the y-axis dB and the x-axis logarithmic.

author: tggzzz
author_rank: Super Contributor
timestamp: September 24, 2016, 10:00:24 am
content: Bode plots have a logarithmic (amplitude) y-axis, i.e. linear in dB units.Bode plots also have a logarithmic (frequency) x-axis, so each division represents the sameratio, e.g. an octave or a decade.Thus if "Each minor division is equal 1kHz", youdon'thave a bode plot.

author: bson
author_rank: Unknown
timestamp: September 25, 2016, 09:02:09 pm
content: First, Bode frequency plots are log-log which is difficult to do with most scopes, though some can do log user math and AWGs can generally do log sweeps.Second, scopes can't do phase plots, at all. Without phase it's not a Bode plot. The Bode phase plot is lin-log so also requires a log sweep.Phase is an important property of filters since they are generally designed to trade off phase linearity vs passband ripple. In fact, phase is critical when characterizing any 4-port device. Without it all you do is look at signals.BTW, I could probably McGyver my LeCroy WS3054 to do a log-log frequency plot: channel trace to a log math trace, run a measurement such a max, peak-to-peak, or rms on the math trace, then do a rolling P trace off the measurement. For phase a second input (ref) is needed, and more advanced math for atan(R/A) which I don't think this scope will do, plus it would run out math traces. And even then it won't do averaging, complex readouts, won't be properly calibrated (though that could be somewhat mitigated by using memory traces for nulling and linearizing, assuming sufficiently advanced math capabilities). Even then I feel the result would likely be very poor compared to an actual VNA that will cost a fraction of a scope sufficiently advanced. (My super simple 5Hz-200MHz VNA cost me half as much as my scope, not counting active probes, MSO, and decode options, yet blows away the scope for 4-port frequency domain measurements.)

author: AlfBaz
author_rank: Super Contributor
timestamp: September 25, 2016, 10:03:43 pm
content: bson has articulated why this method has its pitfalls, which I found out by actually doing this.I used a wavegen's "sync out" as the reference phase and fed this into my lecroy scope along with the signal from the DUT.I then used GPIB, and labview to control the wavegen and ask the scope for phase difference between "sync" signal and DUT signal, as well as the latter's amplitude using the scopes measurement utilities.I collect this data for each frequency point and average the result. I then increase the wavegens frequency logarithmically and repeat for the number of points chosen until the desired upper frequency is reached. I use the wavegen's output impedance of 50 ohms as the reference reisitor, allowing me to simply test hook straight up to the DUT. Finally I graph the data with appropriate scalesThe results are not terrible and seem to lay somewhere in the realm of where you would expect. Not having a VNA, I cant check the results against a known correct bode plot.I suspect carrying out a calibration routine (as outlined by agilent in an impedance primer I forget the name of) would greatly increase its accuracy but stumbled upon major issues concerning delay between "sync out's" output and the actual triggering of the sine wave output which increases dramatically as you increase the wavegen's outputAttached is an image of what is essentially a LPF using the wavegens 50ohm output resistance and a 0.1uF capIn this plot there is an obscene number of data points. The glitches you see are where I have to change the scopes timebase and volts/div as the wavegens frequency increases and the DUT amplitude decreases so that the scopes measurement functions have a chance at giving me decent results

author: tautech
author_rank: Super Contributor
timestamp: September 26, 2016, 12:46:32 am
content: Quote from: skysurf76 on September 24, 2016, 09:33:48 amHere's that vid Dave did:https://www.eevblog.com/forum/blog/eevblog-396-bode-plotting-on-your-osciloscope/

author: Brutte
author_rank: Frequent Contributor
timestamp: February 02, 2017, 11:38:34 pm
content: I have made an arbitrary waveform generator using my STM32L-Discovery. Two channels at 2Msps each (uC has two 12-bit DACs). The "front-end" is 1/4 of MCP6004 (slew rate 600kV/s).So this is a log10 sweep from 100Hz to 100kHz that fits 12ms nicely (4 divisions per decade).I was also wondering if it is possible to make a true Bode plot on my scope (DS1054z).I'd like to plot both amplitude and phase while tweaking the circuit (not interested in off-line Bode plot). Nothing beyond 100Hz:100kHz.The log vertical scale for amplitude seems easy as I can stick a log amplifier in between DUT and scope and scale it in dB so that, assuming I feed 1V sine:7 divisions(+20dB) = 10V6 divisions(0 dB) = 1V5 divisions(-20dB) = 0.1V4 divisions(-40dB) = 0.01V...However, I have no idea how to plot argument (phase) real time..Do I really need an off-the shelf phase detector for that bandwidth?

author: danadak
author_rank: Super Contributor
timestamp: February 03, 2017, 11:33:48 am
content: The A/D in the STM32K family 2 MSPS in some parts, 1 in others. Souse it to find Vp-p of waveform, and use that to drive a DAC to outputwaveform value. Trigger the conversion with start of sweep anda timer to effect x axis. Note you can log the value in code and generatea log Y axis if so desired. The DAC limited to 12 bits means your y axisonly as a range of 72 db best case.Redgards, Dana.

author: Brutte
author_rank: Frequent Contributor
timestamp: February 03, 2017, 04:07:40 pm
content: Quote from: danadak on February 03, 2017, 11:33:48 amIt is 32L, never heard about STM32K. The ADC in STM32L is 1Msps, 12-bit. However, the uC is 32MHz.QuoteThat seems easy - input signal is sine and the output signal is also sine so it is enough to sense the output when zero crossing with the mean value. No need for ADC for that, a comparator tied to input capture would do. That would give me a time shift in between in and out but not a phase shift, but as the frequency is a known (exp) function of time, I think this kind of phase plot is doable on a uC.QuoteYup, that is the right direction. The scope's LCD has 12 horizontal divisions and I want a readable resolution of Bode plot so I was planning to start with 4 points per division (1 point per ms), 48 points total. Should be doable with 32MHz micro.QuoteWell, considering I already have spare 3/4 of MCP6004 on a breadboard, I think alog ampis a better solution. The log10 trick you proposed is easy to do directly from the menu of DS1054z as it can plot log10(input) - believe me, the result is terrible as it does not have the dynamic range.QuoteIt is the ADC,not DAC, that is supposed to sense the attenuation. DAC is not a limiting factor as it is 12-bit and is better than needed for DS1054z, even with scope set in highres mode. I have less than 600 pixels on an LCD and over 4000 analog DAC values to put there.

author: rstofer
author_rank: Super Contributor
timestamp: February 03, 2017, 04:10:21 pm
content: I guess you could use one DAC to send the test signal and an ADC to read the output. You could grab this data in the uC and, internally, compute the two lines to display on the scope. Then you could use 2 DACs and write the images to the scope in Single Sweep mode on 2 channels. That way you could get log-log on an essentially linear device. You would just be using the scope as a vector graphics terminal with storage.Personally, I would use the Digilent Analog Discovery with the Network tool. It is made for this kind of thing.http://www.instructables.com/id/Analog-Discovery-Network-Analyzer/https://reference.digilentinc.com/reference/instrumentation/analog-discovery-2/reference-manualI have used the Network tool with filters, I have not tried it with an amplified signal.