Reading a lot of data very quickly with Arduino?

In summary, the Arduino is struggling to keep up with the processing of the movement commands and the calculations for the movement themselves. Processing all the data first may offer a significant improvement, but it is unknown if the Arduino has the memory for this. Alternatively, performing the calculations beforehand and storing them may be a better option.
  • #1
Sebastian B
9
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
  • #2
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 jim mcnamara
  • #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"
 
  • #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?
 

1. How can I read a large amount of data quickly with Arduino?

The best way to read a large amount of data quickly with Arduino is to use interrupts. Interrupts allow for the Arduino to pause its current task and handle a higher priority event, such as reading data, before returning to its original task. This allows for the Arduino to quickly process and store data without being slowed down by other tasks.

2. Is there a limit to how much data can be read quickly with Arduino?

Yes, there is a limit to how much data can be read quickly with Arduino. The limit will vary depending on the specific Arduino board and its processing speed and memory. However, using techniques such as interrupts and optimizing code can allow for a larger amount of data to be read quickly.

3. Can I use Arduino to read and process data from multiple sensors at once?

Yes, Arduino can be used to read and process data from multiple sensors at once. This can be accomplished by using multiple interrupt pins or by using a multiplexer to switch between sensors. It is important to consider the processing power and memory of the Arduino board when working with multiple sensors.

4. Are there any tips for reading data quickly with Arduino?

Some tips for reading data quickly with Arduino include using interrupts, optimizing code, and using external memory such as an SD card. It is also important to carefully consider the hardware and capabilities of the specific Arduino board being used.

5. Can I use Arduino to read data from external sources such as a database or website?

Yes, Arduino can be used to read data from external sources such as a database or website. This can be accomplished by using a WiFi or Ethernet shield to connect to the internet and retrieve data. However, the speed at which data can be read will depend on the internet connection and the processing power of the Arduino board.

Similar threads

  • Programming and Computer Science
Replies
23
Views
3K
Replies
5
Views
3K
  • Programming and Computer Science
Replies
20
Views
528
  • Programming and Computer Science
Replies
1
Views
283
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
22
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
22
Views
922
  • Programming and Computer Science
Replies
4
Views
746
  • Programming and Computer Science
Replies
6
Views
2K
Back
Top