Skip to content
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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

StarGate01
Copy link
Contributor

@StarGate01 StarGate01 commented May 10, 2022

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.

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.
@d-vogel
Copy link

d-vogel commented Oct 12, 2023

@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 ?

@StarGate01
Copy link
Contributor Author

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 .

@jones139
Copy link
Contributor

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....)

@d-vogel
Copy link

d-vogel commented Jan 11, 2024

@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.

@StarGate01 StarGate01 marked this pull request as draft May 13, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants