Reading a lot of data very quickly with Arduino?

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
3 replies · 2K views
Sebastian B
Messages
9
Reaction score
0
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.
 
Physics news on Phys.org
Sebastian B said:
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?
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.
 
  • Like
Likes   Reactions: jim mcnamara
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"
 
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?