Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Reading a lot of data very quickly with Arduino?

  1. May 14, 2017 #1
    Hi all,

    I am currently working on an Arduino project that involves multiple stepper motors. The motors are told how to move by an external txt file. However, sometimes the processing of how the steppers have to move takes longer than the actual movements themselves. Some movements should only take about 20 microseconds. However the calculation for that movement takes almost in the millisecond domain.
    At the moment, I am processing the data in real time and them sending commands of how to move the motors. I was wondering if I should process all the data first and store it in some type of file (if yes what filetype?) or if I should use some sort of buffer?

    Thanks for your times.
  2. jcsd
  3. May 14, 2017 #2


    Staff: Mentor

    What all is involved in the calculations that take so long (50 times as long as the movement itself)? Are you including the time to read from your text file as part of the calculation time? If so, the I/O could be the big bottleneck, so buffering the commands to the stepper motors could offer a significant improvement.

    I haven't done an Arduino programming, so I'm not familiar with the memory map or anything else for this chip. I would think there would be RAM that you could store the stepper commands in, treating this section of RAM like a queue, with new commands being placed at the end, and older commands being pulled from the front of the queue.
  4. May 18, 2017 #3
    If you are using a delay() try switching to a delayMicroseconds(); if that does not work, Try getting rid of the delay all together and program using millis() google "Blink Without Delay - Arduino"
  5. Jul 25, 2017 #4
    What are the calculations you're doing? An Arduino isn't the quickest CPU in town but it should be able to do most maths pretty quick.

    Also can you do an alternative such a performing the calculations beforehand and storing them, so the poor Arduino only has to look the results up?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted