Author Topic: Automated wave capture for Siglent Scopes  (Read 1253 times)

0 Members and 1 Guest are viewing this topic.

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Automated wave capture for Siglent Scopes
« on: October 10, 2019, 01:11:02 am »
I made a GitHub repository explaining how to capture traces and show them as a diagram in Excel.

https://github.com/HendriXML/XMLScripts-Project-WaveCapture/wiki/Making-a-Excel-graph-step-by-step

Feel free to discuss whether this is of use (and what could be improved).

The script is tested with the normal acquisition mode and CH1..CH4. (It's also not intended for critical usage.)
« Last Edit: November 14, 2019, 09:42:41 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #1 on: October 10, 2019, 09:06:30 am »
Here's a link to the main script:
https://github.com/HendriXML/XMLScripts-Project-WaveCapture/blob/master/Script.Project/Capture%20traces.xml

It reads some parameters from a config section. That config section is then echoed back.

With more complex scripts this is handy to redo things. Using a more complex script supporting repeating tests its advisable to save the reports tabs. The tool can support many of them, making it easy to document things.

Normally I would also use the script to setup the scope, awg, psu, however this script is intended as an easy way to just capture the active traces and the screen.
« Last Edit: October 10, 2019, 12:06:48 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #2 on: October 10, 2019, 12:32:29 pm »
I was happy to read about Windows having a sandbox option nowadays. The tool can off course run in it, but it also needs the VISA drivers installed. (Only the bare minimum)

These can be found at:
https://www.ni.com/nl-nl/support/downloads/drivers/download/packaged.ni-visa.305862.html

The after installing the sandbox option in Windows the tool can be executed using the RunSandboxed.wsb config file I added to the root of the repository.

It's best to first edit it to set the right directories (they must exist) and then "run" it.

The tool will automatically start, but will give an missing component error when executing the script. Therefore before actually executing the script the VISA package must be installed. This won't take long, because it only needs a bare minimum (deselect all). But don't reboot at the end, this will close and wipe the sandbox session.

Using this approach the script could be executed completely sandboxed within 6 minutes. The directory locations in the sandbox are different (on desktop), so the script configuration should use those.

BTW, the virus report of the exe can be shown here:
https://www.virustotal.com/gui/file/98cd39bccb493cb1b5d553539cf20a3430facdf91e04adc1c8888dc92d6a6eec/detection
« Last Edit: October 10, 2019, 03:51:45 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #3 on: October 10, 2019, 04:56:48 pm »
Made a wikipage on running it in a sandbox:
Running-the-script-sandboxed

The Making-a-Excel-graph-step-by-step is updated as well.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 18111
  • Country: nz
  • Taupaki Technologies Ltd. NZ Siglent Distributor
    • Taupaki Technologies Ltd.
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #4 on: October 10, 2019, 09:39:48 pm »
What advantage/s does this offer over using SCPI commands from within the webserver command page to get .bin files that can be converted to .csv for dropping straight into Excel ?
There's a .bin to .csv utility available in the webserver to install on your PC and then convert the exported .bin files.

An outline of this .bin to .csv utility is in a video here:
https://siglentna.com/video/binary-to-csv-x-e/
Avid Rabid Hobbyist
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #5 on: October 10, 2019, 11:59:55 pm »
What advantage/s does this offer over using SCPI commands from within the webserver command page to get .bin files that can be converted to .csv for dropping straight into Excel ?
There's a .bin to .csv utility available in the webserver to install on your PC and then convert the exported .bin files.

An outline of this .bin to .csv utility is in a video here:
https://siglentna.com/video/binary-to-csv-x-e/
Good question!
One benefit of this script over the Siglent tool could be the file format. Its a bit how you use it.

The Siglent tool combines the value of parameters and the actual wave data in the same csv file. This can make it harder to choose a datatype for each column. Also the first records need to be skipped.

With the XML file format they're separated, and only the wave data is within a table. This is also a true Excel table, which gives benefits. The data can also easily be refreshed. The parameters of the waveform can be placed anywhere else.

Using scripts the capture is automated using filenames of choice. The scope can be setup, but also a signal generator or psu.

Also calculations can be done. Averaging multi frame acquisitions, resulting in higher bit depths are already supported and can be saved to another xml format. But why always use Excel to do the processing? For a lot of stuff it is not the right tool. Processing data using a script that can interact with the scope can be beneficial too.

Also scripts can be used to document things by writing a log. That can be handy when doing a lot of tests.

I think it's mostly a difference between automated and semi-automated. In some situations it makes all the difference, in some it doesn't.

Automating stuff comes with some investment, like learning the tool and the scripting language. I bring this tool forward to see whether it could have its (tiny) place in the e-community. It sure has its place in how I enjoy my hobby. This particular script is a way to find out whether it could be of use to owners of the same scope. The idea was initiated by someone asking when the Siglent tool would show the time (related) to the trigger moment. I then thought, the script should support that! And why not share it.


“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #6 on: October 11, 2019, 10:01:09 am »
I used the Siglent tool to do a quick comparison between the script. They are except for some very little rounding differences the same. As can be seen in the graph.
The Siglent tool seems to be limited at 100K samples.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #7 on: October 11, 2019, 10:56:24 am »
When I look at the CVS the Siglent tool produces, the channel values are formatted like:
-0.26000

A decimal resolution of 10u. Using the 500uV/div there's a 25 uV LSB / DAC resolution. So rounding errors could become relevant. But when using attenuations of lower than 1, it might become problematic.

Will test this sometime...

« Last Edit: October 11, 2019, 12:31:38 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline rf-loop

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: cn
  • Born with DLL21 in hand
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #8 on: October 11, 2019, 06:09:55 pm »
Using the 500uV/div there's a 25 uV LSB / DAC resolution.

Afaik, 500uV/div DAC nominal resolution is 20uV (step size is 20uV), not 25uV.

If practice and theory is not equal it tells that used application of theory is wrong or the theory itself is wrong.
-
Harmony OS
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #9 on: October 11, 2019, 06:25:13 pm »
Using the 500uV/div there's a 25 uV LSB / DAC resolution.

Afaik, 500uV/div DAC nominal resolution is 20uV (step size is 20uV), not 25uV.
You're right! Don't really have a calculator brain.. maybe that's why I like them scripts so much!
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #10 on: October 12, 2019, 11:33:24 pm »
I'm in the process of adding a extra script to the repository. This script takes the averages of a multi segment capture. It also allows saving the min and max value.
This corresponds to the averaging mode (but better, with increased resolution) and a multi cycle peak detect mode (normal peak detect mode is a way of displaying multiple samples in one point in time, Excel also seems to show both the lows an the highs the same way).

I however added noise to the waveform. Without noise there's only a little bit of increased resolution, because it then clearly shows the quantization done by the scope. The normal noise on the signal is not enough to elevate/descent the signal enough to reach higher or lower bit values.

The min max is due to the added noise not meaningful, but there's no harm in showing it.

With this technique (averaging with added noise), it is possible to see details that otherwise cannot be seen. Or show a normal sine in all its glory.

The bottom image is without averaging.
« Last Edit: October 14, 2019, 01:00:39 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #11 on: October 13, 2019, 12:35:48 am »
I added the new script. Using the following commands in the local repository should do the trick.
Code: [Select]
git pull origin
git submodule update --recursive
Starting with a new local repository is also an option.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #12 on: October 15, 2019, 08:32:32 pm »
Updated the scripts and tool, it now no longer uses the Visa COM wrappers, which had USB connection issues.

The added image shows how detailed the visualization of the signal can get. It also shows subtracting the average of the noise signal (ideally that should be 0V, but in practice it might have some spikes).

The signal is a sine with a superimposed sine with a 0.5% amplitude of the main one.
« Last Edit: October 15, 2019, 09:56:52 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #13 on: October 15, 2019, 10:00:10 pm »
When running the script checking verbose logging shows some extra processing details.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #14 on: October 22, 2019, 01:47:49 pm »
Uploaded a new version of the scripts.

Because the averaging script might take a while I added nested status updates so the progress can be followed.

There's also the possibility to monitor the SCPI commands in the VISA report by checking the debug mode checkbox.

https://github.com/HendriXML/XMLScripts-Project-WaveCapture/wiki/Making-a-Excel-graph-step-by-step
« Last Edit: October 22, 2019, 02:27:24 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent SDS1104X-E and SDS1204X-E DSO's
« Reply #15 on: November 10, 2019, 07:57:23 pm »
Updated the script a bit and upgraded the libraries it is based upon.

To be notified of future progress it's most handy to use GitHub "watch" functionality.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent Scopes
« Reply #16 on: November 14, 2019, 10:24:31 pm »
Updated the scripts to have them possibly run on more scopes.
The idea is to virtualize the devices more. About the same direction as the purpose of VISA classes: talking to different devices via the same programming interface. But now by implementing classes via SCPI calls.

This is doable because many scope models from Siglent share the same SCPI commands. Some with restrictions, some a bit different.

In this update the framework to implement differences and act on restrictions is implemented as a proof of concept. To actually implement more scopes I either need them on the bench, or need feedback from owners.

The main script initializes a scope object like this:
Code: [Select]
TSiglentScope.MatchingClass(ScopeSession).Create(ScopeSession)
This is implemented in "VISA Siglent Scopes.xml" as this:
Code: [Select]
<Choose>
  <When Expression="Manufacturer = 'Siglent Technologies'">
    <Choose>
      <When Expression="Model='SDS1204X-E'">
        <Execute Statement="Result:= TSiglentSDS1204XE"/>
      </When>
      <When Expression="Model='SDS1104X-E'">
        <Execute Statement="Result:= TSiglentSDS1104XE"/>
      </When>
      <When Expression="Model='SDS1202X-E'">
        <Execute Statement="Result:= TSiglentSDS1202XE"/>
      </When>
      <When Expression="Model='SDS1102X-E'">
        <Execute Statement="Result:= TSiglentSDS1102XE"/>
      </When>
      <Otherwise>
        <Raise Expression="Exception.Create(sErrorUnknownScope + Model)"/>
      </Otherwise>
    </Choose>
  </When>
  <Otherwise>
    <Raise Expression="Exception.Create(sErrorUnknownScope + Manufacturer + ' ' + Model)"/>
  </Otherwise>
</Choose>
Which reads the manufacturer and model via the SCPI IDN Query. Using that data a specialized class for this scope is returned. For now the models are thus limited.
Also the differences in implementations within such a class is limited. More advanced implementations would -for example- raise exceptions on all the stuff that's not supported by a certain model.

On GitHub device requests/issues can be added.
https://github.com/HendriXML/XMLScripts-Common-VISA/issues

What I offer is to catch some low hanging fruit, but others are of course free to join the exercise.
« Last Edit: November 14, 2019, 11:31:37 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent Scopes
« Reply #17 on: January 20, 2020, 02:17:21 pm »
Another thread got me interested in filtering a multisegment acquisition on a certain criteria, in this case a rising or falling slope which is out of specs.
I tested the script using 2 combined AWG channels, each generating a pulse.
The second channel pulses are slow rising/falling, delayed a bit and 5 Hz instead of 500 Hz. (Thus "rare")

The script saves only the screen shots and data files of those segments who violate the max rise/fall times.

The following configuration can be set:
Code: [Select]
[DigitalSignal]
VoltageLow=0 V
VoltageHigh=5 V
MaxRiseTime=50 ns
MaxFallTime=50 ns
The rise and fall times are determined between the low/high crossings:
VoltageLow + (VoltageHigh - VoltageLow) * 0.1
and
VoltageHigh - (VoltageHigh - VoltageLow) * 0.1

The script needs to be run after a stopped multi segment acquisition with history off or the last segment activated.

I'll put the updated scripts on GitHub, but that might take some time.
« Last Edit: January 20, 2020, 11:49:09 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 
The following users thanked this post: rf-loop, tautech

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 718
  • Country: nl
    • KiCad-BOM-reporter
Re: Automated wave capture for Siglent Scopes
« Reply #18 on: January 20, 2020, 03:39:47 pm »
« Last Edit: January 21, 2020, 02:53:37 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf