Frequency Response Analyzer with Bode Plots

Post discussions on applications you are writing
Post Reply
hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: Frequency Response Analyzer with Bode Plots

Post by hexamer »

GJA14 wrote:
Tue Apr 27, 2021 3:43 am
I'm looking to do loop gain and phase Bode plots on SMPS with switching frequency 100Khz or less. Are the 2204A and 2205A capable of doing adequate FRA plots for the above scenario or is it necessary to go up to higher models with higher sample rates, memory depth, and resolution and if so what are the minimum scope specifications needed for the above case?
Hello GJA14! Here's a good thread covering this topic: topic41113.html

Key takeaways:
  1. Due to the small buffer and 8-bit resolution, scopes like the 2204A and 2205A will likely have problems with SMPS FRA
  2. Both larger memories and higher resolution can help, but both may not be required
  3. One key factor is the amount of ripple (noise) you'll be recovering the small stimulus from
So, while I've not tested to confirm (all of) this, here is my opinion:
  1. The PS5000D scopes are probably best for this application due to huge buffer depth, high resolution and bandwidth limiter
  2. The PS4x24A scopes are probably a good choice because of their huge buffer depth and 12-bit resolution
  3. If you could guarantee very low ripple and get away with a relatively large stimulus, an 8-bit scope with large buffer (e.g. PS2208B) may work just fine

GJA14
Newbie
Posts: 0
Joined: Sat Apr 17, 2021 11:46 pm

Re: Frequency Response Analyzer with Bode Plots

Post by GJA14 »

Thanks hexamer for your points and opinions.

I had previously read the thread you linked along with all of the links within it, however I wasn't sure what range of freq. was being attempted in that one. By the numbers it would seem that for 100Khz and below that the 2000 series should work with the exception of the very small buffer memory depth on the 2204A and 2205A, but after looking through the specifications on the 2000 series: https://www.picotech.com/oscilloscope/2 ... ifications --- I noticed that under the SDK/API section it calls out that the "Buffer Memory in USB Streaming Mode" is "Limited Only by PC". This would seem to make the very small buffer depth on the 2204A and 2205A a none issue if indeed the FRA software through the SDK/API was able to take advantage of that.

Can you confirm whether the FRA uses only the internal buffer memory (block mode) or if it uses or is able to use the USB streaming mode and the PC's memory for the buffer memory?

I know that the latest version of the FRA offers real time plotting so it makes me think that perhaps it is using the USB streaming mode.

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: Frequency Response Analyzer with Bode Plots

Post by hexamer »

GJA14 wrote:
Thu Apr 29, 2021 6:38 am
Thanks hexamer for your points and opinions.

I had previously read the thread you linked along with all of the links within it, however I wasn't sure what range of freq. was being attempted in that one. By the numbers it would seem that for 100Khz and below that the 2000 series should work with the exception of the very small buffer memory depth on the 2204A and 2205A, but after looking through the specifications on the 2000 series: https://www.picotech.com/oscilloscope/2 ... ifications --- I noticed that under the SDK/API section it calls out that the "Buffer Memory in USB Streaming Mode" is "Limited Only by PC". This would seem to make the very small buffer depth on the 2204A and 2205A a none issue if indeed the FRA software through the SDK/API was able to take advantage of that.

Can you confirm whether the FRA uses only the internal buffer memory (block mode) or if it uses or is able to use the USB streaming mode and the PC's memory for the buffer memory?

I know that the latest version of the FRA offers real time plotting so it makes me think that perhaps it is using the USB streaming mode.
I appreciate you doing the research and thinking out of the box.

This seems like a nice idea, but unfortunately (1) I can confirm the current version only supports block capture/transfer and (2) even if it did support USB streaming mode, there would be limitations:

The 2204A and 2205A have a sampling rate limit of 1 MS/s in USB streaming mode. Why is that important? It means that signals above 500 kHz will be aliased into the measurement. In your SMPS example there are higher order harmonics of the 100 kHz switching frequency above 500kHz, and some switching transients well above that. Might you get lucky that these don't get aliased into the DFT/filter? Maybe, but hard to tell. For SMPS measurements it's best to set the sampling rate to at least 2x the scopes bandwidth limiter. For the PS5000D scopes, with a 20 MHz bandwidth limiter, the default "Noise reject" mode sampling frequency is 62.5 MS/s

As for others scopes that support faster USB streaming, well ... they also have much larger buffers. The 2206A with its 32 MS buffer may be workable in block mode. The narrowest bandwidth it could achieve in the DFT is about 30 Hz, which seems pretty decent. That may be workable for SMPS, but again, I have not tested it, and you need to consider takeaway 3 above.

I certainly don't want to discourage experimentation, but I am doubtful :(

GJA14
Newbie
Posts: 0
Joined: Sat Apr 17, 2021 11:46 pm

Re: Frequency Response Analyzer with Bode Plots

Post by GJA14 »

Thanks, I appreciate all the information.

Do you think you might add the feature of USB streaming mode to a future update? I understand why the 2204A and 2205A are still not good choices for this application, but I am just thinking it could add some additional performance to some of the other models that have better sampling rates and adequate but not necessarily huge buffer sizes.

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: Frequency Response Analyzer with Bode Plots

Post by hexamer »

hexamer wrote:
Tue Mar 30, 2021 1:50 am
Well, I'm happy you got it working :), but I can't really tell what was going on. I tried re-installing the SDK without PS6000a and ps6000 support, but can't get it to crash. Only other thing I can think of that may be relevant is what version of the Picoscope app you had installed. The FRA app is setup to delay load the DLL files in order to implement a preference for the versions from SDK folders first. If it fails to load those, it can load DLLs from the Picoscope app. If there were some kind of incompatibiity there maybe it would cause an issue.
Nicosten, Yosi and anyone else who also stumbled on this problem ... I found out what's going on. The function that demand-loads the DLLs throws an exception when a DLL does not exist anywhere (SDK or PicoScope Application folders). The FRA App was not handling the exception, so it crashed. I was unable to reproduce this before, because I still had the PicoScope application installed. I fixed the issue and also re-wrote some code so that installing only some PicoScope SDK DLLs is valid. That fix will be included in the next release. Until that time, you can workaround the issue by making sure to install the SDK for all scope families.

_Wim_
Advanced
Posts: 0
Joined: Sun Nov 12, 2017 11:31 am

Re: Frequency Response Analyzer with Bode Plots

Post by _Wim_ »

_Wim_ wrote:
Sun Feb 10, 2019 12:13 pm
(copied from my post at EEVBlog)

I have been a big fan of using the app FRA4Picoscope to generate bode plots. This for me makes the Pico products much more useful.

By using a reference resistor in series with a DUT, it is possible to calculate the impedance from the DUT. For this a made a small tool to do the calculation automatically, and also to allow the user to more easy compare different bode plots in once view. Currently, you can open the CSV-files generated by FRA4Picoscope, and view and compare them easily in the different impedance views.

I programmed automatic cursors, a zoom function for each individual axis, and both logarithmic and linear frequency axis. When a CSV file is opened, the used reference resistor is requested. This can be different for each file (to allow the user to choose the optimal value for the DUT) in the same plot view. You can also copy pictures/data to the clipboard (data can be pasted in excel directly), or save them to a file.

Attached is the program, including some test data to allow non-Pico users to have a go also. If some other scopes can generate bode plot data (frequency, gain and phase), it should be no problem to make an import functionality for these also. I am still cleaning up a bit of my code, once finished the code will be available as open source also.

Enjoy! Feedback is off course much appreciated.

Installation is not required, just unzip the package and run the exe. It does need dotNet 4.6.1 or higher. The software was written in Visual Studio2017 community edition, using the standard chart component of dotNet (no external libraries used for charting).

Remark: files are too big to attach here (max 256K allowed), please see http://www.eevblog.com/forum/testgear/r ... plot-data/ for more details
I updated my app to work with the lastest verion of FRA (some small API changes were implemented related to scope resolution in the lastest version of FRA). Other small changes:
- renamed the tabs to clearly indicate series capacitance & inductance are measured
- added the option to disable the positive gain limiting

Source code still available on GitHub for those interested (https://github.com/WimHuyghe/FRA-Impedance-Viewer)
Attachments
ImpedanceViewer1014.zip
(539.85 KiB) Downloaded 1523 times

lazy_electron
Newbie
Posts: 0
Joined: Wed Mar 10, 2021 2:53 pm

Re: Frequency Response Analyzer with Bode Plots

Post by lazy_electron »

Aaron - thank you for a very useful tool for all picoscope owners.

A few pages back, someone reported a problem when using a 5443D. I believe the reason for that issue was not having the power supply connected to the picoscope. The four channel 5000 series will only operate in two channel mode (A&B) when powered solely by USB. Despite FRA only requiring two channels, it seems the device does not initialise correctly in FRA without the external power adapter connected. I tested this with my 5444D and saw similar error messages.

Maybe there is a way FRA could operate in the 2 channel only mode (A&B), or otherwise just show an error to explain requirement for the external power adapter. Maybe the API has a method to check for external power?

Anyway, thanks again for FRA.

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: Frequency Response Analyzer with Bode Plots

Post by hexamer »

lazy_electron wrote:
Sat Sep 18, 2021 9:10 am
Aaron - thank you for a very useful tool for all picoscope owners.

A few pages back, someone reported a problem when using a 5443D. I believe the reason for that issue was not having the power supply connected to the picoscope. The four channel 5000 series will only operate in two channel mode (A&B) when powered solely by USB. Despite FRA only requiring two channels, it seems the device does not initialise correctly in FRA without the external power adapter connected. I tested this with my 5444D and saw similar error messages.

Maybe there is a way FRA could operate in the 2 channel only mode (A&B), or otherwise just show an error to explain requirement for the external power adapter. Maybe the API has a method to check for external power?

Anyway, thanks again for FRA.
Thank you for reporting your experience. Can you tell me what error code you're getting during initialization?

The application is designed to allow 2 channel mode for USB-only power on flexible power scopes like the 5000A/B/D series. I regularly test it on my PS5444A. In the issue you cited, the problem is that the scope reported that it's not getting enough power from USB to run two channels. So, I'd like to see if that's what you're seeing or if it's some other issue specific to the 5000D.

Or, perhaps your comment is more about the messaging? I agree that "Fatal error: Failed to disable channel: 290" is not terribly insightful to anyone that doesn't program with the API. So, perhaps that aspect could be improved since it's a "normal" sort of error that can be corrected by the user.

lazy_electron
Newbie
Posts: 0
Joined: Wed Mar 10, 2021 2:53 pm

Re: Frequency Response Analyzer with Bode Plots

Post by lazy_electron »

hexamer wrote:
Wed Sep 22, 2021 11:39 am
Thank you for reporting your experience. Can you tell me what error code you're getting during initialization?
Sure, this is the error message I see with 5444D scope (serial number obscured **** by me)

Code: Select all

ps5000aSetChannel( 16384, 2, 0, 0, 0, 0 );Fatal error: Failed to disable channel: 290
Status: 5444DMSO S/N: IO716/**** successfully initialized.

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: Frequency Response Analyzer with Bode Plots

Post by hexamer »

lazy_electron wrote:
Fri Sep 24, 2021 12:33 pm
hexamer wrote:
Wed Sep 22, 2021 11:39 am
Thank you for reporting your experience. Can you tell me what error code you're getting during initialization?
Sure, this is the error message I see with 5444D scope (serial number obscured **** by me)

Code: Select all

ps5000aSetChannel( 16384, 2, 0, 0, 0, 0 );Fatal error: Failed to disable channel: 290
Status: 5444DMSO S/N: IO716/**** successfully initialized.
Thank you for the details. 290 is the error code indicating the USB port is not supplying enough power. I'll work on enhancing that message so that the solution is more apparent to the user.

I'll reiterate the solution from a few posts ago (but different order):

1) Try a USB 3 port if your computer has one
2) If you don't have a USB 3 port, try a different USB port on your computer
3) Use the Picotech USB cable if you're not already
4) Plug the scope into to AUX DC power

Rumpel
Newbie
Posts: 0
Joined: Wed Jun 10, 2020 8:52 pm

Re: Frequency Response Analyzer with Bode Plots

Post by Rumpel »

Rumpel wrote:
Fri Jun 12, 2020 2:26 pm
Hi.
First of all THANKS A LOT for such an extremely useful tool which saved my PSU development :)

Secondly I would like to share my Python script which I have made for converting exported data into excel. It groups data into books and sheets and plots multiple data variants on one chart so it is simplier to compare different configurations. Hope it will be useful to someone.

Can't attach files to this message for some unknown reason so uploaded then on Google Drive:
https://drive.google.com/file/d/1J8QKAZ ... sp=sharing
https://drive.google.com/file/d/1P0MAKu ... sp=sharing
(better open with proper app, not in web view)

How to use:
You can simply drag and drop exported data files onto this script (this feature needs to be enabled in explorer for python files). If dataGrouping is enabled it will group data files into excel books and sheets according to grouping criteria based on filenames, if not it will simply plot all data into one chart. Almost all formatting can be changed in excelBook -> format section. All format explanations (except what is explicitly explained in coments) is given in xlsxwriter documentation.
I have redesigned my python script to be more like a proper module.

Main changes:
  • Nyquist plot option added in two variants (for whole graph and origin close-up)
  • self-sufficient code parts consolidated into separated functions so they can be used independantly
  • more customization added and all parameters are now passed as function arguments
  • module can now be imported and used from external scripts
  • all parameters can be specified as arguments using command line (use -h to see description)
  • Excel book formatting can be exported and imported from a file in JSON format
The module is definitely NOT foolproof and I haven't tested it for all possible situations due to lack of time so use it wisely on your own risk :)
Attachments
FRAplotter_v2.0.py
(54.18 KiB) Downloaded 1029 times

kaimex
Newbie
Posts: 0
Joined: Tue Feb 26, 2019 4:29 pm

Re: Frequency Response Analyzer with Bode Plots

Post by kaimex »

Hi Aaron,

sometimes I would like to use my PicoScope 2204A and FRA4PicoScope to make an absolute measurement of voltage vs frequency without having a reference channel.
Your program allows to choose between A & B as Input Channel or Output Channel.
For a transfer response I would normally use A as Input Channel and B as Output Channel.
Would it be possible to implement a third option for picking the "Input Channel" that replaces A (respectively its complex voltage phasor) by just a reference constant "1" in your program, i.e. resulting in ignoring channel A ?

Regards Kai

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: Frequency Response Analyzer with Bode Plots

Post by hexamer »

kaimex wrote:
Mon Dec 27, 2021 1:23 pm
Hi Aaron,

sometimes I would like to use my PicoScope 2204A and FRA4PicoScope to make an absolute measurement of voltage vs frequency without having a reference channel.
Your program allows to choose between A & B as Input Channel or Output Channel.
For a transfer response I would normally use A as Input Channel and B as Output Channel.
Would it be possible to implement a third option for picking the "Input Channel" that replaces A (respectively its complex voltage phasor) by just a reference constant "1" in your program, i.e. resulting in ignoring channel A ?

Regards Kai
Hello Kai,

I can look into that. In the meantime, one thing you can do to get this information is turn on Autorange Diagnostics and DFT Diagnostics in the log. That will produce output like this:

Code: Select all

Status: Starting frequency step 51 (999999.978 Hz)
Status: Setting input channel range to ± 5 V
Status: Setting output channel range to ± 10 mV
Status: DFT results:
   Input magnitude: 1.31068e+07; Input amplitude: 13093.7; Input phase: -1.47031; Input purity: 0.999001; Input DC energy: 0.881119; Input signal energy: 1.71617e+11, Input total energy: 1.71788e+11
   Output magnitude: 6.55992e+06; Output amplitude: 6553.37; Output phase: -3.04011; Output purity: 1; Output DC energy: 21877.1; Output signal energy: 4.29895e+10, Output total energy: 4.29895e+10
The Input/Output amplitude are reported in ADC units. For example, the input voltage amplitude would be (13093.7 / 32767) * 5 = 1.998 V. This example was with the demo scope, set to 4Vpp. PS2204A's ADC scale is also 32767.

With some spreadsheet manipulations on the log, it would be fairly straightforward to obtain and graph this data.

kaimex
Newbie
Posts: 0
Joined: Tue Feb 26, 2019 4:29 pm

Re: Frequency Response Analyzer with Bode Plots

Post by kaimex »

Hello Aaron,

as you recommended, I have enabled Autorange Diagnostics and DFT Diagnostics and produced such a log.
I wonder what the difference is between Input/Output magnitude and Input/Output amplitude ?
( Do I need to know that ? )
So I have to write a program that reads and interprets data from lines 1 (frequency), 3 (output range), 9 (output amplitude & phase) of the log-file.
OK, I'll consider that.

Thank you
Kai

kaimex
Newbie
Posts: 0
Joined: Tue Feb 26, 2019 4:29 pm

Re: Frequency Response Analyzer with Bode Plots

Post by kaimex »

Hello Aaron,

another question:
I have tried to set the starting frequency to 0.1 Hz (lowest value when controlling the 2204A with PicoScope6), but FRA4PicoScope says "Start frequency must be >=1.34591 Hz".
Is this a fixed lower bound set by your program or does it depend on the settings ?
Sometimes I am using the 2204A for impedance measurements. With capacitors of around 1000 µF, it would be desirable to have sub-Hz frequencies available.

Regards and happy New Year
Kai

Post Reply