InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Motion: Expose acceleration FIFO via BLE

Open StarGate01 opened this issue 2 years ago • 4 comments

This PR has been broken out of https://github.com/InfiniTimeOrg/InfiniTime/pull/1050, and depends on / includes https://github.com/InfiniTimeOrg/InfiniTime/pull/1132 (which includes https://github.com/InfiniTimeOrg/InfiniTime/pull/1128).

This PR does not work for the BMA421 without https://github.com/InfiniTimeOrg/InfiniTime/pull/1145 .

The motion BLE service now broadcasts the entire FIFO buffer, in order to expose a higher frequency measurement. A high enough MTU has to be negotiated to fit all max. 192 bytes. The format is backwards-compatible.

The internal sensor query rate and BLE notification rate is unchanged at 100 ms. The FIFO buffer fits about 20 samples per cycle.

An example Android app which uses this high frequency data can be found at https://github.com/StarGate01/PineTimeAcc .

At the moment, the broadcast is always active, even if the screen is off. However, data is only sent via BLE if there are active notification listeners registered on the motion data service. This means that no power is wasted sending acceleration data if no host is actively listening. I am open for suggestions regarding this behavior.

StarGate01 avatar May 10 '22 22:05 StarGate01

@FintasticMan @JF002, does this have any chance to be accepted ? I'm evaluating the PineTime for acceleration recording for research on neurological movement disorder. The ability to stream raw acc data is a must for us (not easy with other watch/bands on the market). I would like to propose the evaluation of the PineTime as acceleration capture devices to students in a small project starting next month.

As for the implementation, maybe having an on-screen switch on the watch to toggle broadcast ?

d-vogel avatar Oct 12 '23 12:10 d-vogel

Hi @d-vogel that sounds like an interesting project! My PRs here are a bit old, but I plan to update them to the latest release eventually. If you need tips regarding the pactches or the Android app let me know here or via Matrix at @stargate01:matrix.org .

StarGate01 avatar Oct 23 '23 14:10 StarGate01

I'm evaluating the PineTime for acceleration recording for research on neurological movement disorder. The ability to stream raw acc data is a must for us (not easy with other watch/bands on the market). I would like to propose the evaluation of the PineTime as acceleration capture devices to students in a small project starting next month.

@d-vogel, this is probably a bit late for you now, but my OpenSeizureDetector project uses Garmin watches to send accelerometer and heart rate data to an Android phone at the moment, and we have it working on a BangleJS watch too. I am hoping to get it working on PineTime over the next few days using bits of this pull request (I thought I had it this evening, but suddenly started getting memory overrun errors during the build, so will have to have another go tomorrow....)

jones139 avatar Jan 10 '24 23:01 jones139

@jones139 Very cool ! That's a good base for us ! I did not know about the BangleJS. Unfortunately no student picked the project so it did not progress on our side.

d-vogel avatar Jan 11 '24 12:01 d-vogel