Go Down

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

dgelman

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

Dialup is the future.

robtillaart

Quote
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'

Quote
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
Rob Tillaart

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

dgelman


Quote
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.

Quote
Quote
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.

Quote
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


Dialup is the future.

dgelman


Quote
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?
Dialup is the future.

robtillaart

no, as said it cannot be done.

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

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

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