Go Down

Topic: 2 Arduinos ... SD Shield Datalogging ... Speed (Read 915 times) previous topic - next topic

dgelman

Okay, thank you for clearing that up.

Regarding my application, would there be a more efficient way?

Daniel
Dialup is the future.

robtillaart

Quote
arding my application, would there be a more efficient way?


You could try to reach the speed with just 1 board. however your specifications are not detailed enough yet. A few Khz is rather vague.

Quote
The "sensors" are quadrature encoders of a master/slave setup.

sensors = how many 2,4,6?
What do you mean by master slave setup?
=> sounds like an attachInterrupt() job.

IIRC An SD card performs best if you can write a sector/block at a time (256 bytes) so if you buffer up in RAM until you have a full sector (optionally padded) you can write that directly to SD card. For details of performance browse the storage section of the forum (e.g. the work of fat16lib).
I expect this is almost as fast as using 2 Arduinos while easier to build.



Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

dgelman

Sorry for the vague explaination.

As it stands the Arduino only has 2 INT pins which I am using for the master and slave encoder pulses (using attachinterrupt()).  This is too control 1 motor.  Eventually I will go into more motors for more DOFs but that will require a different micro (but for now, this will suffice).  I am reading over fat16lib's work and I will be using that library to data log.  But for the sake of speed, I would like the data logging to be done a different arduino (for now).  So I was just wondering what methods I can use to transfer data from one arduino to another. 

Doing some tests and research, I would be happy with approximately 500Hz data logging, so I would need to reach the appropriate kbps speed for transfer.  Can serial communication be enough between the arduinos? SPI?

Daniel

Dialup is the future.

robtillaart

500HZ is a freq the arduino should be capable of handling but how much data in bytes do you want to store per time?

SPI is very fast to transfer data from one arduino to the other, but normal serial can also work officially at 115200 baud (10 chars per millisecond) but unoffically it also works quite well on 500.000 baud (as this is a integer divider of the 16Mhz clock). at 500KBaud you can approach 50 chars per millisecond .

500Hz means you have 2 milliseconds per loop.
1 millisecond to get the sensor data
1 millisecond to transport it.

This also means no delay's in the code and probably use direct port manipulation instead of digitalREads/writes. - http://www.arduino.cc/en/Reference/PortManipulation -
Do you need analog reads too?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up