The AnalogIsrLogger.ino program demonstrates techniques for logging data toan SD card at high rates by capturing data in a timer driven interrupt routine.I have been able to log data at up to 100,000 samples per second usingAnalogIsrLogger.ino. This requires an excellent SD card. See SD_CARDS.JPGfor photos of cards that have worked at 100,000 8-bit samples per second.Example data is shown in DATA.PNG and it's FFT is in FFT.PNG. See ExcelFFT.pdfin the ADCdocs folder.The accuracy of the ADC samples depends on the ADC clock rate. See theADC_ENOB.PNG file for a plot of accuracy vs ADC clock frequency.See files in ADCdocs folder for more information on ADC accuracy.To modify this program you will need a good knowledge of the ArduinoADC, timer1 and C++ programming. This is not for the newbie.You may need to increase the time between samples if your card has higherlatency. Using a Mega Arduino can help since it has more buffering.I have an LED and resistor connected to pin 3 to signal data overruns.You can disable this feature by setting the pin number negative:// led to indicate overrun occurred, set to -1 if no led.const int8_t RED_LED_PIN = 3;These programs must be used with a recent version of SdFat. The programwas developed using sdfatlib20120719.zip from:http://code.google.com/p/sdfatlib/downloads/listYou also need to install the included BufferedWriter library. It providesfast text formatting.Place these three folders in your sketchbook libraries folder.Place the AnalogIsrLogger folder in your sketchbook.The program has four commands:c to check for overrunsd to dump data to Serialr to record ADC datat to convert file to textAll commands can be terminated by entering a character from the serial monitor.The r command will record ADC data to a binary file. It will terminatewhen a character is entered on the serial monitor or the the maximum fileblock count has been reached.The d command converts the binary file to text and displays it on the serialmonitor. Entering a character on the serial monitor terminates the command.The t command converts the binary file to a text file. Entering a characteron the serial monitor terminates the command.The c commands checks the binary file for overruns. Data overruns happen whendata samples are lost due to long write latency of the SD.A number of program options can be set by changing constants at the beginningof the program. Key settings include:// set RECORD_EIGHT_BITS nonzero to only record high 8-bits#define RECORD_EIGHT_BITS 1// Sample rate in samples per second.const uint32_t SAMPLE_RATE = 100000;// Analog pin numberconst uint8_t ANALOG_PIN = 0;// digital pin to indicate overrun, set to -1 if not usedconst int8_t RED_LED_PIN = 3;// SD chip select pinconst uint8_t chipSelect = SS;// max file size in blocksconst uint32_t FILE_BLOCK_COUNT = 256000;// log file name#define FILE_NAME "LOGFILE.BIN"// Reference voltageuint8_t const ADC_REF_AVCC = (1 << REFS0);
I obviouslly mean the LadyaDa shield!
Thanks Paul, really helpful...If anyone knows which shield was used, or I should think of using in this project, would be really grateful to know.
sbecause arduino doesn't support parallelization