Reading a lot of data very quickly with Arduino?

Click For Summary

Discussion Overview

The discussion revolves around optimizing the performance of an Arduino project that controls multiple stepper motors based on data from an external text file. Participants explore methods to reduce processing time for motor commands, considering approaches such as data buffering and pre-calculation of commands.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested

Main Points Raised

  • One participant notes that the processing time for motor movements exceeds the actual movement time, suggesting that the I/O operations might be a bottleneck.
  • Another participant proposes buffering commands in RAM to improve performance, treating it like a queue for stepper commands.
  • A suggestion is made to replace delay() with delayMicroseconds() or to eliminate delays altogether by using millis() for timing.
  • Questions are raised about the specific calculations being performed and whether pre-calculating and storing results could alleviate the processing burden on the Arduino.

Areas of Agreement / Disagreement

Participants express various strategies for improving performance, but there is no consensus on the best approach or the specifics of the calculations involved.

Contextual Notes

There are uncertainties regarding the exact nature of the calculations and the impact of I/O operations on processing time. The discussion does not clarify the limitations of the Arduino's memory or processing capabilities in this context.

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.
 
Technology 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?
 

Similar threads

Replies
23
Views
4K
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 20 ·
Replies
20
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 22 ·
Replies
22
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K