2 Arduinos ... SD Shield Datalogging ... Speed

Hello,

My project embodies two Arduino UNOs. One of which is purely data acquisition and one of which will be performing data logging and LCD display. I was wondering if it is possible to send data from the DAQ Arduino to my data logging/LCD Arduino via SPI?

My plan is to use the flash on the DAQ Arduino as a buffer and flush the data time to time to the data logging Arduino (like a queue). I feel this will allow the maximum throughput of data. Hopefully I can reach up to a few KHz.

Your thoughts? Suggestions?

Daniel

send data from the DAQ Arduino to my data logging/LCD Arduino via SPI?

depends on the pins used by the data logging and who will be the master - I assume the data logging Arduino should be as she has 2 'devices'

My plan is to use the flash on the DAQ Arduino as a buffer

Cannot be done, falsh is unwritable runtime, use RAM

Can you tell about the sensor used, the frequency and the data size of one sample?
Maybe tell us the goal of the project, there might be other ways too

robtillaart:

send data from the DAQ Arduino to my data logging/LCD Arduino via SPI?

depends on the pins used by the data logging and who will be the master - I assume the data logging Arduino should be as she has 2 'devices'

Arduino1 will be doing acquisition and send information to Arduino2 when Arduino2 will be logging onto SD. From this structure, I assume Arduino1 is the master.

My plan is to use the flash on the DAQ Arduino as a buffer

Cannot be done, falsh is unwritable runtime, use RAM

Yes, I was reading about it earlier and you are right, I am going to utilize the RAM.

Can you tell about the sensor used, the frequency and the data size of one sample?
Maybe tell us the goal of the project, there might be other ways too

It is a robotics project. The "sensors" are quadrature encoders of a master/slave setup. I would like to datalog onto an SD card. I do not want the robotic controller wasting cycles data logging, so Id prefer using the RAM to hold and shoot data into another Arduino which will be doing the data logging. Regarding SD logging frequency, I dont mind a couple hundred Hz.

Until I get my DUE this will have to suffice.

Daniel

robtillaart:

My plan is to use the flash on the DAQ Arduino as a buffer

Cannot be done, falsh is unwritable runtime, use RAM

Can you not point to addresses in the flash and write to them?

no, as said it cannot be done.

you can write to RAM (fastest) and EEPROM (slower)

Okay, thank you for clearing that up.

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

Daniel

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.

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.

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

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. - Arduino Reference - Arduino Reference -
Do you need analog reads too?