Software to capture and plot with the new firmwares

Post Reply
RobNL
Posts: 122
Joined: Mon Dec 25, 2017 3:11 pm
Location: The Netherlands
Contact:

Re: New firmware and serial data capture to visualize and pl

Post by RobNL »

CU, Rob
robocog
Posts: 64
Joined: Tue Sep 12, 2017 10:06 am

Re: New firmware and serial data capture to visualize and pl

Post by robocog »

Right - I have made some headway on the windows version
A lot of the code has been made a little more compact
(and a lot more debug info!)

I had it working brilliantly last night but when I came home I fired it up and got a bucket load of errors and stuff that was no longer working
(wondering if I was maybe editing a different file to the one I fired up tonight - have got literally dozens of copies - some completely broken or just wonky)

Tonight I have been through the broken ones and tossed them and made a folder of the ones I have been playing with - and a folder with version numbers as I have progressed/ played with the code
(its hard work keeping track of what I have changed and why!...I'm better at digging holes and hitting things with hammers than keeping my desktop tinkerings sane!)

Anyway
For Windows (only tested under XP sp3 with Python 2.7.14 )

All that is required (once you have Python installed - I am running 2.7.14 under XP) is the python script and a shortcut to gnuplot in the directory (make it with the following arguments -p dso150gnuplot.par - and all you have to do is run the script then double click the gnuplot shortcut and you will get a graph to tinker with)
It is set to use com2 and has a 10 second timeout waiting for data - these can be easily changed - and I have commented the code
It will also spit out a few handy files in the same directory - debug.txt - handy for seeing what the script is doing , all_data.txt - all the data from the serial port , header.txt - just the first lines spat out by the DSO Shell showing its settings at the time of capturing the data, dso150gnuplot.par - a parameter file for running gnuplot with (tells it stuff like title, labels, grid and what file to open for the data) and lastly gnuplot.txt- the data formatted and ready for gnuplot to open

I'm happy to say this version 1.2 is working far better than I had hoped - but I am still not entirely happy with the grabbing of the serial data (1st line is missed out - Vsens) and I have done some playing with the next version that looks likely to try and use the header data for automated labelling of the graph's title and axes labels

I have also modified the code I used under Android to be much more compact and efficient (not that it was an issue)
It now reads:

with open('alldata.txt') as fin, open('gnuplot.txt', 'w') as fout:
data = fin.read().splitlines(True)
for line in data[19:]:
fout.write(line.replace(',', '\t'))

If the forum software damages the formatting I'll screenshot or pastebin the code
...I'm also on the trail of converting the python code to an apk
Will report back as soon as there is something eventful to report :)

The windows python script is here
Please report any bugs or findings to give me a better understanding as to what is required (or if there is any interest at all!) :D
DSO150 v1.2 working Python script.zip
(3.04 KiB) Downloaded 306 times
RobNL
Posts: 122
Joined: Mon Dec 25, 2017 3:11 pm
Location: The Netherlands
Contact:

Re: New firmware and serial data capture to visualize and pl

Post by RobNL »

I clear the workspace and put the modules in a box.
Somewhere is the box with 3 or 4 BT-modules......but where ?
I order a few new, but have to wait on HongKong :(
CU, Rob
robocog
Posts: 64
Joined: Tue Sep 12, 2017 10:06 am

Re: New firmware and serial data capture to visualize and pl

Post by robocog »

Oh I know that one, and then when you get them and put the extra ones away you will find the original 'lost' ones if your storage 'system' is anything like mine
Regards
Rob
RobNL
Posts: 122
Joined: Mon Dec 25, 2017 3:11 pm
Location: The Netherlands
Contact:

Re: New firmware and serial data capture to visualize and pl

Post by RobNL »

I have clean the workbench in ones......now I not know where I put them.....short memmory :shock:
CU, Rob
robocog
Posts: 64
Joined: Tue Sep 12, 2017 10:06 am

Re: New firmware and serial data capture to visualize and pl

Post by robocog »

Massive breakthrough tonight - Version 1.3 DEV
Serial capture re-written
Script now waits indefinitely for data to arrive - will add a configurable timeout or escape key
It grabs all the data (earlier versions skipped the first line - VSens)

X and Y axis and title (when opened with gnuplot) are now labelled as per how the DSO shell was set when capture was taken
Ticked off at least 4 major goals I had in mind - lots of extra debug and info on screen which I guess the end user is not that interested in - but hey... better to let ME know what's going on whilst I play with the code!

Will continue developing this till my head explodes or wife kicks me out (not sure which will come first)
She is leaving me over the weekend - so I will download Android studio and have a play whilst I forget I put a Pizza in the oven...(never used Java before so don't hold your breath!)
Seems "conversion" of Python stuff for Android is a tad convoluted so might be easier in the long run?

I think I have a fairly clear idea of what I want it to do (which is always helpful)
Anyway - the latest Python script from tonight's session... Regards
Rob
robocog
Posts: 64
Joined: Tue Sep 12, 2017 10:06 am

Re: New firmware and serial data capture to visualize and pl

Post by robocog »

Please find DSO150 v1.4 -no debug.py (Created 19-1-18 at around tea time)
DSO150 v1.4.zip
(3.33 KiB) Downloaded 298 times
Having just installed windows 10 and Python3...
I noticed the previous versions were completely broken under a more modern OS and Python3 :(

So ....
I tinkered with the script with windows 10 and Python 3.6.4
Code now works (sorry if you were running Windows 10 as it was really quite broken!)

With gnuplot 5.2 patchlevel 2 installed - once it has collected the data it will open the graph
(along with the axis and title set to the settings you had at the time of data capture)

I also cobbled together little python script that tells which com ports the PC had found
(might be handy and might get rolled into the file at some point)
Enjoy...and I would be interested to hear from ANYONE using this
...with constructive criticism or requests :)

Not tested under XP yet, but the earlier versions were working for me - and I have a sneaky feeling I'm possibly the only person running this under XP!

Oh and I have installed Android Studio - hence the Windows 10 'upgrade'...sigh
I also installed Kivy under Python (sounds easy doesn't it?) - not a clue what to do with either yet and I wont be getting those hours of my life back so I will see if I can produce an APK from them

Nothing radical is going to happen over night, but small steps to getting something workable for Android
Don't hold your breath

Regards
Rob
RobNL
Posts: 122
Joined: Mon Dec 25, 2017 3:11 pm
Location: The Netherlands
Contact:

Re: New firmware and serial data capture to visualize and pl

Post by RobNL »

I think I see a problem....Window XP - Window 7 - Window 8 - Window 10 and some differend kind of Phyton and GNUplot to use.
A APP doesn't have this problems, most cellphones and tablets have at least version 4 (KitKat).
All higher version of Android can run the lower version APP's on Android......and Windows can not.
I have a some very expencive drawing programs for Window 7 and can't use it on Window XP, 8, or 10.
So I have to rent a M$ programmer to convert the archive.....if possible, wat I doubt :shock:
CU, Rob
robocog
Posts: 64
Joined: Tue Sep 12, 2017 10:06 am

Re: New firmware and serial data capture to visualize and pl

Post by robocog »

To say I can go to bed happy is an understatement!
The new version ^ works 100% under XP as well as Windows 10 at my end, only need to manually change the com port to suit before running the script as under XP it shows as COM2 and under 10 it shows as COM3, I could change it on either PC to suit, but manually editing the commented com port is quicker!

Tested under both Python 2 and 3 - no changes to the code needed!
I don't have access to 7 or 8 (or any others they snuck in between XP and 10) but as long as a version of python is installed and gnuplot, it should just work!)

Am I the only one running this?
Any feedback would be welcomed!

Auto detect com ports is next on the list to try to make it work without needing to manually do it - even more portable and one step closer to making it an exe?

Regards
Rob
RobNL
Posts: 122
Joined: Mon Dec 25, 2017 3:11 pm
Location: The Netherlands
Contact:

Re: New firmware and serial data capture to visualize and pl

Post by RobNL »

I like your work a much, but for now I can not test....the TTL-modules are not arived yet :? and where the modules are I all ready have...shoot me :evil:
CU, Rob
Post Reply