Frequency Response Analyzer with Bode Plots

Post discussions on applications you are writing
Post Reply
michaelmac
Newbie
Posts: 0
Joined: Fri Mar 10, 2023 8:48 am

Re: Frequency Response Analyzer with Bode Plots

Post by michaelmac »

Hi all,

We want to buy a picoscope and external sig gen, and use FRA as its the quickest solution to get some BODE plots of our system up to 125MHz.

I have used the FRA software in the past with the internal sig gen, and its awesome!
But now need higher frequency than the PS generators provide. Noticing that there is an external sig gen option, the best option seems to be to buy:

- Rigol DG4162 160MHz
- PicoScope 3206D 200MHz

The rigol software page has a download option with a DLL and a very basic C# prog.

Aaron - you mentioned earlier on the post that as far as you know, no one else has used an external sig gen. Is this a risk that it wont work, or you reckon it will be ok with the rigol dll? Worried about buying something that we cant use, and we don't unfortunately have the time or resource to investigate and modify the source code.

Also, do you see any other issue with the FRA software running up to 125MHz?

many thanks,
Michael.
michaelmac
Newbie
Posts: 0
Joined: Fri Mar 10, 2023 8:48 am

Re: Frequency Response Analyzer with Bode Plots

Post by michaelmac »

Hi all,
is anyone able to help, I've went ahead and got the Rigol DG4162. The FRA software just crashes (window just closes) when I select the DLL. My test setup works perfectly using FRA s/w, up to 1MHz using the internal sig gen.

EDIT: I have it building now. Running in debug mode it fails loading the plugin library:

[line 98 of file ExtSigGenPlugin.cpp] HMODULE hModule = LoadLibraryW( pluginName.c_str() );

this returns NULL. The calling function (InitEsg) doesn't handle the error, and the next function crashes. I've got limited knowledge of C++ but am trying to find my way around.

the dll I'm using is PAControl.dll which could be wrong.
ive put in its USB ID, but no idea what to put in the initialisation box.

Many thanks,
Michael.
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 »

Hi Michael,

Sorry I missed your posts,. Seems like I'm not getting notifications :(

I'm confident we can get this to work, but the issue is that the DLL plugin is something that needs to be custom developed to conform to an interface the FRA app expects. It's a pretty simple interface, so generally not a big undertaking. I'll take a look at the Rigol interface and let you know how much effort might take. I'm glad to help in whatever way I can.

Thank you for debugging that robustness issue with loading the DLL for me.

For the example I developed and tested, my homebrew signal generator is capable of 150 MHz, so I don't see any problem with what you want to do. Of course the only thing to be aware of is scope bandwidth, but your 3206 seems to have plenty.
michaelmac
Newbie
Posts: 0
Joined: Fri Mar 10, 2023 8:48 am

Re: Frequency Response Analyzer with Bode Plots

Post by michaelmac »

Hi, no probs, thanks very much for offering to help!

ah ok, yeah i had a feeling it wasnt just the actual device dll that we can download (which is actualy rgdg4k_32.dll, not PAControl.dll btw).

Yeah if you have any idea how to get the rigol interface working that would be great. I'm not very experienced in win32 c++ development, but do write c/c++ firmware and am happy to help out if i can.

Cheers,
michael.
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 »

Hi Michael,

So that I'm not totally shooting in the dark here, I bought a banged up DG1022 to get something working on my end first. Since all these units use USB-TMC and SCPI, whatever I make will probably also work for your DG4162.

Of course, with anything, there's more than on way to do it. Here are the options I outlined and the direction I'm headed:

1. WinUsbTmc
2. Write my own USB-TMC code and talk directly to the IVI ausbtmc.sys driver via native Windows USB subsystem
3. A full VISA installation which would use rgdg4k_32.dll

I chose #2 because it avoids the need to use libusb and the need to install and/or pay for a VISA software package. I may pursue VISA at a later time because it is a more universal solution.

So far I'm having good success with #2 (I'm able to transact basic SCPI commands like *IDN?). What I propose is that I create an small executable that you can run on your system to test the applicability to your DG4162, then I can proceed to create a DLL. I'll also post the source code in case we need to debug.

Thanks,

Aaron
michaelmac
Newbie
Posts: 0
Joined: Fri Mar 10, 2023 8:48 am

Re: Frequency Response Analyzer with Bode Plots

Post by michaelmac »

thats great cheers! can test it out whenever you're ready.

ive made a simple python script using SCPI and pyvisa, for doing some things with the rigol sg. One thing I noticed is that theres a max vpp for frequency ranges. When setting a frequency over scpi it just changes the vpp without an error code / warning.

MHz, Max Vpp
0-20, 10Vpp
20-70, 5Vpp
70-120, 2.5Vpp
120-200, 1Vpp

so could either check when setting up the bode plan and set a max allowed voltage based on the upper frequency, or just for now put a limit of 1Vpp for this version?
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 »

Hi Michael,

Thank you for the help testing. I've made the executable described above and published the source:
https://bitbucket.org/hexamer/usbtmc-sc ... PI-EXE.exe
https://bitbucket.org/hexamer/usbtmc-scpi-exe/src/main/

For this to work, you'll need a USB-TMC driver installed. Usually this comes from the IVI Foundation's VISA Shared Components. They leave it up to VISA implementers to distribute this. The simplest one I've found is here: https://www.keysight.com/us/en/lib/soft ... 04667.html It's pretty old (2013), but seems to work fine for me. I installed a 64 bit version, but don't know if it matters. I believe you can also get this by installing NI's IVI Compliance Package, but I've not tried that. That said, if you're able to use PyVisa, you probably already have a USB-TMC driver installed.

By default, my executable will find the first USB-TMC device, then issue some SCPI commands to get device capabilities and then sequence through three output frequencies on Channel 1 (100, 1000, 10000 Hz), for 3 seconds each. If you have more than one USB-TMC device, you can add model and serial number to the command line: Rigol-USBTMC-SCPI-EXE.exe model serialNumber to have it select a specific one.

Let me know how your device responds. The syntax is a bit different between DG1000 and DG4000, but I think I was able to select a common subset.

On the topic of frequency dependent amplitudes, I did code the ability to handle this in the DLL interface. However, I suspect there is no SCPI-way to get this information, so I'll work on coding it into a table in the DLL. I'd prefer that users be aware of the limitations rather than just be silent about it.

Thanks,

Aaron.
curiousmouse
Newbie
Posts: 0
Joined: Thu May 04, 2023 4:27 am

Re: Frequency Response Analyzer with Bode Plots

Post by curiousmouse »

Hi Aaron,

I just discovered that Picoscope could do frequency response analysis and installed the application you made, but I couldn't get the app to detect my Picoscope.

Error: No compatible PicoScope device found.
WARNING: Unable to load SDK for PicoScope Families: PS2000, PS2000A, PS3000, PS3000A, PS4000, PS4000A, PS5000, PS5000A, PS6000, PS6000A

Version 0.8.0.

I have installed both the default app and the SDK
PicoSDK_64_10.7.24.276.exe

Thoughts are welcome. Thanks!

Best regards,
TeeHowe
Martyn
Site Admin
Site Admin
Posts: 4572
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Frequency Response Analyzer with Bode Plots

Post by Martyn »

You will need the 32bit SDK https://www.picotech.com/download/softw ... 24.276.exe and make sure that the PicoScope 6 or PicoScope 7 application is not running at the same time.

Which PicoScope model do you have?
Martyn
Technical Support Manager
TheKoala
Newbie
Posts: 0
Joined: Fri Aug 04, 2023 9:23 am

Re: Frequency Response Analyzer with Bode Plots

Post by TheKoala »

Hi there !

First of all, I'd like to thank a LOT Hexamer and everyone who contributed to develop that incredible tool. It works wonderfully on my 2204A bought specifically for that task. Huge thanks to you all !

The app is super stable on my Win10 machine and does launch on my Lecroy scope running WinXP too.

Being used to the HP 3580A low frequency spectrum analyzer for audio work, I think a few features could be added or may even be in development already :
- Resizing the window would be very useful, it's a bit small on a small laptop and not the easiest to read. My Lecroy scope has a shitty resolution and the screen is too small for the whole window, so I can't use it with it, even though it seems to work fine.
- Saving plots for quick compare is a nice feature on the 3580A. Having a set of one, or four curves to compare would be useful for checking component changes or differences between circuits, instead of going with cursors and tables. Changing the color would help too, maybe something like in LTSpice with plain lines for gain and dashed lines for phase, and so on...

I have absolytely no knowledge in software dev, so I just hope those are not too time consuming to code ! Otherwise, sorry, I just hope that feedback helps 😁

Cheers and thanks once again !
esabard
Newbie
Posts: 0
Joined: Mon Aug 28, 2023 1:25 pm

Re: Frequency Response Analyzer with Bode Plots

Post by esabard »

Hello,
I'm very interested by this solution.
I have one question about the AWG (Arbitrary waveform generator) included in the Picoscope.

My goal is to measure the Closed-loop response of system (like DC-DC buck converter).
Without using a transformer, AWG is isolated from the measurement channel? If not, how could it works ?

Exemple of measurement diagram of competitor :
https://i.ibb.co/0Q8XvgN/scope-isolated.png

Thank you, ESA
bennog
Advanced User
Advanced User
Posts: 226
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: Frequency Response Analyzer with Bode Plots

Post by bennog »

The signal generator is referenced to GND, and the input channels are also referenced to GND.

So the GND of both generator and input probes are connected !

Benno
esabard
Newbie
Posts: 0
Joined: Mon Aug 28, 2023 1:25 pm

Re: Frequency Response Analyzer with Bode Plots

Post by esabard »

bennog wrote: Tue Aug 29, 2023 5:58 am The signal generator is referenced to GND, [...]
OK, thank you for your answer !
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 »

TheKoala wrote: Fri Aug 04, 2023 10:31 am Hi there !

First of all, I'd like to thank a LOT Hexamer and everyone who contributed to develop that incredible tool. It works wonderfully on my 2204A bought specifically for that task. Huge thanks to you all !

The app is super stable on my Win10 machine and does launch on my Lecroy scope running WinXP too.

Being used to the HP 3580A low frequency spectrum analyzer for audio work, I think a few features could be added or may even be in development already :
- Resizing the window would be very useful, it's a bit small on a small laptop and not the easiest to read. My Lecroy scope has a shitty resolution and the screen is too small for the whole window, so I can't use it with it, even though it seems to work fine.
- Saving plots for quick compare is a nice feature on the 3580A. Having a set of one, or four curves to compare would be useful for checking component changes or differences between circuits, instead of going with cursors and tables. Changing the color would help too, maybe something like in LTSpice with plain lines for gain and dashed lines for phase, and so on...

I have absolytely no knowledge in software dev, so I just hope those are not too time consuming to code ! Otherwise, sorry, I just hope that feedback helps 😁

Cheers and thanks once again !
Thank you very much for the feedback.

I am happy to hear that this still works on Windows XP. I had to end support for that a while back and haven't tested there in a while.

As a dialog based application, Fra4PicoScope normally scales pretty well. In a super high resolution environment, you may have to change your PC's "Scale and layout settings". But that's not the problem you're reporting. Perhaps you could send a screenshot to show me what it looks like? It may be possible for me to add some sort of scaling feature in the application too.

I like your idea for a sort of "persistence mode". It would be useful to visually compare the effects of changes to the circuit. I'll add that to a backlog of features.

Thank you,

Aaron.
TheKoala
Newbie
Posts: 0
Joined: Fri Aug 04, 2023 9:23 am

Re: Frequency Response Analyzer with Bode Plots

Post by TheKoala »

Thanks Aaron for your reply ! Glad to see that you still work on this nice app :D

The screen sizing issue has more to do with how small the screen resolution of my scope really is : 800x600! It's not much of an issue I will use it more with a regular computer.

About the persistence, that'd be nice indeed ! Being able to change the color of the curve and keep it saved to plot together with another measurement is a quick and efficient way of A/B testing filters or component changes.

Cheers !
Rodolphe
Post Reply