Acceleration without gravity

Posted on
Page
of 2
Prev
/ 2
  • Now I'm back and started again. I was testing the Acceleration Recorder app and that is good one. It is recording everything with 100hz and it works. I tried even with 400hz, but then the file size got too large and it could not write the csv file ( is there way to see how much space I have?)
    But then I was trying to get it work with 200 hz and it started to give me a error:

     Error: Invalid interval
     at line 1 col 203
    ...;Bangle.setPollInterval(5.0);setTimeo­ut(function(){Bangle.on("accel"...
                                         ^
    

    I did manage try it with 2.5 pollInterval, but suddenly I can't anymore try anything else that 10 ms pollinterval. Any ideas why? Here is the edited part of the code:

    HZ = 200
      //Bangle.accelWr(0x1B,0x03 | 0x40); // 100hz output, ODR/2 filter
      Bangle.accelWr(0x1B,0x04 | 0x40); // 200hz output, ODR/2 filter
      Bangle.accelWr(0x18,0b11110100); // +-8g
      //Bangle.setPollInterval(10); // 100hz input
      Bangle.setPollInterval(5); // 00hz input
      setTimeout(function() {
    
  • double message. skips this

  • is there way to see how much space I have?

    require("Storage").getStats()

    Ideally if you're writing data that fast, you could look at writing binary data - see the second example on https://www.espruino.com/Data+Collection­#flash-memory

    It looks like we don't support a poll interval less than 10ms (100Hz): https://github.com/espruino/Espruino/blo­b/8f3a9cb52/libs/banglejs/jswrap_bangle.­c#L2487

    So you can't do above 100Hz. I'm not sure what happened with 400Hz but maybe it failed with out of memory before it got started.

    The Accelerometer does have a built-in FIFO which we don't actually use at the moment.

    It might be possible to change the Espruino firmware to use it, but also you could probably use accelRd to read the data directly from the FIFO at a much lower level, and then you don't need to change PollInterval at all.

  • Ok. No worries.
    Yeah, I was just wondering how the 400 hz first worked and then not :D
    But the 100hz looks much better than the 12.5 hz. I was just wondering am I missing something with 100hz, what can I only see with 200 or 400hz.
    But I will test with this and will report in here.
    By the way Gordon, thanks for everything. Really nice to have this tool. And thanks for all the effort you put in <3

  • I'm getting now some weird values. Image of values In some point, the x value reverses to positive value from negative. Any ideas why? Something to do with int16Array format?

    And any idea why there is a scale of 5000 and that multiplied with two like in line 27:

    accelx[i] = a.x*SCALE*2;
    
  • The scale is there to ensure that the values which were fractional can be saved in the Uint16Array (which is much more efficient memory-wise). I have no idea why it's 5000 though.

    The strange values will be because you're approaching such high G that the value is going above 32767 (the max range of uint16array) and wrapping over.

    Maybe just try using a smaller number for SCALE and that'll fix it

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Acceleration without gravity

Posted by Avatar for AccMagno @AccMagno

Actions