JYE DSO 150 -(DSO Shell) Oscilloscope

Modifications

The DSO Shell (DSO150) scope is a very inexpensive oscilloscope, with plenty of features

Adding a USB <> TTL or Bluetooth TTL (Just make sure they are 3.3 logic level!) is trivial and should leave enough room for internal lipo and charge board and 9v boost board

Once you have flashed the frmware to a level above 110 it adds a feature to be able to download data from the unit by pressing V/DIV and ADJ buttons at the same time whilst it is booted up and ready
You can check this is working by pressing the buttons (I find that holding down V/DIV and tapping ADJ works best for me) and the screen will show it is sending data at the lower left of its screen

Using the data for something meaningful

If you open a terminal and open it up and press the V/DIV and ADJ you will see the data fly down the screen

You could at this point save this data and fiddle with it and use it to plot a graph using gnuplot (excelent and free) or Excel

I decided to rapidly learn Python to be able to automate this process and using

http://www.rudiswiki.de/wiki9/JyeTechDSO150#Waveform_Visualization

as inspiration I managed to achieve what I set out to do

DSO Shell Grabber

Current Version 1.7.4

Written using Python and converted into a Windows executable using PY2EXE

It has been tested and runs on Windows XP (SP3) to Windows 10
(I assume it should work on all flavours in between)

Features

  • Will detect available com ports and ask you to select which one you want it to use
  • It will write the settings to a file (comport.ini) so it won't have to bug you again
  • (IF you need to change the com port (or if you made a typo) just delete the comport.ini before opening the app and it will ask again or open and edit the comport.ini file and save it before opening the program)
  • It will only create a single debug file - it will get overwritten each run of the program
  • It will wait forever till you hit V/DIV and ADJ buttons on the DSO Shell to start sending the data
  • (you should see the DSO Shell say that it is sending data in the lower left corner of its screen) - requires v110 or newer firmware

  • It will grab the data and save it to all_data.txt - again it will get overwritten each run of the program
  • It will create a header.txt file - this shows the settings the scope was set to at the time of capture - it will get overwritten each run

  • The data from the above grabs gets formatted into a date and timestamped file
    (eg gnuplot 21-01-2018 16-52-23.txt) and a corresponding gnuplot file (eg dso150gnuplot 21-01-2018 16-52-23.plt)
    These get created every run with a new date and timestamp - so the folder may get busy! (but you can refer back to and re-plot them later)

  • It will then attempt to open gnuplot and stay open asking if you want to run it again

  • (If you have gnuplot installed it should open the graph
    If you do not have gnuplot installed - it will still create the files - which can be opened on a device with gnuplot installed)

  • If you want to run it again and take another plot , just hit enter
    If you want to quit press q and hit enter

  • Any questions or requests - give me a shout

    Download

    This software is provided for free - all I ask is for feedback and for it not be be copied, sold or distributed without first asking me

    DOWNLOAD DSO_Shell_grabber_V1.7.4.zip (Latest Version)

    Downloaded - 89 Times

    Older versions are availibale by emailing me - but compared to this version they were not that great - this is the only version I would deem fit for purpose :)

    Feedback and Suggestions

    I would be very interested to hear how you get on with this software - or if you have any feature requests or suggestions
    I can be contacted at rbarnfather@gmail.com - or as 'robocog' on the jye forum where we have a thread running HERE

    I would dearly like to get this running on Android and am working towards this goal (bear in mind I am not a programmer and this Python project took me a whle to get full functionality)

    The Python Source Code

    
    
    #! /usr/bin/env python3
    """
    # This has been adapted and modified by Robin Barnfather (robocog)
    # so that it will work under WindowsXP with the new 110-112 firmwares by JYE for the DSO Shell
    # Modified January 2018 - Version 1.7.4 - 20th Jan 2018
    # WITH DEBUG, a few little fixes -works under XP and Windows 10
    # Added com port selection and now with date and timestamped data
    #...and a comport.ini file that gets created on first run only
    # will ask if you want to run again at the end
    #
    """
    # Some code and a lot of inspiration borrowed from the original file -
    #-------------------------------
    # DSO150_p23.py - capture DSO150 data
    # 2017-10-06 by Rudolf Reuter, version 1.0, Python 2/3
    #
    # This software is (still in) public domain.
    
    ## check which ports...
    
    from __future__ import print_function # make "print" Python 2/3 compatible
    import serial
    import sys
    import time
    from subprocess import call
    import os
    import glob
    
    ### make the program universal for Python 2 and 3
    from sys import version_info
    python2 = False
    if version_info.major == 2:
        python2 = True
    
    ###this is to make it possible to start again (see bottom section)
        
    while True:
        ### ^ for looping
        print('\n'+'\n'+'-----------------------------------------------------------------'+'\n')
        print('DSO Shell Grabber v1.7.4 - written by robocog - 20th January 2018'+'\n')
        print('WEB: http://www.robocog.co.uk | EMAIL: rbarnfather@gmail.com'+'\n')
        # find a serial port IF no ini exhists
    
        if not (os.path.isfile('comport.ini')):
            print("First time of using this?" + '\n' + '...we need to setup a com port' + '\n')
            def serial_ports():
                    if sys.platform.startswith('win'):
                        ports = ['COM%s' % (i + 1) for i in range(256)]
                    elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
                        # this excludes your current terminal "/dev/tty"
                        ports = glob.glob('/dev/tty[A-Za-z]*')
                    elif sys.platform.startswith('darwin'):
                        ports = glob.glob('/dev/tty.*')
                    else:
                        raise EnvironmentError('Unsupported platform')
    
                    result = []
                    for port in ports:
                        try:
                            s = serial.Serial(port)
                            s.close()
                            result.append(port)
                        except (OSError, serial.SerialException):
                            pass
                    return result
    
            if __name__ == '__main__':
                print(serial_ports())
            print ('Type out - exactly as echoed above which port you want to use and hit enter'+'\n'+'(note the use of capital letters and no whitespaces!)')
            port = raw_input('>' )
            print ('Using '+ port)
            comport =open ('comport.ini','wb')
            comport.write(port)
            comport.close()
            
    
        else:
            print("comport.ini found ....using the data from it")
            with open('comport.ini') as fin:
                data = fin.read().splitlines(True)
                for line in data[:1]:
                    port = str(line).rstrip()
    
        
        ###         create a datestap variable (now)
        now = time.strftime('%d-%m-%Y %H-%M-%S')
    
        ###         Create a debug file (debug output.txt)
        ###         ~ a file to put everything in ~
        debugfile = open('debug.txt','w')
        debugfile.write("------------------------------------------------------------------"+'\n')
        debugfile.write('DSO Shell Grabber v1.7.4 - written by robocog - 20th January 2018'+'\n')
        debugfile.write("------------------------------------------------------------------"+'\n')
        debugfile.write('WEB: http://www.robocog.co.uk         EMAIL: rbarnfather@gmail.com'+'\n')
        debugfile.write("------------------------------------------------------------------"+'\n')
        debugfile.write("Debug file: " + now + ' \n' + "------------------------------------------------------------------" + '\n')
            
    
        print("Using Selected Serial Port: " + port)
    
        debugfile = open('debug.txt','a')
        debugfile.write("Using selected serial port: " + port + '\n' + "------------------------------" + '\n')
        #debugfile.close()
    
        ### open USB-serial port
    
        try:
            ser = serial.Serial(port, baudrate=115200, timeout =1)
            ser.flushInput()
        except:
            debugfile = open('debug.txt','a')
            debugfile.write("Could not open " + port + '\n' + "------------------------------" + '\n')
            debugfile.write("End")
            debugfile.close()
            sys.stderr.write("could not open port %r\n" % (port))
            sys.exit(1)
    
        print ("Push the DSO150 encoder button when you are ready"+'\n'+'(Press V/DIV and ADJ at the same time)')
    
        ###         wait for data....
    
        print('Waiting for data...(indefinately!)' + '\n')
        debugfile = open('debug.txt','a')
        debugfile.write("Waiting for data... " + "\n" + "------------------------------------------------------" + '\n')
        #debugfile.close()
    
        dsfile = open('all_data.txt', 'wb')
        flow = 0
        sdat = ser.readline()
        while True:
            sdat = ser.readline()
            dsfile.write(sdat)
            debugfile.write(sdat)
            #print(sdat)
            #print (flow)
        #    print('Line:'+ (str(flow)) + '-' + (str(sdat)))
            if (len(sdat) < 1):
                flow =0
        #        print("still waiting")
    
            else:
                flow += 1
                print(sdat)
                if (flow > 1042):
                    debugfile.write('\n' + '\n' + "--------------End of data----------------" + '\n')
                    break
            
    
        ###         Close the serial port
        debugfile.write("Closing serial port..." + '\n' + "------------------------------" + '\n')
        print("Closing serial port...")
        ser.close()
    
        dsfile.close()
        #debugfile.close()
    
        ##  Create Files
        print("Creating your files...")
        debugfile = open('debug.txt',"a")
        debugfile.write("Creating your files..." + '\n' + "------------------------------" + '\n')
        #debugfile.close()
    
        ##        Open data.txt generated by read serial
        ##        Read the first 18 lines and write to a file called header.txt
        print("Creating header.txt from first 18 lines....")
        debugfile.write("Creating header.txt from frst 18 lines..." + '\n' + "------------------------------" + '\n')
    
        with open('all_data.txt') as fin, open('header.txt', 'w') as fout:
            data = fin.read().splitlines(True)
            for line in data[:19]:
                fout.write(line)        
    
    
        ##        Ignoring the first 18 lines of stuff from all_data.txt 
        ##        Remove commas and replace with tabs and write out as gnuplot.txt
        print("Ignoring 1st 18 lines and replacing commas with tabs and creating gnuplot.txt")
        debugfile.write("Ignoring 1st 18 lines and replacing commas with tabs...." + '\n' + "------------------------------" + '\n')
    
        with open('all_data.txt') as fin, open('gnuplot ' + now + '.txt', 'w') as fout:
               data = fin.read().splitlines(True)
               for line in data[19:]:
                   fout.write(line.replace(',', '\t'))
    
        debugfile.write('Writing files as gnuplot ' + now + '.txt....' + '\n' + "------------------------------" + '\n')
        print('gnuplot ' + now + '.txt written and ready to open')
    
        debugfile.write("gnuplot.txt written ...." + '\n' + "------------------------------" + '\n')
    
    
        ## - Create gnuplot.plt labels from the header.txt
        with open('header.txt') as fin:
            data = fin.read().splitlines(True)
            for line in data[:1]:
                VSen = str(line).rstrip()
            for line in data[:4]:
                Timebase = str(line).rstrip()
            for line in data[:2]:
                Couple = str(line).rstrip()
    
        ## - Create gnuplot.plt a file with all the gnuplot settings and file etc...
        ##     edit to suit your tastes
        with open('dso150gnuplot ' + now + '.plt','w') as fin:
            fin.write('set title "File: DSO 150:' + Couple + '"'  + '\n')
            fin.write('set xlabel "' +Timebase +'"' + '\n')
            fin.write('set ylabel "' +VSen +'"' + '\n')
            fin.write('set grid' + '\n')
            fin.write('plot "gnuplot ' + now + '.txt" using 2:3 with lines' + '\n')
            fin.write('pause -1 "Select terminal window, hit RETURN to continue "' + '\n')
    
    
        print('Use gnuplot -dso150gnuplot ' + now + '.plt')
        print("All done...."+'\n')
        debugfile.write('Use gnuplot -dso150gnuplot ' + now + '.plt'+ '\n')
        debugfile.write("All Done!" + '\n' + "------------------------------" + '\n')
        debugfile.close()
    
    
    
        #port = raw_input('Hit enter to quit' )
        ####       Done
    
        #call gnuplot
        os.startfile('dso150gnuplot ' + now + '.plt')
        cmd = raw_input('Press q then ENTER to Quit ...or just hit ENTER to go again > ')
        if cmd == 'q':
            break
    
    
    
    
    

    Please call back for updates