Hi,
I am using Arduino Due with SRAM of 96KB and FLASH memory of 512KB.
The setup that I have is reading three analogeinput and try to save them in the computer as a CSV file.
I have used the codes in this link:
http://www.hackerscapes.com/2014/11/how-to-save-data-from-arduino-to-a-csv-file-using-processing/
which works perfectly but since I am using Serial.print in a loop and seems each Serial.print takes about 100us, if I want to transfer all 65000 data it will take something like 6.5 seconds with the baud rate of 115200.
I am thinking to save the analoginput data in a single array and then transfer it to the computer at once.
Anyone know, using Arduino Due, how we can decrease the storage time by avoiding frequent serial communication?
I have attached both Arduino and Processing codes for slow data logger case (6.5 second for 65000 int values (between 0 and 999))
MainDMDProfileV4.ino (4.62 KB)
WriteToCSV.pde (3.54 KB)
Your real problem is far from clear. If your data will fit in the Due's volatile memory as an array, that sounds like a good idea. If your data acquisition, about which you say nothing, allows you to record to on-board SD card, you could dump the file to PC in one shot. But you are still transferring by serial, and either of the above may well be no better than what you are doing now. Who would know if 6.5 seconds really is a problem worth pursuing, or if this is as much a Processing problem as an Arduino problem, but the solutions can only now be to transmit faster, transmit less, or transmit at a time when 6.5 seconds is not a problem. One thing you might check, is that long int is the best choice for your data. There are other fast data transfer topics nearby on this forum, and I believe one of them involves using a Due.
As already stated, a record on an on board SD card seems a good option, the other one would be to transfer consecutive buffers of 512 bytes (or more) via the native USB port using SerialUSB.write.
The speed of the native USB port depends of many factors, including the PC side, although the maximum speed is around 849 KB/s. Likewise some speed improvement can be done by not using analogRead() but a direct port programming to read 3 analog channels triggered by a Timer Counter.
See this thread , reply #1:
https://forum.arduino.cc/index.php?topic=487989.0