Author Topic: Software advice: Basic dynamic signal analyser  (Read 1112 times)

0 Members and 1 Guest are viewing this topic.

Offline DavidTopic starter

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: gb
Software advice: Basic dynamic signal analyser
« on: August 01, 2020, 01:25:41 pm »
Hi all,

I have been developing some hardware which essentially consists of a low noise front end and a 24 bit ADC for the purpose of a simple dynamic signal analyser. The hardware has an ethernet interface and streams the data via TCP. Now, when it comes to PC application software I immediately start to shiver... What I am looking to do is essentially perform a dynamic FFT on the incoming data and have some basic averaging and window functions. I don't want to re inevent the wheel nor do I have the software skills to particularly do this (unless it's possible in VB.net, even then it still make me nervous!). Does anyone know of any open source framework or anything else that could be adapted to do the job? I can change the "protocol" I'm using over TCP if needed.

Cheers,

Dave
David
(United Kingdom)
 

Offline OM222O

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #1 on: August 01, 2020, 01:35:11 pm »
use python + numpy / scipy

Easy support for Ethernet and sockets, data analysis, etc. takes you 10 min to learn everything.
 

Offline DavidTopic starter

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #2 on: August 01, 2020, 03:46:45 pm »
Forgive my ignorance, would I be able to create a GUI and an executable with python?
David
(United Kingdom)
 

Offline FenTiger

  • Regular Contributor
  • *
  • Posts: 88
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #3 on: August 01, 2020, 03:48:58 pm »
Jupyter Notebook makes a great GUI for Python etc: https://jupyter.org/

I haven't tried their new JupyterLab thing. I should give it a go.
 

Offline OM222O

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #4 on: August 01, 2020, 03:50:24 pm »
a GUI yes, you can use TKinter for that , however an exe is very unstable / janky. the end user needs to have a python complier on their computer. (it's not really a compiler but I'm not sure what to call it, python runs dynamically on the computer, so no "pre compiled code" is used, hence the jankiness of the exe files).
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 7045
  • Country: nl
Re: Software advice: Basic dynamic signal analyser
« Reply #5 on: August 01, 2020, 05:22:40 pm »
a GUI yes, you can use TKinter for that , however an exe is very unstable / janky. the end user needs to have a python complier on their computer. (it's not really a compiler but I'm not sure what to call it, python runs dynamically on the computer, so no "pre compiled code" is used, hence the jankiness of the exe files).

Packaging executables for distribution is a pain at the best of time. There's a variety of freeze based methods which just include the whole python environment you work with together with the script, like pyinstaller. No dependency on installed python, just large and potentially slow to start.
 

Offline DavidTopic starter

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #6 on: August 01, 2020, 08:52:49 pm »
Thanks for the replies. I've dived into Python and Qt...wish me luck!
David
(United Kingdom)
 

Offline DavidTopic starter

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #7 on: August 14, 2020, 06:32:21 pm »
Ok, so I've got somewhere with using Python, QT and Matplotlib but would appreciate some help please. At the moment I have the following which connects to a device (well it connects to a dummy server I've knocked up) and can do some basic comms so that's the ethernet side ticked off for now. I have added a matplotlib chart as shown and at the moment it is just generating random numbers and scrolling (just lifted some tutorial code). I have two main objectives; the first is to -stream the samples from my ADC and view them in an oscilliscope type chart, the second is to view the same data in a seperate chart doing a 'real-time' FFT. At the moment I just want to focus on the first objective. Now I am not after anything fancy and I don't need to make accurate measurements of the incoming data (the real aim of all of this is to analyse the FFTs). The idea is just to have some visual idea of what the hardware is sampling. To keep things simple lets assume my ADC is sampling data at 100kHz on a single channel (in reality it won't be any faster than this). Lets also assume that my hardware is taking the samples and then streaming this data as fast as possible to the PC over ethernet. What would be the best way to handle the data once it arrives in my Python program and how should I handle updating the chart to maintain the correct timebase information? At the moment the tutorial code I have just adds new data to a Python List structure and drops off the first element then redraws the canvas. This is triggered by an internal timer at a set interval. I feel like I need some sort of circular buffer but I am getting my head in a twist over timings and buffering data.

Any suggestions or help of any kind would be very much appreciated!
« Last Edit: August 14, 2020, 06:34:47 pm by David »
David
(United Kingdom)
 

Offline DavidTopic starter

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #8 on: August 18, 2020, 02:47:59 pm »
I'm still confusing myself here  |O I think I am over-complicating the problem but then again I'm still trying to learn Python...
David
(United Kingdom)
 

Offline OM222O

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Software advice: Basic dynamic signal analyser
« Reply #9 on: August 18, 2020, 11:59:36 pm »
matplotlib has a function that allows you to "animate" which basically updates the chart in fixed time intervals (don't try to update faster than 100FPS, aka 10mS since it'll lag and become unusable. If you have a 60Hz monitor, 16mS should be plenty fast enough).

If you're ok with that limitation then it's really easy to show the last N samples, but if you want proper scope functionality (trigger, x time / division, etc) it'd be nightmare to implement.

Assuming you just want to show the last N samples and the new data is added to a list called buffer:

data = data + buffer
data = data[len(data)-N:]
buffer = []

if you use numpy arrays it's a lot more efficient when you try to do FFT but you need to use the .stack (or if you already know the shapes of the matrices, either hstack or vstack, depending on how you're structuring the data) in order to add them together, otherwise if you just do A + B  on a numpy array, it just adds the elements of the two arrays together instead of appending them.

For the time issue: your best bet is to encode the time data and send it over serial too, for example I know arduino has a millis and micros function that returns you the elapsed time. I'm sure when you send that over, adding or removing some offset and then doing cumulative sum (np.cumsum) allows you to get actual time for your x axis.
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2331
  • Country: 00
Re: Software advice: Basic dynamic signal analyser
« Reply #10 on: August 20, 2020, 04:00:58 am »
Just is case you wana  evaluate another path

http://www.lohninger.com/fourier.html

This with embarcadero Delphi or C++ is relatively easy to implement, But is not open source, But is professional and on the end you will have a instalable executable, Not a bunch of code lines typed to install
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf