Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit fb8a263

Browse files
committed
update docs for 1.0.0
1 parent 20b0114 commit fb8a263

File tree

3 files changed

+197
-4
lines changed

3 files changed

+197
-4
lines changed

docs/source/accelerometer.rst

Lines changed: 173 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ necessary. ::
1616

1717
let accType = MetaWear.mbl_mw_metawearboard_lookup_module(device.board, MBL_MW_MODULE_ACCELEROMETER);
1818
switch(accType) {
19+
case MBL_MW_MODULE_ACC_TYPE_BMI270:
20+
// code block
21+
break;
1922
case MBL_MW_MODULE_ACC_TYPE_BMI160:
2023
// code block
2124
break;
@@ -42,7 +45,7 @@ Linear acceleration is represented with the
4245
`MblMwCartesianFloat <https://mbientlab.com/docs/metawear/cpp/latest/structMblMwCartesianFloat.html>`_ struct and the values are in units of Gs. The
4346
``x``, ``y``, and ``z`` fields contain the acceleration in that direction. ::
4447

45-
console.log('Get acc signal.')
48+
console.log('Get acc signal.');
4649
let acc = MetaWear.mbl_mw_acc_get_acceleration_data_signal(device.board);
4750
4851
console.log('Set up stream.')
@@ -52,7 +55,7 @@ Linear acceleration is represented with the
5255
console.log('epoch: ' + data.epoch + ' acc: ' + value.x + ' ' + value.y + ' ' + value.z)
5356
}))
5457
55-
console.log('Start accelerometer.')
58+
console.log('Start accelerometer.');
5659
MetaWear.mbl_mw_acc_enable_acceleration_sampling(device.board);
5760
MetaWear.mbl_mw_acc_start(device.board);
5861

@@ -72,6 +75,153 @@ write the configuration to the sensor. ::
7275
// Write the config to the sensor
7376
MetaWear.mbl_mw_acc_write_acceleration_config(device.board);
7477

78+
Wrist Wear Gestures
79+
---------------------
80+
The BMI270 is designed for Wear OS by GoogleTM7 and features wrist gestures such as flick in/out, push arm down/pivot up, wrist jiggle/shake that help navigate the smartwatch.
81+
82+
See https://support.google.com/wearos/answer/6312406?hl=en
83+
84+
For flick-in detection, the user must slowly turn the wrist away from the body (i.e. roll-out shown with a light-grey arrow in) and then quickly bring it back (i.e. roll-in shown with a darker-black arrow in to its original position.
85+
86+
For flick-out detection, the user must quickly turn the wrist away from the body (i.e. roll-out shown with a darker-black arrow in above picture) and then slowly bring it back (i.e. roll-in shown with a light-grey arrow in above picture) to its original position.
87+
88+
The speed of the roll-out and roll-in movements determine if the user performed a flick-in or a flick-out movement. ::
89+
90+
// Start the accelerometer
91+
MetaWear.mbl_mw_acc_start(device.board);
92+
// Configure
93+
MetaWear.mbl_mw_acc_bmi270_wrist_gesture_armside(device.board, 0); // left arm
94+
MetaWear.mbl_mw_acc_bmi270_write_wrist_gesture_config(device.board);
95+
// Get gesture signal
96+
let gesture_sig = mbl_mw_acc_bmi270_get_wrist_detector_data_signal(device.board);
97+
MetaWear.mbl_mw_datasignal_subscribe(gesture_sig, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => {
98+
var data = pointer.deref();
99+
var value = data.parseValue();
100+
console.log('Activity detected: ' + value); //MblMwBoschGestureType type
101+
}))
102+
// Start detecting motion and turn on acc
103+
MetaWear.mbl_mw_acc_bmi270_enable_wrist_gesture(device.board);
104+
105+
There are config functions for the wrist wear feature: ::
106+
107+
MetaWear.mbl_mw_acc_bmi270_wrist_gesture_peak();
108+
MetaWear.mbl_mw_acc_bmi270_wrist_gesture_samples();
109+
MetaWear.mbl_mw_acc_bmi270_wrist_gesture_duration();
110+
111+
Activity Detector
112+
------------------
113+
The BMI270 can detect simple user activities (unknown, still, walking, running) and can send an interrupt if those are changed, e.g. from walking to running or vice versus. ::
114+
115+
// Start the accelerometer
116+
MetaWear.mbl_mw_acc_start(device.board);
117+
// Get activity signal
118+
let activity_sig = MetaWear.mbl_mw_acc_bmi270_get_activity_detector_data_signal(device.board);
119+
MetaWear.mbl_mw_datasignal_subscribe(activity_sig, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => {
120+
var data = pointer.deref();
121+
var value = data.parseValue();
122+
console.log('Activity detected: ' + value);
123+
}))
124+
// Start detecting motion and turn on acc
125+
MetaWear.mbl_mw_acc_bmi270_enable_activity_detection(device.board);
126+
127+
Wrist Wear Wakeup
128+
----------------------
129+
The BMI270 has a wrist wear wakeup feature that is designed to detect any natural way of user moving the hand to see the watch dial when wearing a classical wrist watch.
130+
131+
The feature is intended to be used as wakeup gesture (i.e. for triggering screen-on or screen-off) in wrist wearable devices.
132+
133+
This feature has dependency on the device orientation in the user system. Implementation of the feature to detect gesture assumes that the sensor co-ordinate frame is aligned with the device/system co- ordinate frame. The assumed default device/system co-ordinate frame is depicted below.
134+
135+
Please refer to `this section <https://mbientlab.com/documents/metawear/cpp/latest/accelerometer__bosch_8h.html#aca2fa97988a33550e20b02c816c6b91f>`_ regarding axis remapping. ::
136+
137+
// Start the accelerometer
138+
MetaWear.mbl_mw_acc_start(device.board);
139+
// Get gesture signal
140+
let wrist_sig = MetaWear.mbl_mw_acc_bmi270_get_wrist_detector_data_signal(board);
141+
MetaWear.mbl_mw_datasignal_subscribe(wrist_sig, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => {
142+
var data = pointer.deref();
143+
var value = data.parseValue();
144+
console.log('Gesture detected: ' + value); //MblMwBoschGestureType type
145+
}))
146+
// Start detecting motion and turn on acc
147+
MetaWear.mbl_mw_acc_bmi270_enable_wrist_wakeup(board);
148+
149+
There are config functions for the wrist wear feature: ::
150+
151+
MetaWear.mbl_mw_acc_bmi270_wrist_wakeup_angle_focus();
152+
MetaWear.mbl_mw_acc_bmi270_wrist_wakeup_angle_nonfocus();
153+
MetaWear.mbl_mw_acc_bmi270_wrist_wakeup_tilt_lr();
154+
MetaWear.mbl_mw_acc_bmi270_wrist_wakeup_tilt_ll();
155+
MetaWear.mbl_mw_acc_bmi270_wrist_wakeup_tilt_pd();
156+
MetaWear.mbl_mw_acc_bmi270_wrist_wakeup_tilt_pu();
157+
158+
Motion Detector
159+
----------------
160+
The BMI270 can detect significant motion (android motion), any motion (high acc motion) or no motion. The accelerometer must be at least running at 25Hz.
161+
162+
Detect Any Motion
163+
^^^^^^^^^^^^^^^^^^^
164+
The anymotion detection uses the slope between two acceleration signals to detect changes in motion. ::
165+
166+
// Start the accelerometer
167+
MetaWear.mbl_mw_acc_start(device.board);
168+
// Set any motion config - acc must be on for this
169+
MetaWear.mbl_mw_acc_bosch_set_any_motion_count(device.board, 5);
170+
MetaWear.mbl_mw_acc_bosch_set_any_motion_threshold(device.board, 170.0);
171+
MetaWear.mbl_mw_acc_bosch_write_motion_config(board, MBL_MW_ACC_BOSCH_MOTION_ANYMOTION);
172+
// Get any motion signal
173+
let any_motion = MetaWear.mbl_mw_acc_bosch_get_motion_data_signal(device.board);
174+
MetaWear.mbl_mw_datasignal_subscribe(any_motion, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => {
175+
var data = pointer.deref();
176+
var value = data.parseValue();
177+
console.log('Any motion detected: ' + value);
178+
}))
179+
// Start detecting motion
180+
MetaWear.mbl_mw_acc_bosch_enable_motion_detection(device.board, MBL_MW_ACC_BOSCH_MOTION_ANYMOTION);
181+
182+
Detect No Motion
183+
^^^^^^^^^^^^^^^^^^^
184+
The nomotion detection can detect when there is no motion for a certain amount of time. ::
185+
186+
// Start the accelerometer
187+
MetaWear.mbl_mw_acc_start(device.board);
188+
// Set any motion config - acc must be on for this
189+
MetaWear.mbl_mw_acc_bosch_set_no_motion_count(device.board, 5);
190+
MetaWear.mbl_mw_acc_bosch_set_no_motion_threshold(device.board, 144.0);
191+
MetaWear.mbl_mw_acc_bosch_write_motion_config(device.board, MBL_MW_ACC_BOSCH_MOTION_NOMOTION);
192+
// Get any motion signal
193+
let no_motion = MetaWear.mbl_mw_acc_bosch_get_motion_data_signal(device.board);
194+
MetaWear.mbl_mw_datasignal_subscribe(sig_motion, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => {
195+
var data = pointer.deref();
196+
var value = data.parseValue();
197+
console.log('No motion detected: ' + value);
198+
}))
199+
// Start detecting motion and turn on acc
200+
MetaWear.mbl_mw_acc_bosch_enable_motion_detection(device.board, MBL_MW_ACC_BOSCH_MOTION_NOMOTION);
201+
202+
Detect Significant Motion
203+
^^^^^^^^^^^^^^^^^^^^^^^^^^
204+
The significant motion interrupt implements the interrupt required for motion detection in Android 4.3 and greater: https://source.android.com/devices/sensors/sensor-types.html#significant_motion.
205+
A significant motion is a motion due to a change in the user location.
206+
207+
Examples of such significant motions are walking or biking, sitting in a moving car, coach or train, etc.
208+
Examples of situations that does typically not trigger significant motion include phone in pocket and person is stationary or phone is at rest on a table which is in normal office use. . ::
209+
210+
// Start the accelerometer
211+
MetaWear.mbl_mw_acc_start(device.board);
212+
// Set any motion config - acc must be on for this
213+
MetaWear.mbl_mw_acc_bosch_set_sig_motion_blocksize(device.board, 250);
214+
MetaWear.mbl_mw_acc_bosch_write_motion_config(device.board, MBL_MW_ACC_BOSCH_MOTION_SIGMOTION);
215+
// Get any motion signal
216+
let sig_motion = MetaWear.mbl_mw_acc_bosch_get_motion_data_signal(device.board);
217+
MetaWear.mbl_mw_datasignal_subscribe(sig_motion, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => {
218+
var data = pointer.deref();
219+
var value = data.parseValue();
220+
console.log('Sig motion detected: ' + value);
221+
}))
222+
// Start detecting motion and turn on acc
223+
MetaWear.mbl_mw_acc_bosch_enable_motion_detection(device.board, MBL_MW_ACC_BOSCH_MOTION_SIGMOTION);
224+
75225
High Frequency Stream
76226
^^^^^^^^^^^^^^^^^^^^^
77227
Firmware v1.2.3+ contains a packed mode for the accelerometer which combines 3 acceleration data samples into 1 ble packet allowing the board to
@@ -114,6 +264,8 @@ When you have set the operation mode, call
114264
MetaWear.mbl_mw_acc_bmi160_set_step_counter_mode(device.board, MBL_MW_ACC_BMI160_STEP_COUNTER_MODE_SENSITIVE);
115265
MetaWear.mbl_mw_acc_bmi160_write_step_counter_config(device.board);
116266

267+
The BMI270 accelerometer does not support step counter modes.
268+
117269
Reading The Counter
118270
^^^^^^^^^^^^^^^^^^^
119271
One way to retrieve step counts is to periodcally read the step counter. To read the step counter, call
@@ -140,6 +292,8 @@ The counter is not enabled by default so you will need enable it by calling
140292
MetaWear.mbl_mw_acc_start(device.board);
141293
MetaWear.mbl_mw_datasignal_read(signal);
142294

295+
For the BMI270, you can call `mbl_mw_acc_bmi270_enable_step_counter <https://mbientlab.com/documents/metawear/cpp/latest/accelerometer__bosch_8h.html#a48e850d6bdb4b7084c735885465fc1c7>`_ when configuring the board.
296+
143297
Using The Detector
144298
^^^^^^^^^^^^^^^^^^
145299
Alternatively, you can receive notifications for each step detected by calling
@@ -156,12 +310,28 @@ Alternatively, you can receive notifications for each step detected by calling
156310
MetaWear.mbl_mw_acc_bmi160_enable_step_detector(device.board);
157311
MetaWear.mbl_mw_acc_start(device.board);
158312

313+
For the BMI270, the detector will not send notifications every step but instead every 20*X steps: ::
314+
315+
MetaWear.mbl_mw_acc_start(device.board);
316+
// Write the trigger for the step counter
317+
MetaWear.mbl_mw_acc_bmi270_set_step_counter_trigger(device.board, 1); //every 20 steps
318+
MetaWear.mbl_mw_acc_bmi270_write_step_counter_config(device.board);
319+
// Reset the counter
320+
MetaWear.mbl_mw_acc_bmi270_reset_step_counter(board);
321+
// Get the step signal
322+
let detector = MetaWear.mbl_mw_acc_bmi270_get_step_detector_data_signal(device.board);
323+
MetaWear.mbl_mw_datasignal_subscribe(detector, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => {
324+
console.log('Another 20 steps detected');
325+
}))
326+
// Start detecting motion and turn on acc
327+
MetaWear.mbl_mw_acc_bmi270_enable_step_counter(device.board);
328+
159329
Orientation Detection
160330
---------------------
161331
The orientation detector alerts you when the sensor's orientation changes between portrait/landscape and front/back. Data is represented as an
162332
`MblMwSensorOrientation <https://mbientlab.com/docs/metawear/cpp/0/types_8h.html#a2e83167b55d36e1d48d100f342ad529c>`_ enum.
163333

164-
This feature is currently only supported on devices using the BMI160 or BMA255 accelerometers.
334+
This feature is currently only supported on devices using the BMI160 or BMA255 accelerometers. It is not supported on the BMI270.
165335

166336
::
167337

docs/source/logging.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ Once we are done logging, simply call: ::
1515

1616
MetaWear.mbl_mw_logging_stop(device.board);
1717

18+
Note for the MMS
19+
----------------
20+
The MMS (MetaMotionS) board uses NAND flash memory to store data on the device itself. The NAND memory stores data in pages that are 512 entries large. When data is retrieved, it is retrieved in page sized chunks.
21+
22+
Before doing a full download of the log memory on the MMS, the final set of data needs to be written to the NAND flash before it can be downloaded as a page. To do this, you must call the function: ::
23+
24+
MetaWear.mbl_mw_logging_flush_page(device.board);
25+
26+
This should not be called if you are still logging data.
27+
1828
Downloading Data
1929
----------------
2030
When you are ready to retrieve the data, execute

docs/source/settings.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,18 @@ Changing connection parameters is not guaranteed to work; Apple only accepts 15m
6262
A more detailed explanation of about BTLE connection parameters can be found on this
6363
`post <https://devzone.nordicsemi.com/question/60/what-is-connection-parameters/>`_ from the Nordic Developer Zone forums. ::
6464

65-
MetaWear.mbl_mw_settings_set_connection_parameters(board, 10.0, 1024.0, 0, 6000);
65+
MetaWear.mbl_mw_settings_set_connection_parameters(device.board, 10.0, 1024.0, 0, 6000);
6666

67+
MMS 3V Regulator
68+
---------------------
69+
The MMS (MetaMotion) board has a 3V regulator that can be turned on and off for IOs.
70+
71+
It is automatically turned on to power the coin vibration motor (if there is one attached), the ambient light sensor, and the LED.
72+
73+
However, if you have an external peripheral on the IOs that needs 3V power (such as a buzzer or UV sensor), you can use this function to turn on the power: ::
74+
75+
MetaWear.mbl_mw_settings_enable_3V_regulator(device.board, 1);
76+
77+
And to turn it off: ::
78+
79+
MetaWear.mbl_mw_settings_enable_3V_regulator(device.board, 0);

0 commit comments

Comments
 (0)