Arduino programming accelerometer and storing data in sd car

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
sk22
 
Posts: 5
Joined: Wed Jul 02, 2014 5:17 am

Arduino programming accelerometer and storing data in sd car

Post by sk22 »

I am working on a project that involves getting data from the accelerometer (10,000 data) and storing it in sd card . The Arduino reads the data file from the sd card and performs certain calculation and compare the result with the and the last glow a led if the calculated result is within the limit . I am having problem with the memory here because performing calculation for 10,000 int takes lot of memory .So, any idea on how to do it. Please help me out

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino programming accelerometer and storing data in sd

Post by adafruit_support_bill »

What are you trying to calculate? If you are just looking for minima and maxima, there is no need to keep all 10000 samples in memory.

sk22
 
Posts: 5
Joined: Wed Jul 02, 2014 5:17 am

Re: Arduino programming accelerometer and storing data in sd

Post by sk22 »

i am trying to calculate rms value , kurtosis and mahalanobis distance .Any idea how to proceed

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino programming accelerometer and storing data in sd

Post by adafruit_support_mike »

The solution to use depends on how you define your sample.

You can calculate RMS on the fly if you use a running mean as your reference. It will take some time for the running mean to converge to the sample mean though. You can also calculate RMS relative to a process mean of N samples. The same is true for any descriptive statistics. Doing so gives you some variance from the statistics calculated for the whole data set, which can be good or bad depending on whether the data set contains systematic errors that vary enough to be noticed across the sampling period.

If you want to process the whole data set, you'll probably need to make several passes over the data. You have to chug through all the samples once to get the mean before you can calculate RMS, for instance. Depending on memory and numerical constraints, you might find it easier to create a set of temporary files for partial results.. partitioning the data set into groups of 100 samples, calculating and storing the mean of each partition, then calculating the mean of the partition means.

In general, you can make tradeoffs between speed, storage, and SRAM.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”