Go Down

Topic: Try this super fast analog pin logger (Read 62304 times) previous topic - next topic

ARDPrash

I have used this code with Arduino Due. But it won't compile and returns an error message saying "error too little SRAM"

fat16lib

AnalogBinLogger is an AVR only program.   Here is what you should get on Due

Quote
Arduino: 1.6.9 (Windows 10), Board: "Arduino Due (Programming Port)"

AnalogBinLogger:830: error: #error This program is only for AVR.

 #error This program is only for AVR.

  ^

exit status 1
#error This program is only for AVR.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
AnalogBinLogger depends on the hardware features of the AVR ADC.

The LowLatencyLogger example will work with Due and can log at 5,000 samples per second with four adcs in each sample.

hugsy

I'm trying to use the AnalogBinLogger example from the SdFat library but it doesn't work on my Adafruit Feather 32u4 Adalogger, I can compile and upload it but there is no serial print.... The example Lowlatencylogger works fine by the way....

I have another question, does AnalogBinLogger work with SPI input from ADXL345, is there any example anywhere ?

Thank you

fat16lib

The problem may be the USB in the 32u4.

The AnalogBinLogger only works with the AVR ADC.  It depends on the ADC digitizing while the CPU processes SD activity.  The ADC is read quickly in an ISR.

It's sad that DIY boards with the Arduino IDE are so limited.  I log data on STM32 development boards with the ChibiOS RTOS at over a million samples per second.  Boards like the $13 Nucleo STM32F411 have multiple SPI buses and high power DMA controllers.  You can also access the SD on a 4-bit wide 48 MHz SDIO bus.  

ChibiOS's excellent HAL, multi-threading and priority based preemptive scheduler make it possible to implement high performance embedded systems.

Unfortunately the skills required to use these boards properly with ChibiOS are beyond those of most DIY users.

I continue to support SdFat on Arduino but rarely use Arduino for my projects.


hugsy

#94
Aug 01, 2016, 02:26 pm Last Edit: Aug 01, 2016, 07:34 pm by hugsy
Ok thanks, I will switch to analog accelerometer... I'm gonna try again, it should work on the 32u4, at least the interface because it's quite the same code as the Lowlatencylogger.


Edit: It's working. The following command was missing:

 
Code: [Select]
while(!Serial.available()) {
    SysCall::yield();
  }


I managed to log at 17kH on one channel this code is a beauty !!

ARDPrash

I am trying to use Analog pin logger to log data with a standalone Arduino, without using a PC. Can anyone help to modify the code such that, it can log the data and convert it to .CSV format for a time period specified by me, for example, one day.

fat16lib

I posted a new LowLatencyLogger in SdFat-beta.

It has several new commands.
Quote
FreeStack: 1290
Records/block: 42

type:
b - open existing bin file
c - convert file to csv
d - dump data to Serial
e - overrun error details
l - list files
r - record data
t - test without logging
the 'l' command gives a directory listing with the size and file names.
Quote
ls:
     13312 adc4pin00.bin
     11264 adc4pin01.bin
     45568 adc4pin02.bin

The 'b' command allows an existing file to be opened by entering the two digit file version.  You can then dump the file to Serial or convert it to csv.

Quote
Enter two digit version
adc4pin00.bin
File opened
Enter 'c' to convert the file to csv.
Quote
FreeStack: 706
Writing: adc4pin00.csv - type any character to stop
92%
Done: 1.20 Seconds
Here is a list of files using the 'l' command that shows the csv file.
Quote
ls:
     22624 adc4pin00.csv
     13312 adc4pin00.bin
     11264 adc4pin01.bin
     45568 adc4pin02.bin
Finally the 't' command just acquires data records at five samples per second and prints them to serial until a character is entered.

Quote
Testing - type any character to stop

micros,adc0,adc1,adc2,adc3
0,745,604,516,512
200000,571,549,510,507
400000,533,522,498,498
600000,515,504,486,488


hugsy

#97
Aug 27, 2016, 05:50 pm Last Edit: Aug 28, 2016, 06:40 pm by hugsy
I'd like to start and stop the data logging with a switch button (in addition to the serial mode). I managed to stop the logging thanks to one of your previous answer but I don't know where to put the command to start the acquisition...

I tried this but without success...


Code: [Select]
void loop(void) {
 // Read any Serial data.
if (digitalRead(switchPin) == LOW) {
   logData();   
   }
 do {
   delay(10);
 } while (Serial.available() && Serial.read() >= 0);
 Serial.println();
 Serial.println(F("type:"));
 Serial.println(F("c - convert file to csv"));
 Serial.println(F("d - dump data to Serial"));
 Serial.println(F("e - overrun error details"));
 Serial.println(F("r - record ADC data"));


I have also another issue: it doesn't work when I use the A0, A1 etc... pins with the PIN_LIST function...

Thanks for your help @fat16lib

sijo



After executing bintocsv.exe in my PC , im getting an error "Invalid meta data".
Im using windows 10 64 bit OS. Do i need to change any setting in my  PC?


ARDPrash

What are the factors that affects the upper limit of the sampling rate we are using to log the data. Which code segments are responsible for the sample collection procedure that affects the sampling rate?

ARDPrash

I am using this code with Arduino Mega to log data. Specifications are Arduino Mega2560, SD card size 8GB, type SDHC.

When I am try to increase my Sampling rate beyond 5 kHz, it states that the sampling rate is too high. But, I read through this forum and found that we can go up to 40 kHz for a single pin.

Is there any other factors that affecting the maximum sampling rate other than clock rate?

kellyett

I'm realy keen on being able to convert the bin  file to decimal on a PC but am struggling. I don't have much experience with bin files and am relatively new to C.

Is there an easy way in something like MATLab or VBA that I can read the bin and convert it to a dececimal?

ARDPrash

I am using this code with Arduino Mega to log data. Specifications are Arduino Mega2560, SD card size 8GB, type SDHC. The sampling frequency is 5000 Hz.

I tried to log some data continuously for one week time. But, the logging process couldn't completed as intended and it left some data for only about two days in "tmp_log.bin" file.

What is the maximum duration of datalogging for the above specified details?

Go Up