Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Reading and storing data


  • Please log in to reply
4 replies to this topic

#1 Moskus

Moskus

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationNorway

Posted 13 September 2011 - 09:13 AM

I want to read and store data from an accelerometer and I'm just wondering what the best practice is, or what the limitations are.
I have this accelerometer, and this is (hopefully soon) on it's way.

I'm just wondering what to do. I could:
  • Try to write data to the SD-card as fast as possible directly from the x, y and z axis.
  • Average the data using one or three threads and store the average value every second or so.
  • Just pull a sample every second or so and store that.
I believe the first method would be best for analysis. I can run some tests and find the best algorithm for reating the data afterwards. However, can it be too much for the SD card, perhaps? Or how fast can the Netduino Plus sample data?

Method three is the easiest to implement, but I could be missing information I'm interessted in.

Method two is the one I'll use eventually, I believe, as it shouldn't be necessary to keep that much data.



If this had been a Windows application, I'd say just store the data and process them later. But on a little more limited hardware I'd like to know what I should do. :)

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 13 September 2011 - 11:38 AM

I'd sample all the axes at the same time, every well-defined interval. That leads you to apply interpolations or something like that over the collected data. Streaming data without any timestamp, IMHO, is pretty useless. Anyway, you should first define how fast the acceleration could vary. For instance, is the sensor for a sport car, or for measuring the vibrations? The contexts are very different. Cheers
Biggest fault of Netduino? It runs by electricity.

#3 Moskus

Moskus

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationNorway

Posted 13 September 2011 - 12:18 PM

I didn't mention timestamp as I thought it was rather obvious to have it. Like you said, data without it is useless! I'll try with different sampling intervals and see what I get. Thanks for your input! :) But I'm still wondering how fast I can write data to the SD card. Is there any limitations?

#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 13 September 2011 - 12:21 PM

I don't think there is a concrete limitation for the SD, being much faster than the program itself. You should consider the life-cycle of the SD, because it is a flash device. There are SDs having an internal management of the cells, so that the MTBF will be greatly improved. I don't know so much about them, though. Cheers
Biggest fault of Netduino? It runs by electricity.

#5 Scott Green

Scott Green

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 13 September 2011 - 05:24 PM

I want to read and store data from an accelerometer and I'm just wondering what the best practice is, or what the limitations are.
I have this accelerometer, and this is (hopefully soon) on it's way.

I'm just wondering what to do. I could:

  • Try to write data to the SD-card as fast as possible directly from the x, y and z axis.
  • Average the data using one or three threads and store the average value every second or so.
  • Just pull a sample every second or so and store that.
I believe the first method would be best for analysis. I can run some tests and find the best algorithm for reating the data afterwards. However, can it be too much for the SD card, perhaps? Or how fast can the Netduino Plus sample data?

Method three is the easiest to implement, but I could be missing information I'm interessted in.

Method two is the one I'll use eventually, I believe, as it shouldn't be necessary to keep that much data.



If this had been a Windows application, I'd say just store the data and process them later. But on a little more limited hardware I'd like to know what I should do. :)



I am doing this exact same thing with my weatherstation project. http://forums.netdui...itor-webserver/

I use the netduino+ to sample the sensors. I have a single "stats" class that contains the values for each of the readings I am taking. So, the main program just calls a class to sample a sensor, gets that reading, and calls a stats class method to update the value for that sensor. In that method, I check to see if the value is higher or lower than my min/max values I have stored. If so, the class updates min and max, and saves a timestamp for min and max.

Every 1 second a thread wakes up and sends the values (via xml) over a socket to a server running on another PC. This server has the same stats class implemented, and it keeps averages every 1 minute, day, hour, week, month, year, and since inception. Every 1 minute a thread in the server wakes up and saves the 1 minute average to an XML log file that I can later pull into excel to do all of the trending that I want.

So, in a nutshell, isolate the main program from the statistical work via a stats class. Have the stats class summarize the data and write it where ever you want to. I chose to do this on a separate PC/Server because I was running low on memory on the netduino, and I want to write a web interface to the weatherstation. Too much work for the netduino+ IMHO.

Hope that helps,
Scott...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.