Simple Accelerometer build

Posted on
  • Hello,
    I am using the Puck.js to just collect accelerometer data over a period of time. So far, I have built some code to collect and store the accelerometer data until the button is pushed. However, the memory is full after just a couple sections, and I am aiming to store accelerometer data over nearly an hour.

    I also want the data to be stored in a csv, ideally a simple downloadable file. I feel like there has to be a way to store the data as it comes in on a separate file, and then delete it off the memory to keep that space open, but I can't find anything about that. Any suggestions?

    1 Attachment

  • As an additional note, this is in conjuction with data we collect at 250 Hz, while this data is not as significant to need that high of a sampling frequency, at least 1 datapoint per second would be necessary.

  • It might be worth looking at­flash-memory for how to store data in flash memory vs RAM. It also comes with an example of how to output the data as CSV.

    If you write a 'minimal' Puck.js build to your Puck (­) you get more free flash memory - I think around 90kB.

    So if you write accelerometer data as 16 bit values so you don't lose any information that's 6 bytes per reading, so 15,000 samples - and there are only 3600 seconds in an hour.

  • Actually, I should add, that example stores the data as a string - and to get the maximum data in there you want in binary.

    So instead of:


    you probably want:

    saveData((new Uint16Array([acc.x, acc.y, acc.z])).buffer);
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Simple Accelerometer build

Posted by Avatar for user155236 @user155236