I work in industrial automation and the functions of automation processors and software are locked down. I'm trying to sample and collect an analog signal at as fast of a rate as I can, <=10ms.
I have tried VB into excel, using a DDERequest and incrementing a delayed loop.
Application.Wait is too slow (1s)
"Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)," had the most promise, but too slow (100ms). It can be pushed faster, but this is on my computer, and then grabbing the float from the automation processor over ethernet... 100ms is the fastest without distorting the "real-time sample."
I have tried a Python module that pulls the float from the IP traffic. (Still over ethernet and too slow)
#x parameters sample = .001 iterations = 1000 #Collection for i in range(iterations): # read the GPIO float1 = SomeGPIOCommand(pin#) float2 = SomeGPIOCommand(pin#) # add the result to our ypoints list ypoints1.append(float(float1.Value)) ypoints2.append(float(float2.Value)) #x t = i*sample xpoints.append(float(t)) # pause time.sleep(sample) #Plot
plt.plot(xpoints, ypoints1, 'c-', label='target' )
plt.plot(xpoints, ypoints2 ,'r--', label='actual')
OR is this fast of a sample rate going to require code under an IDE? The key here is matching the time stamp, in ms, exactly with the measured value. I'd like to get there without an IDE, I just have no clue where to start, especially with the pi.
I have yet to see any example with this performance level.
Appreciate any help!