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

  • So I got more data.

    1. The number two in the scale value is for 8g mode. If you don't add that, it the values will be wrong.
    2. The scale value has nothing to do with the hitting the limit. When the sensor hits the 8g limit, it starts to flip from -8g to positive 8g value. Don't know why.
    3. The timestep is not always 10ms. Sometimes it is 20 or something else, so I have to save also the timestamp.
    4. If you take the magnitude value, its limit is something around 10,5 g. But if you get the x,y and z value and and calculate the value from that, you can go over that limit(if the x, y or z value don't hit the 8g limit). If the sensors magnitude value hits over 10,5 g, it goes to zero
    5. Got some results and made a video.

      The results look good. I can get really good data.
      Now with this data I can start to build my own "throw" app. Lets see how that will go. I will post results in here.
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Acceleration without gravity

Posted by Avatar for AccMagno @AccMagno

Actions