-1

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!

hydctrl
  • 33
  • 5
  • "OR is this fast of a sample rate going to require code under an IDE?" - No. Whether or not you use an IDE will have no bearing. "Should I stick with Python and trust it will be fast enough using the GPIO pins?" - FYI... That might cause your question to be closed as opinion based. – Jeff Scott Brown Feb 03 '22 at 17:43
  • Very well, I removed that opinion. Thank you for the heads up. – hydctrl Feb 03 '22 at 18:06
  • Have you come across a high speed collection function like this? Also 1000+ data points on plt.plot is a bit clunky is there a way to choose how many major grid lines are shown? – hydctrl Feb 03 '22 at 18:09
  • Is [How to achieve a high sampling speed using an ADC with Raspberry Pi?](https://raspberrypi.stackexchange.com/q/81819/40463) of any use? – Andrew Morton Feb 03 '22 at 18:19
  • 1
    "Also 1000+ data points on plt.plot is a bit clunky is there a way to choose how many major grid lines are shown?" - There is. You should post that as a question of its own. Seeking answers in a comment thread is going to be difficult for readers to follow. – Jeff Scott Brown Feb 03 '22 at 18:21
  • Or perhaps [The SBC: What is it and do I need one?](https://www.rs-online.com/designspark/the-sbc-what-is-it-and-do-i-need-one) could offer some ideas. – Andrew Morton Feb 03 '22 at 18:51

1 Answers1

0

OR is this fast of a sample rate going to require code under an IDE?

No. A fast sample rate doesn't require coding under an IDE. Whether or not the code is developed under an IDE will have no bearing on sample rate.

Jeff Scott Brown
  • 26,804
  • 2
  • 30
  • 47