Rigol DS1000z CSV to LTspice & WFM Viewer 1.0.0 parser - Page 1
Forum section: electronics / projects

author: Warhawk
author_rank: Frequent Contributor
timestamp: May 13, 2015, 02:36:33 pm
content: Dear colleagues,I've been fiddling with an analog signal processing recently and I needed to import data from DS1074z scope to LTSpice (or similar application) and play with them then.There are some apps or python scripts but mainly for the older 1052 series and none of them satisfied my needs. Thus I created my own minimalistic (~6 kB) utility in pure C.Warning:The source code may cause nausea or seizure..Please take into account that I am not a SW or FW developer. I just use C for my hobby embedded projects.Description:The utility takes CSV data from Rigol DS1000z series scope, recognizes a header and creates a *.txt file with PWL data for every available channel. It has been tested in Windows 7 and 8.1 x64. The utility also handles even very large CSV files. Conversion of 20 MB CSV takes couple seconds.License:Code is available for everyone under "I don't care" license. I would be glad if someone considered the utility as useful.Usage:Simplest way is to copy rigol.exe to the same folder as your CSV data, open a cmd line and execute "rigol.exe mydata.csv". The utility then creates ch1_out.txt, ch2_out.txt etc. Then you can import a text file to LTspice :http://www.linear.com/solutions/1814You can use "-kt" parameter which sets time "0" to the trigger point.Modifications:I believe that the code is simple and easy to understand for everyone who is familiar with ANSI C. For modifications you just need a notepad and TCC (Tiny C Compiler) from:http://bellard.org/tcc/. You don't need any special tools or libraries. Everything is included in that 400 kB archive and without any installation...To get started, just put "rigol.c" into TCC folder, open a cmd line and put there "tcc.exe rigol.c". Then you find rigol.exe in the same folder.Known bugs:(this list will probably grow...)When the scope saves data from the "memory" (not from the screen), the increment value is not right and has to be changed manually (Rigol's BUG ?). You must edit CSV file manually and put there sampling rate^-1All input/comments/suggestions/bug reports welcomed.Jiri*source code added

author: moffy
author_rank: Super Contributor
timestamp: May 14, 2015, 12:44:40 am
content: Very cool! Thanks for making your work available.

author: Warhawk
author_rank: Frequent Contributor
timestamp: May 14, 2015, 11:18:05 am
content: Thanks for your replymoffy.Today I found a way how to import data to popular WFM reader fromhttp://meteleskublesku.cz/wfm_view/I am in touch with the author but however He does not have a time to make the ds1000z support. I understand that of course. Reverse engineering of the header is very tedious. I think some folks here on forum tried to do that but with partial success only. Honestly I don't fully understand why to care about wfm format when we have CSV instead.At the moment I use matlab* to convert the CSV data to WAV. Right after I check the proper functionality I willtryto update the utility to support WAV export as well. There are some open source codes in C for that.If you want to try it, just remove the Rigol's CSV header and"importdata('towav.csv')" and "wavwrite(ans,500e6,32,'out.wav')" do the trick.*It seems that scilab can do it too.

author: Karel
author_rank: Super Contributor
timestamp: July 07, 2015, 05:16:36 pm
content: Interesting.So far, I have been using EDFbrowser to inspect waveforms downloaded from Rigol oscilloscopes:http://www.teuniz.net/edfbrowser/This way I don't need to do any conversion of file formats.

author: Warhawk
author_rank: Frequent Contributor
timestamp: July 08, 2015, 07:36:05 am
content: Quote from: Karel on July 07, 2015, 05:16:36 pmNice software you linked, Karel ! I will check it out. What type of files it accepts ? On the web I see nothing regarding rigol binary data or even CSV ?

author: Karel
author_rank: Super Contributor
timestamp: July 08, 2015, 10:09:54 am
content: It doesn't accept the waveform files from Rigol scopes.Instead, I'm using this software that saves the waveform data from the scope (via LAN or USB) in EDF format that can be read immediately without the need for any conversion:http://www.teuniz.net/DSRemote/Otherwise, you can use CSV files but EDFbrowser will convert them to EDF anyway.Have a look at the manual here for the conversion from CSV to EDF:http://www.teuniz.net/edfbrowser/EDFbrowser%20manual.html#ASCII_to_EDF_converterEDF files can also be read or imported in Scilab, Octave, Matlab, etc.

author: Warhawk
author_rank: Frequent Contributor
timestamp: July 08, 2015, 02:17:02 pm
content: Quote from: Karel on July 08, 2015, 10:09:54 amThanks for clarifying that. Does DSremote allow to download whole acquisition memory (up to 24 Megsamples) or just the screen memory ?Anyway, that EDF browser is a wonderful SW. I wish I had found it earlier.

author: Karel
author_rank: Super Contributor
timestamp: July 08, 2015, 05:00:29 pm
content: Quote from: Warhawk on July 08, 2015, 02:17:02 pmThere are three choices. When you click on the save button, it will show you a dropdown list to select screenshot, screen waveform data or deep memory waveform data up to the maximum (24Mp for the DS1054Z).The last option depends on the mem depth setting in the acquire menu.

author: icpart
author_rank: Regular Contributor
timestamp: January 01, 2016, 04:39:36 pm
content: Hi Warhawk.Today I tried to convert csv from my new 1054Z scope to LTtspice but it doesn't work. I received only message from program for Unsupported header.I exported CSV file via Ultrascope PC program. Also firmware of my scope is 00.04.03.PS.Guys do you know is there any detailed explanation of Rigol CSV waveform format, because I don't know what means separated values in file?I want to try to makes some chart with waveform in Excel.

author: Warhawk
author_rank: Frequent Contributor
timestamp: January 01, 2016, 04:45:57 pm
content: Quote from: icpart on January 01, 2016, 04:39:36 pmHi, could you please post here the CSV file you have ? I will have a look at itThe file description is very easy. Look at the picture.

author: icpart
author_rank: Regular Contributor
timestamp: January 03, 2016, 06:16:05 pm
content: Quote from: Warhawk on January 01, 2016, 04:45:57 pmThanks for help. It was my mistake. I realized later that your converter is for CSV files saved from oscilloscope and not for CSV files exported from Rigol Ultrascope PC soft. Also after I looking in depth from your example files from first post I realized the data format of that CSV.Btw more interesting is CSV format exported from Ultrascope software. It is little confusing.

author: marth
author_rank: Newbie
timestamp: December 03, 2016, 02:49:03 pm
content: Hi Warhawk.Data transmission in LTspice - very interesting. I have a model of 1054z. It seems there different header format. Here is an example. The file received from the oscilloscope.X,CH1,Start,Increment,Sequence,Volt,-3.000000e-03,5.000000e-060,-1.80e-02,1,-1.80e-02,2,-1.84e-02,3,-1.84e-02,Perhaps to make the program option for the 1054z model?

author: marth
author_rank: Newbie
timestamp: December 10, 2016, 03:43:09 pm
content: author closed the development of this program?

author: marth
author_rank: Newbie
timestamp: December 10, 2016, 04:17:28 pm
content: Converting to LTSpice format interesting features wide mathematical analysis and the possibility of combining several measurements. It is also interesting to combine with the simulation results.p.s. Sorry for my english. I use an electronic translator.

author: TinkeringSteve
author_rank: Frequent Contributor
timestamp: December 11, 2016, 12:31:47 am
content: Indeed, CSV is awfully wasteful and takes a lot more time than I have to save.I wonder why Rigol doesn't publish the specs of the files... I was under the impression that "secret file formats" and such have somewhat fallen out of vogue...Oh wait, somebody could make their product more useful, we can't have that ^^

author: Karel
author_rank: Super Contributor
timestamp: December 11, 2016, 08:49:57 am
content: Quote from: TinkeringSteve on December 11, 2016, 12:31:47 amHave you asked Rigol support? If yes, what did they say? If not, why didn't you?Why bother with their file format if there's a free to download programming guide that describes how to downloadthe waveform data? Writing a program that saves that data in a format of your preference isn't exactly rocket science.And if you are not able to write it yourself, grab one from the internet and use that. There are free & opensourceprograms that do that for you and you'll be able to analyze your data in Octave, Scilab and matlab.

author: TinkeringSteve
author_rank: Frequent Contributor
timestamp: December 11, 2016, 11:33:21 am
content: Quote from: Karel on December 11, 2016, 08:49:57 amI searched for the format, did not ask support as this doesn't seem like a support issue. If they wanna publish it, they do. Might try, though.Not sure what you're talking about after that. Are you saying there is a guide which describes how to open a connection e.g. via sockets or in some way using USB and talk to the Rigol to get the data?I was not aware of that, I had assumed that the connections only works with vendor provided software.This is my second scope, before that, I had one of the older, crappier china scopes.For stationary use here that would be awesome, of course.Anyway - that thing has a USB port that lets you save wfm data for a reason... It would be a convenient enough way to record the data, if one was able to actually read it. Well I can see the wave data allright, but it is not very useful without the information from the header. I can use the scope + USBstick everywhere, whereas a LAN cable is not everywhere, and carrying more stuff is always bad ;-)So even if I get the direct data connection working, I'd still like the header format.

author: Karel
author_rank: Super Contributor
timestamp: December 11, 2016, 11:42:50 am
content: Quote from: TinkeringSteve on December 11, 2016, 11:33:21 amHere's the programming guide:http://beyondmeasure.rigoltech.com/acton/attachment/1579/f-0386/1/-/-/-/-/DS1000Z_Programming%20Guide_EN.pdfHere's an example of a tool that let you download all the waveform data in a format that can be opened in lot's of other software,and it doesn't require Rigol software or drivers:http://www.teuniz.net/DSRemote/

author: TinkeringSteve
author_rank: Frequent Contributor
timestamp: December 11, 2016, 11:52:00 am
content: Ah, thanks!

author: dpenev
author_rank: Regular Contributor
timestamp: November 13, 2017, 05:23:14 pm
content: Hi,I have tested DSRemote for my Rigol DS2102 but I got Unknown device ID message.I am not sure if the author reads here but if he does probably he can advice?Thanks.

author: Karel
author_rank: Super Contributor
timestamp: November 13, 2017, 06:14:55 pm
content: Quote from: dpenev on November 13, 2017, 05:23:14 pmYou can open an "issue" here:https://github.com/Teuniz/DSRemote/issues

author: silelis
author_rank: Newbie
timestamp: December 17, 2018, 08:59:31 am
content: @WarhawkI am trying to use Your tool but do not understand this bug description correctly. Can You explain it more like "for dummies". PLS.Quote from: Warhawk on May 13, 2015, 02:36:33 pmI am making CSV form memory (I think it is more accurate) and my parameters are like bellow on RIGOL screen screeshot, CSV screenshot.Unfortunately LT Spice gives me error. I suppose that it is because I do not know how to change this "sampling rate^-1". PLS HELP me.

author: Warhawk
author_rank: Frequent Contributor
timestamp: January 04, 2019, 08:59:26 am
content: Hi, I am sorry it took me so long to reply.Could you please share your original file? I did not use the tool for a while so I need to find out how it works againad. Sampling rate^-1- This practically means conversion to sampling period (1/Sampling Rate). Your CSV seems to be right. Either rigol has already fixed the problem or you did the modification correctly. Your sampling rate is 1GS which means 1ns increments.Hmmm, I also see that your CSV now has some increments (1,2,3,4,5 etc.)Which firmware do you use?

author: silelis
author_rank: Newbie
timestamp: January 14, 2019, 09:41:37 am
content: My firmware is: 00.04.04.SP3.Here is the begging of "STP" file with settings:QuoteStrange because I am using DS1052Z not DS1104Z.The thing I see is that my Rigol with this firmware adds additional column in CSV (named "X", which is sequence)CSVs at this moment I am removing this additional column with CSVed.exe.If You don't have this firmware in Your Rigol You can answer me on PM and We can work together on update.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 08, 2023, 10:37:42 am
content: Quote from: silelis on January 14, 2019, 09:41:37 amsorry it takes 4 years to reply... and also sorry to resurrect old dead thread... a signature directed me to this... anyway... its pointless to save full memory data into CSV format in pendrive from DS1000Z series scope, it will take ages. a more practical way is to save in wfm format, or just download raw data to PC as Karel mentioned 7 years ago... both can be done withVisaDSO (Windows users only)and now it supports DHO800/900/1K/4K.. with these newer android OS Rigol scopes, saving to pendrive in CSV format now practical again since it only takes seconds to complete, even at full memory 25-50Meg points. VisaDSO also updated to read newer CSV format (tested on DHO800/900 FW), and hence with newer DHO series, there is not much point in rev eng their even newer wfm format (or even the glorified from long ago a well known BIN format) anymore, fwiw.

author: Warhawk
author_rank: Frequent Contributor
timestamp: November 08, 2023, 12:03:55 pm
content: Thanks for sharing. I don't expect any new development here. I do not have the ds1074z anymore and looking more into QSPICE now.