Use of accelerometer

Posted on
  • Hi,

    I was playing around with the accelerometer data trying to code a tachometer app that computes the inertial speed by integrating acceleration data. But I can't get it to produce a "fluent" value yet.

    Is my understanding correct that the accelerometer works at a fixed 80ms interval? What happens if I change the polling interval with Bangle.setPollInterval() from the default 80ms to say 40ms? How often will the Bangle.on('accel',...) event be triggered and what data will it deliver?

    Also, my impression is that the g.drawString() and g.drawLine() commands take a lot of time and thus may interfere with my velocity calculation. Could that be true?

    Are there any more specs on the accelero that is used, like zero-level drift and stuff like that?

    Thanks.

  • Hi!

    Right now you get a value at 12.5 Hz I believe - you can raise the poll interval but you won't get more data until you reconfigure the accelerometer with Bangle.accelWr.

    The accelerometer itself is the KX023 - more info about internals here as well as a link to the datasheet if you want more specs on the device: https://www.espruino.com/Bangle.js+Techn­ical

    Perhaps a good example of messing with the accelerometer is the acceleration recorder: https://banglejs.com/apps/#accelrec

    Code is here, and it might give you some clues about how to set it up for high speed capture: https://github.com/espruino/BangleApps/b­lob/master/apps/accelrec/app.js#L36

    g.drawString() and g.drawLine() commands take a lot of time

    It depends - they can take a decent amount of time, but in general the JS execution speed isn't great either so that could be hitting you.

  • Ah great, thanks for that...I didn't see the Acceleration Recorder app on the app loader. That will definitely help me. Time to go write some registers :D

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

Use of accelerometer

Posted by Avatar for Sebastian @Sebastian

Actions