hb020 / sds1004x_bode

Bode plot with Siglent SDS1000X-E/SDS800X-HD/SDS1000X-HD oscilloscopes and a non-siglent AWG.
MIT License
4 stars 4 forks source link

Siglent SDS1000X-E/SDS800X-HD/SDS1000X-HD series Bode Plot

Bode plot with Siglent oscilloscopes (SDS1000X-E, SDS800X-HD, SDS1000X-HD, and probably others) and a non-siglent AWG.

Can also be used as a regular VXI-11 front-end for the supported AWGs, without the Siglent scope.

Use cases

Overview

At a certain point after getting the SDS1204X-E oscilloscope I started to wonder if it might be possible to use the Bode plot function with a non-Siglent waveform generator. After some hours of researching and reverse engineering I wrote this Python program which is a small server which emulates Siglent arbitrary waveform generator.

The oscilloscope connects using LAN to a PC running this program. The program makes the oscilloscope think that it communicates with a genuine Siglent signal generator. The program extracts the commands sent to the generator, parses them and translates to the command set, which can be understood by the connected to the PC non-Siglent generator.

This tool can also be used to control the supported AWGs via other VISA tools, independently of a Siglent scope. It supports discovery over the network.

The current version of the program was tested under Linux and MacOS only. It will likely work under Windows too, with an up to date python version.

Supported AWG Models

As of September 2024 the program supports the following models:

Oscilloscope Configuration

Before starting the program you have to tell the oscilloscope how to connect to the waveform generator. Connect your oscilloscope to the same network where your PC is connected. Then go to Configure => AWG I/O in the Bode plot settings. Define LAN connection and the IP addres of your PC as the AWG IP. Please keep Amplitude Unit to Vpp. This program does not (yet) support other units.

When you start the program, it will automatically test the communication between the PC and the AWG, and start the AWG server on the PC. Once the program is up and running, you can press the Test Connection button on the oscilloscope to test the communication between the oscilloscope and the PC.

Requirements

To run this program you must have Python 3.8+ installed. Python 2.7 is not supported anymore.

You will need the following pip packages:

If you have an old python version, you may also need to upgrade the typing_extensions version (as required by PyVISA-py).

Running The Program

The source code is located in the sds1004x_bode directory of this repository.

Under Linux, Python sockets requires elevated privileges, therefore the program has to be run with su or sudo, or better, allow python access with a command like sudo setcap 'CAP_NET_BIND_SERVICE+ep' /bin/python3.10 (to be adapted to your situation). On MacOS and Windows you likely will not need all this.

The program must be run in a command line terminal. The file to be run is bode.py. In order to run it, change the current path to the directory where you downloaded the source code. Then write the following command:

python bode.py <awg_name> [<port>] [<baud_rate>] [-h] [-v[v[v]]]

where

The dummy generator was added for running this program without connecting a signal generator. The program will emulate a Siglent AWG and the oscilloscope will generate a Bode plot but no commands will be sent to the AWG.

Use -h for help text.

Use -v or -vv or -vvv for logging verbosity. The first logs the driver info, the next also logs VXI-11 info, the last also logs port mapper info. By default, only the startup phase and the incoming commands are logged.

If the program starts successfully, and with -vvv, you'll see the following output:

Initializing AWG...
AWG: jds6600
Port: /dev/ttyUSB0
IDN: jds6600
AWG initialized.
Starting AWG server...
Portmapper: Listening to UDP and TCP ports on 0.0.0.0:111
VXI-11: Listening to TCP port 0.0.0.0:9010

After starting the program, follow the usual procedure of creating Bode plot. After starting the plotting, the program output will be similar to the following (when using -vvv):

UDPPortmapper: Incoming connection from 192.168.14.27:55916.
UDPPortmapper: Sending to TCP port 9009
VXI-11 CREATE_LINK, SCPI command: inst0
VXI-11 DEVICE_WRITE, SCPI command: IDN-SGLT-PRI?
VXI-11 DEVICE_READ, SCPI command: None
VXI-11 DESTROY_LINK, SCPI command: None
VXI-11 moving to TCP port 9010
UDPPortmapper: Incoming connection from 192.168.14.27:48446.
UDPPortmapper: Sending to TCP port 9010
VXI-11 CREATE_LINK, SCPI command: inst0
VXI-11 DEVICE_WRITE, SCPI command: C1:OUTP LOAD,50;BSWV WVTP,SINE,PHSE,0,FRQ,15000,AMP,2,OFST,0;OUTP ON
> C1:OUTP LOAD,50;BSWV WVTP,SINE,PHSE,0,FRQ,15000,AMP,2,OFST,0;OUTP ON
VXI-11 DESTROY_LINK, SCPI command: None
VXI-11 moving to TCP port 9009
UDPPortmapper: Incoming connection from 192.168.14.27:50264.
UDPPortmapper: Sending to TCP port 9009
VXI-11 CREATE_LINK, SCPI command: inst0
VXI-11 DEVICE_WRITE, SCPI command: C1:BSWV?
> C1:BSWV?
VXI-11 DEVICE_READ, SCPI command: None
VXI-11 DESTROY_LINK, SCPI command: None
VXI-11 moving to TCP port 9010
UDPPortmapper: Incoming connection from 192.168.14.27:55976.
UDPPortmapper: Sending to TCP port 9010
VXI-11 CREATE_LINK, SCPI command: inst0
VXI-11 DEVICE_WRITE, SCPI command: C1:BSWV FRQ,10
> C1:BSWV FRQ,10
VXI-11 DESTROY_LINK, SCPI command: None
VXI-11 moving to TCP port 9009
UDPPortmapper: Incoming connection from 192.168.14.27:48088.
UDPPortmapper: Sending to TCP port 9009
VXI-11 CREATE_LINK, SCPI command: inst0
VXI-11 DEVICE_WRITE, SCPI command: C1:BSWV FRQ,20
> C1:BSWV FRQ,20
VXI-11 DESTROY_LINK, SCPI command: None
VXI-11 moving to TCP port 9010

When done, you can stop the process via Ctrl-C.

Some possible errors

If you get an error message with Address already in use. Cannot use ... for listening., use netstat or lsof to look what process is already using the port. It might be because you have nfs.server running via rpcbind. For that case, just disable it while running the bode plot: sudo systemctl stop rpcbind.socket rpcbind.service.

SCPI compatible AWGs

Many different SCPI dialects exist. If you have an AWG that is not listed but is SCPI compatible, you may try one of the existing SCPI drivers (dg800 or utg1000x). If you want to do a quick test, adapt awg_tests.py to your device and address, it will test all commands. If your device does not talk one of the existing dialects, you can create a new one easily by using one of the existing drivers as example. Please tell us if you have done so (via github Issue or Pull request), so that we can add the device to the list.

Using independently from the scope, via VISA

This is possible, but you should set a large timeout on your Instrument or when using open_resource() when using serial AWGs. See the example in testSCPI.py

Changelog

2024-09-19

2024-09-06

2024-08-25

2024-06-27

2024-05-01

2023-11-13

2019-01-30

2018-07-18

Follow-up Projects

Contributing

I'd like to add here more AWGs but it's impossible to have them all at the home lab. If you'd like to write a driver for an AWG which isn't listed here, please contact me.

Authors

Links

  1. Siglent SDS1104X-E and SDS1204X-E: Bode plot with non-Siglent AWG on EEVblog Forum.
  2. Running the script with SDS1204X-E and JDS6600 AWG on YouTube (best viewed in 1080p quality).

Questions? Suggestions?

You are more than welcome to contact me with any questions, suggestions or propositions regarding this project. You can:

  1. Visit my QRZ.COM page
  2. Visit my Facebook profile
  3. :email: Write me an email to iosaaris =at= gmail dot com

How to Support or Say Thanks

If you like this project, or found here some useful information and want to say thanks, or encourage me to do more, you can buy me a coffee!

ko-fi

"Buy Me A Coffee"

You can aslo make a donation with PayPal:

"Donate with PayPal"


73 de 4X1MD