Pages: 1 [2]   Go Down
Author Topic: Need read/write times for SD lib to be faster  (Read 3271 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46235
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The problem I have is writing to the micro SD. I'd like to be able to write the data at a rate of about 200Hz.
Two bytes at 200Hz or 2Kb at 200Hz. Frequency alone is a useless value.
Logged

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1484
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

mokwichi,

You will need special buffering to log at 200 samples/sec.  I have posted a number of examples here http://code.google.com/p/beta-lib/downloads/list.

The examples in fastLoggerBeta20110802.zip use custom timer ISRs and buffering.

The examples in ChibiOS20111027.zip and FreeRTOS20111031.zip use a real-time kernel to run two threads. One thread reads sensors at fixed time intervals and puts the data in a circular buffer.  The second thread removes data from the buffer and writes it to the SD.

You will need enough programming skill to modify these examples for your use.
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 691
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Another approach is to use two arduinos. Use one for the data gathering and massaging, the second to do all the other work (i.e. writing to disk, etc.). I'm sampling power at 2.8ksps with a 328P @ 16MHz, the second chip (1284P) does the SPI work with the SD card as well as a RFM-12B. The two talk via serial, using EasyTransfer. I selected this approach to minimize the possibility of data getting lost while the 12B was transmitting, for example (it requires an interrupt).

A dedicated chip may also be an answer. For example, the specifications of a ADE7753 are tasty for power measurements, I just never got it to work properly. You might be able to find similar dedicated chips for sampling for your applications that can be addressed over I2C or SPI.
« Last Edit: December 02, 2011, 12:36:30 pm by Constantin » Logged

Offline Offline
Edison Member
*
Karma: 6
Posts: leet
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@fat16lib - Can I use your WaveRP library with this hardware?

http://www.ladyada.net/products/microsd/
I don't have the Wave Shield.
Where do I modify chipSelect like in the above tutorial?
Mine is not the default wiring.

I have built a mic preamp which works using analog input.
So I can record.
I could not play the files?
What do I need to change in the WaveRecordPlay example sketch?
What options can I change in that code?
What's the difference between SD and SDfat libraries?
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Offline Offline
Edison Member
*
Karma: 6
Posts: leet
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The author says no changes are necessary.  Can anyone verify this?
My chipSelect pin is not the default...
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Pages: 1 [2]   Go Up
Jump to: