Pages: [1]   Go Down
Author Topic: Fast serial to SD card data logger  (Read 4505 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1673
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have posted a program that can log data from a serial port to an SD card.

This program can log data at 57,600 baud when used with a 328 Arduino and at 115,200 baud when used with a Mega Arduino.

The logger uses a new serial library that allows large RX buffers and has better error checking than the standard Arduino HardwareSerial driver. This allows data overrun errors to be detected so you can be sure data is not being lost.

The data logging program, the new SerialPort library, and a modified version of the SdFat SD library are posted as SerialLoggerBeta20120108.zip here http://code.google.com/p/beta-lib/downloads/list.

I use a 1024 byte RX buffer on a 328 Arduino that provides 174 milliseconds of buffering at 57,600 baud and a 4096 byte RX buffer on the Mega that provides 347 milliseconds at 115,200 baud.  A few SD cards may fail on 328 Arduinos since the SD spec allows occasional write times of 250 milliseconds.  My experience is most SD cards can log sustained data at 57,600 baud on a 328 Arduino.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27425
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Whoa, crankin'!
Can it do the same speeds for data arriving via SPI?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14048
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Impressive work fat16lib - better call you fast16lib smiley-wink

Quote
Can it do the same speeds for data arriving via SPI?

IIRC SDcards use SPI too. So there might be some interference ?? ...

Logged

Rob Tillaart

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27425
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Seperate Input & output registers; have to see what fat26lib says.
115,200 is fast enough to do dual 16 bit stereo at 44.1K samplling each side, that's what I'm after, my own digital sampler.

Then playback only on a trigger later ... electric drums!
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

115,200 is fast enough to do dual 16 bit stereo at 44.1K samplling each side, that's what I'm after, my own digital sampler.
That would be nice. Just curious... how do you figure that?
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

2x16x44100=1.4112MBit/sec   smiley-eek
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Right, that's what I calculated. So how would I get 1.4Mbit/sec on 115K baud?
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi SdFat, is your SdFat library for Arduino 1.0 available as a standalone download? I didn't see it in your list, although i did notice the library for digital pins!

Thanks...
Logged

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1673
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SdFat for Arduino 1.0 is here http://code.google.com/p/sdfatlib/downloads/list.  The file is sdfatlib20111205.zip.

A newer version, SdFatBeta20120108.zip, is included with the Serial Logger and I will soon post it as the current version for 1.0.
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SdFat for Arduino 1.0 is here http://code.google.com/p/sdfatlib/downloads/list.  The file is sdfatlib20111205.zip.

A newer version, SdFatBeta20120108.zip, is included with the Serial Logger and I will soon post it as the current version for 1.0.

Awesome, thank you!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to thank fat16lib for his awesome libraries and samples to get me going on an extreme serial data logger!

Those with data logging/serial projects need to investigate his work!
Logged

Pages: [1]   Go Up
Jump to: