Siglent SDM3055 multimeter, SCPI commands and Python - Page 1
Forum section: electronics / testgear

author: Gunders
author_rank: Newbie
timestamp: July 27, 2015, 08:41:51 am
content: HiI’m playing around with The Siglent SDM3055 multimeter, SCPI commands and Python. I have found some minor issues which would be nice to figure out, any help will be appreciated. I have attached the SDM3055 manual.First of all; I’m using Python 3.4.2 and have installed the PyVISA module (https://pyvisa.readthedocs.org/en/master/) and NI VISA.My basic script is really simple:Send *IDN? to check whether I have contact with the instrument.Send *RST to reset the instrument to factory settingsSend MEAS:VOLT:AC? to read AC voltageHere are my issues so far:My first problem is that the *RST cmd don’t reset the instrument, there is no response. I have tried *RST on my Tektronix DMM4050 multimeter and it works as expected, the instrument is reset back to factory state.When I run my script the instrument is set in remote mode, that’s fine. But when my script is finished and I have closed the connection to the instrument it is still in remote mode. I haven’t found any commands to get it back into local mode. The only way to get it back into local mode is to push the blue shift/local button at the front panel.Code:import visaimport timecurrent_measurement = 1number_of_measurements = 5print('VISA resources: ')rm = visa.ResourceManager()print(rm.list_resources())siglent = rm.open_resource('USB0::0xF4EC::0xEE38::SDM305C2150105::INSTR', write_termination='\n', query_delay=0.25)#insert the correct VISA resourceprint(siglent.query('*IDN?'))siglent.write('*RST') #RST function won't work, CLS won't work eithertime.sleep(2)while current_measurement <= number_of_measurements:value = siglent.query('MEAS:VOLT:AC?')print(value)time.sleep(1)current_measurement += 1siglent.close()

author: tautech
author_rank: Super Contributor
timestamp: July 27, 2015, 01:13:27 pm
content: Welcome to the forum.I'm sorry code is not one of my strengths so I'll point Siglent tech support to your thread for assistance.

author: Gunders
author_rank: Newbie
timestamp: July 28, 2015, 06:13:50 am
content: Here are a couple of new findings:In remote mode the meter doesn’t do any measurements unless you ask for it. So the value shown at the display will be the last reading you read from the meter. I see this as a weakness compared to my Tektronix DMM4050 and BK 5491B multimeters, these meters can continue to do measurements even though I don’t ask for any readings. They continue to function as “normal” multimeters even in remote mode. I haven’t yet found any way to setup/program the Siglent to behave the same way. The problem with the way Siglent does it is that it can take a long time before I get any feedback regarding my current or voltage. For my measurement setups it is quite common to do a measurement every minute and save the data to a CSV-file. If something goes wrong with my circuit I won’t get any feedback until my next reading from the multimeter(unless I can smell it or see smoke). If my sample rate is once a minute it will take maximum 1 minute until the next time I get any feedback and can do any action to save my circuit. The easy way for me right now will be to ask for readings more often and only save data each minute.A more severe issue is that the multimeter does a complete restart every now and then. When I use and setup the meter to log every minute for 2-3 days I must trust that the meter operates without restarting. My Python script also fails if the meter restarts. I’m a Python newbie so I haven’t found any good way to solve this in my code.

author: pascal_sweden
author_rank: Super Contributor
timestamp: July 28, 2015, 03:19:18 pm
content: Just a side question to another Norwegian fellowWhere do you buy your new test equipment in Norway?I have used Batronix before, and know about Instrumentcenter in Sweden. Used to live in Sweden.

author: Gunders
author_rank: Newbie
timestamp: July 29, 2015, 11:04:35 am
content: Hi Pascal,it depends on what kind of test equipment. The easiest is to buy from Farnell. Nortelco,http://www.nortelcoelectronics.no/, is also quite big and have good support. For Rigol we have used Venotek,http://www.venotek.no. Our Siglent multimeters come from Batronix.

author: eas
author_rank: Frequent Contributor
timestamp: July 29, 2015, 05:54:13 pm
content: For handling the instrument restart, make use of the Python exception handling with atry/except block. Note the exception generated when the DMM resets and your script fails, then catch that specific exception type in the except. That way you won't eat other exceptions that you'd probably rather see. Or, you could use the quick-and-dirty solution I used the other night -- invoke the script from the command line in an endless loop, with a sleep statement to give the DMM time to restart. If you are using Linux or OSX with the bash shell, you can do something like this:Code:while true; do python scriptpy.py; sleep 150; doneAs to the issue with the update rate of the front display. I took a look at the programming doc, but couldn't figure out the solution from my cursory glance, but, I think you probably want to focus on the triggering setup and look at how to trigger continuously, and you probably want to use either a FETCH or READ to get the latest data, after setting up the measurement mode, rather than calling MEAS every time.Finally, I'd suggest working to the point where script explicitly configures all critical configuration state, rather than relying on the instrument's defaults, or its current state.

author: Gunders
author_rank: Newbie
timestamp: August 17, 2015, 09:24:38 am
content: HiI have now spent some time trying to program the multimeter and have attached a code that seems to work well as long as the multimeter doesn't do a random restart. The code asks for voltage measurement at regular intervals and writes the voltage to a CSV-file together with a timestamp. You have to change the file extension from txt to py in order to run the script.Unfortunately, I'm not very experienced when it comes to Python programming so I haven't included any try/excpetion statements. @Eas is also right when he writes that I shouldn't rely on the instruments defaults but MEAS:VOLT:AC? was the simplest way to get a reading from the instrument and it was a good start. The script attached is a bit more sophisticated.Regarding the *RST command I got an e-mail from Siglent in Europe where they confirm that there's no response to the *RST command.I hope some of you will find the script useful

author: noisefreak
author_rank: Newbie
timestamp: September 09, 2018, 12:45:12 pm
content: Hi,I wrote an article about that issue:http://www.zeilhofer.co.at/wiki/doku.php?id=siglent_sdm3065xI know, this is an older topic, but it costed me a major time to solve the problem of getting current measurements in an adequate time.My solution solves also the issue with updating the display when remotly controlled.Quote from: eas on July 29, 2015, 05:54:13 pmI hope this will help out many users of the Siglent DMM, which basically is a very good DMM, IMHO.Greets, Karl

author: tautech
author_rank: Super Contributor
timestamp: September 09, 2018, 12:58:27 pm
content: Thanks for the 'heads up' on the error in the programming manual.I'll pass this on to Siglent for an update/correction to their documentation.

author: ScottW
author_rank: Contributor
timestamp: August 16, 2021, 06:44:26 pm
content: Old topic, but this is a direct follow-up to the information posted above so this seems like the best place for it.The article Karl (@noisefreak) wrote and linked above was really helpful to me in two ways: (1) Demonstrating how to setup continuous, fast triggering and get individual readings when desired, and (2) Pointing out that the "R? 1" command actually returned the "most recent" or "last taken" measurement, despite the documentation (incorrectly) saying it would return the "oldest" measurement from the buffer.I wrote code based on Karl's information, and it worked great with firmware 3.01.01.06R2 on my 3065X. But things fell apart when I recently updated to firmware 3.01.01.10 (2021-JUL)!Apparently Siglent "fixed" the "R?" command to work per the documentation. It now returns the "oldest" value(s) first, as the documentation states. Unfortunately, that means the technique that previously worked -- using "R? 1" to get the latest measurement -- instead returns an OLD measurement.I found a pretty simple fix. Instead of using "R? 1" to read a value, use the "DATA:LAST?" command. This will return the last (most current) measurement, as "R? 1" used to do in the old firmware. And "DATA:LAST?" can be used to get the most recent measurement regardless of firmware version (i.e., it works the same in old and new firmware).One complication of replacing "R? 1" with "DATA:LAST?" is that the return format is different. Since "R?" can return multiple values, it's return string is prefixed with some digits to indicate the length, so that had to be interpreted and stripped to isolate the actual value returned. The "DATA:LAST?" only returns a single value, so there is no length prefix -- but it is suffixed with " VDC", " VAC", etc., so the suffix has to be stripped before attempting numeric conversion.