-
-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Motion: Expose acceleration FIFO via BLE #1133
base: main
Are you sure you want to change the base?
Conversation
b5e14ac
to
9f52b88
Compare
a7b240e
to
80d2d4d
Compare
c84a243
to
5d88128
Compare
The AccelerationSensor base class provides a unified interface to access both the BMA421 as well as the SC7A20 chip.
The FIFO buffer is used as well
The DRIVER_ACC configuration variable can be used to select the acceleration sensor driver to be used.
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.
eb5ac72
to
7a67517
Compare
@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). As for the implementation, maybe having an on-screen switch on the watch to toggle broadcast ? |
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 |
@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 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. |
This PR has been broken out of #1050, and depends on / includes #1132 (which includes #1128).
This PR does not work for the BMA421 without #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.