For one of my recent projects, I needed to automatically fetch oscilloscope samples to PC for automatic analysis. I own the Owon SDS7102V oscilloscope so the first step was to find how to get data from it.
The oscilloscope supports USB and ethernet connectivity (non-V versions probably also RS232, but mine has VGA connector instead).
According to the documentation, the Owon SDS7102 should support SCPI commands, but the one I own didn’t respond to any of them (including the SCPI activation command). It either doesn’t support SCPI at all or the FW on my scope is simply too old. At the time I checked, the link to the firmware update for my oscilloscope on the Owon site was dead :S
Also in the SCPI manual, there are no commands for reading / downloading data and no commands for triggering. There is another command manual which outlines the Owon proprietary commands for fetching data and the return data format. Owon proprietary commands for setting up the oscilloscope don’t seem to be documented, but the source code of the two applications I will mention later is pretty self-explanatory.
Next to the official Owon PC application, there are at least two published applications for controlling Owon oscilloscope. owon-dump can be used to fetch data and parse it. owoncontrol is used to send commands to the oscilloscope and to change the parameters. Both are open source and seem to be more oriented towards the linux society, with no binary files available, also both are using the USB interface.
I decided it was simpler for me to translate the owon-dump to python and change the interface to TCP than to try to port the programs and compile them under windows.
Owon scope needs to have a manually assigned IP to be able to accept TCP connection from PC (you have to configure it on the oscilloscope). I used a MikroTik Hap Lite as a wireless client to make my oscilloscope WiFi enabled 🙂
The “dump” commands (STARTBMP, STARTBIN, STARTMEMDEPTH) are pretty simple and I had them running quickly. The only thing that can go wrong here is setting the delays/timeouts for the data reception (the scope does take its time when you request a data snapshot).
Here is a simple script that worked for me:
import socket, time, errno, ctypes, struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "Open socket"
# set IP and socket to your oscilloscope
print "Send command"
chunk_size = 1024 * 16
rcvd_data = 0
full_data = ''
timeout = 0
print "Read data ",
if(rcvd_data == 0):
timeout = timeout + 1
timeout = 0
data_chunk = s.recv(chunk_size)
rcvd_data = len(data_chunk)
full_data += data_chunk
except socket.error, e:
if e.args == errno.EWOULDBLOCK:
rcvd_data = 0
print "Close socket"
print "Write file"
with open("Output.bin", "wb") as text_file:
The next step was to decode the BIN file and produce some processable data. This involved translating owon-parse to python which took a bit more effort, mainly because of data casting (hint: see struct.unpack).
And now I have some meaningful data I can feed to my processing algorithms 🙂
That’s just how bad an uncompensated probe looks on the square calibration signal 😉 If you look carefully you will notice it’s the same signals as in the first image on the scope.