Coder Social home page Coder Social logo

mcerebrum-motionsenselib's Introduction

MotionSense Devices

Service Characteristics: 0000180f-0000-1000-8000-00805f9b34fb

Search MotionSense Devices:

  1. Match service uuid (0000180f-0000-1000-8000-00805f9b34fb)
  2. [optional] Match device name: (EETech_Motion, MotionSenseHRV, MotionSenseHRV+, MotionSense2)

Different types of MotionSense devices:

Device Type Sensors Version.Type (if exist) Device Name Configurable
MotionSense (V1) acl+gyro - EETech_Motion -
MotionSense (V2) acl+gyro 0x03 MotionSense2 Yes
MotionSenseHRV (V1) acl+gyro+ppg - MotionSenseHRV -
MotionSenseHRV (V2) acl+gyro+ppg 0x01 MotionSense2 Yes
MotionSenseHRV+ (V1) acl+quaternion+ppg+magnetometer - MotionSenseHRV+ -
MotionSenseHRV+ (V2) acl+gyro+ppg+magnetometer 0x02 MotionSense2 Yes
MotionSenseHRV+Gen2 (Green) acc + Gyro + GREEN PPG new hardware + magnetometer 0x05 MotionSense2 Yes
MotionSenseHRV+Gen2 (Red) acc + Gyro + RED PPG new hardware + magnetometer 0x06 MotionSense2 Yes

Version

1st Generation

Version number is not available. Use the device name to identify the type and version of the device.

2nd Generation

Version number is only available for 2nd generation of MotionSense. The device is advertised as "MotionSense2".

Characteristics (Read Only) Data Size (bytes) Data Format
da39d600-1d81-48e2-9c68-d0ae4bbd351f 4 Major.Minor.Type.Patch
Ex: 4.1.1.18 (MotionSenseHRV_V2)

Configuration

1st Generation: (Not available)
2nd Generation:

Characteristics (read/write): da39d650-1d81-48e2-9c68-d0ae4bbd351f

Command Operation Write Size(bytes) Write Returned Result Size Returned Result
- previously issued valid command with zero-padding to the right 10
0x00 Enable/disable sensors 2 0:0x00
1:0000gmpa
g=1, enable gyro
m=1, enable mag
p=1, enable ppg
a=1, enable acl

Example:
0x00 0x0B: enables gyroscope, ppg and accelerometer sensors
0x00 0x06: enables ppg, disables gyroscope (along with accelerometer and magnetometer)

Note 1: In the current firmware the accelerometer cannot be independently turned on or off. The value in the accelerometer bit field mirrors the value set in Gyroscope bit automatically.

Note 2: The magnetometer can be turned on only if the gyroscope bit is enabled. If the gyroscope bit is 0 then both the magnetometer and accelerometer cannot be turned on by setting the following bits
2 same as what is written
0x01 Configure ppg sensors - Controls the brightness of the LEDs 4 MotionSenseHRV+_V2 (red+ green+infrared)
0: 0x01 (config byte)
1:0-255 (RED)
2: 0-255 (Green)
3: 0-255 (infrared)

MotionSenseHRV+_Gen2 (red+red+infrared/ green+green+infrared
0: 0x01 (config byte)
1:0-255 (RED/GREEN)
2: N/A
3: 0-255 (infrared)

Note: The recommended maximum values for Red/Green channel is 200 and Infrared is 100 expressed in decimal
4 same as what is written
0x02 Change sampling rate (acl/gyro, ppg) 3 0: 0x02(config byte)
1: 1-5 (acl/gyro sampling rate)
2: 0x14/0x28 (ppg sampling rate)

Accelerometer/Gyroscope sampling rate:
0x05(any other value) = 25Hz
0x04 = 50Hz
0x03 = 62.5Hz
0x02 = 125Hz
0x01 = 250Hz

PPG sampling rate:
0x14 = 50Hz
0x28(any other value) = 25Hz

note:The magnetometer sampling rate is fixed to 25Hz and the characteristic packet rate for magnetometer is 12.5 Hz such that the 2 magnetometer samples are packed in the same packet
3 same as what is written
0x03 change sensitivity (acl, gyro) 3 0:0x03 (config byte)
1: 0-3 (gyroscope sensitivity)
2: 0-3 (Accelerometer sensitivity)

Gyroscope sensitivity:
0x00 = ±250 dps
0x01(any other value) = ±500 dps
0x02 = ±1000 dps
0x03 = ±2000 dps

Accelerometer sensitivity:
0x00 = ±2g
0x01(any other value) = ±4g
0x02 = ±8g
0x03 = ±16g
3 same as what is written
0x04
MotionSenseHRV+_V2
Return current configuration and magnetometer sensitivity 2 0:0x04 (config byte)
1:0-1 (configuration type)

0x00: return current running configuration on the same characteristic

0x01: return magnetometer sensitivity on the same characteristic
10 Configuration Type: 0x00 (Current Configuration)
0: 0x00-0xFF (enable/disable sensors)
1: 0-255 (PPG Red)
2: 0-255 (PPG Green)
3: 0-255 (PPG infrared)
4: 1-5 (gyro sampling rate)
5: 0x14/0x28 (PPG sampling rate)
6: 0-3 (gyroscope sensitivity)
7: 0-3 (accelerometer sensitivity)
8: 10-120 (min. connection interval)
9: 0-1 (PPG filter enabled)

Configuration Type: 0x01 (Magnetometer Sensitivity)
0: Hz_sensitivity
1: Hy_sensitivity
2: Hx_sensitivity
3-9: 0
0x04
MotionSenseHRV+_Gen2
Return current configuration 1 0: 0x04 10 0: 0x00-0xFF (enable/disable sensors)
1: 0-255 (PPG Red)
2: 0-255 (PPG Green)
3: 0-255 (PPG infrared)
4: 1-5 (gyro sampling rate)
5: 0x14/0x28 (PPG sampling rate)
6: 0-3 (gyroscope sensitivity)
7: 0-3 (accelerometer sensitivity)
8: 10-120 (min. connection interval)
9: 0-1 (PPG filter enabled)
0x05 Set minimum connection interval 2 0:0x05 (config byte)
1:10-120 (min. connection interval in ms)

Note: Minimum connection interval value should be between 10-120 ms
2 same as what is written
0x06 Set PPG filter 2 0: 0x06 (config byte)
1: 0-1 (enable filter)

Note:
Enable = 0, Disables bandpass filter in hardware and transmits raw values.

Enable = 1, Enables bandpass filter for the PPG signal. Setting this bit also enables the PPG DC characteristic, which computes the DC value of the PPG signal averaged over a window of 40 seconds
2 same as what is written

Default Configuration

Device Enable/Disable Sensor PPG Red PPG Green PPG Infrared Gyroscope Sampling rate PPG Sampling rate Gyroscope Sensitivity Accelerometer Sensitivity Min Connection Interval PPG Filter enabled
MotionSense 0x09 0x3F(X) 0xFF(X) 0x38(X) 5 0x28 (X) 0x01 0x01 0x0A 0
MotionSenseHRV 0x0B 0x3E 0x68 0x14 5 0x28 0x01 0x01 0x0A 0
MotionSenseHRV+ 0x0F 0x3E 0x68 (X) 0x14 5 0x28 0x01 0x01 0x0A 0
MotionSenseHRV+ Gen2 0x0F 0x3E 0x68 (X) 0x14 5 0x28 0x01 0x01 0x0A 0

Packet Format

ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
Device

Sensor

CharacteristicsFrequencyData Size
(in bytes)
Config parameters012345678910111213141516171819
2
MotionSenseAcl, Gyro1,Gyro2, SeqDA39C921-1D81-48E2-9C68-D0AE4BBD351F1620acl_sensitivity=4
gyro_sensitivity=500
16 bit Acl X
2's complement form

acl_x = ((short) ((bytes[0] & 0xff) << 8) | (bytes[1] & 0xff))*acl_sensitivity/32768.0
16 bit Accel Y
2's complement form

acl_y=2.0*((short) ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff))/16384.0
acl_y = ((short) ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff))*acl_sensitivity/32768.0
16 bit Accel Z
2's complement form

acl_z = ((short) ((bytes[4] & 0xff) << 8) | (bytes[5] & 0xff))*acl_sensitivity/32768.0
16 bit Gyro X
2's complement form

gyro_x=((short) ((bytes[6] & 0xff) << 8) | (bytes[7] & 0xff))*gyro_sensitivity/32768.0
16 bit Gyro Y
2's complement form

gyro_y=((short) ((bytes[8] & 0xff) << 8) | (bytes[9] & 0xff))*gyro_sensitivity/32768.0
16 bit Gyro Z
2's complement form

gyro_z=((short) ((bytes[10] & 0xff) << 8) | (bytes[11] & 0xff))*gyro_sensitivity/32768.0
16 bit Gyro X2
2's complement form

gyro_x2=500.0*((short) ((bytes[12] & 0xff) << 8) | (bytes[13] & 0xff))/32768.0
16 bit Gyro Y2
2's complement form

gyro_y2=500.0*((short) ((bytes[14] & 0xff) << 8) | (bytes[15] & 0xff))/32768.0
16 bit Gyro Z2
2's complement form

gyro_z2=500.0*((short) ((bytes[16] & 0xff) << 8) | (bytes[17] & 0xff))/32768.0
Packet Count[16:1]
range: 0-65535

seq = ((data[18] & 0xff) << 8) | (data[19] & 0xff)
3
MotionSenseHRVAcl, Gyro, PPG, Seq1620PPG Red 18 bit: 12[0-7], 13[0-7],14[6-7], red = ((bytes[12] & 0xff)<<10) | ((bytes[13] & 0xff) <<2) | ((bytes[14] & 0xc0)>>6)
PPG Green 18 bit: 14[0-5],15[0-7],16[4-7], green = ((bytes[14] & 0x3f)<<12) | ((bytes[15] & 0xff) <<4) | ((bytes[16] & 0xf0)>>4)
PPG Infrared 18 bit: 16[0-3],17[0-7],18[2-7], infrared = ((bytes[16] & 0x0f)<<14) | ((bytes[17] & 0xff) <<6) | ((bytes[18] & 0xfc)>>2)
Packet Count 10 bit: 18[0-1], 19[0-7], seq = ((byte[18] & 0x03)<<8) | (byte[19] & 0xff)
4
MotionSense_V2
MotionSenseHRV_V2
MotionSenseHRV+_V2
MotionSenseHRV+Gen2
Acl, Gyro, Seq25/50/
62.5/125/
250
14acl_sensitivity = 2/4/8/16
gyro_sensitivity = 250/500/1000/2000
Packet Count[16:1]
range: 0-65535

seq = ((data[18] & 0xff) << 8) | (data[19] & 0xff)
5
MotionSenseHRV+Acl, Quaternion, PPG, Seq2520acl_sensitivity=4
gyro_sensitivity=500
16 bit Quaternion X
q_x= ((short)((bytes[6] & 0xff) << 8) | (bytes[7] & 0xff))*2.0/65535.0-1
16 bit Quaternion Y
q_y = ((short)((bytes[8] & 0xff) << 8) | (bytes[9] & 0xff))*2.0/65535.0-1;
16 bit Quaternion Z
q_z = ((short)((bytes[10] & 0xff) << 8) | (bytes[11] & 0xff))*2.0/65535.0-1
HRV sensor Channel 1[18 : 11]HRV sensor Channel 1[10 : 3]MSB 2 Bits
HRV sensor Channel 1[2 : 1]

Remaining 6 Bits
HRV sensor Channel 2[18 : 13]
HRV sensor Channel 2[12 : 5]MSB 4 Bits
HRV sensor Channel 2[4 : 1]

Remaining 4 Bits
HRV sensor Channel 3[18 : 15]
HRV sensor Channel 3[14 : 7]MSB 6 Bits
HRV sensor Channel 3[6 : 1]

Remaining 2 Bits
Packet Count[10:9]
Packet Count[8:1]
6
MotionSenseHRV_V2
MotionSenseHRV+_V2
PPG, SeqDA39C925-1D81-48E2-9C68-D0AE4BBD351F25/509filter=disabled
7
MotionSenseHRV_V2
MotionSenseHRV+_V2
PPG, SeqDA39C925-1D81-48E2-9C68-D0AE4BBD351F25/5014filter=enabled
8
MotionSenseHRV_V2
MotionSenseHRV+_V2
PPG_DC, SeqDA39C926-1D81-48E2-9C68-D0AE4BBD351F25/5014filter=enabledREDInfraredGreenPacket Count[16:1]
range: 0-65535

seq = ((data[18] & 0xff) << 8) | (data[19] & 0xff)
9
MotionSenseHRV+Gen2PPG, SeqDA39C925-1D81-48E2-9C68-D0AE4BBD351F25/5012filter=disabled
10
MotionSenseHRV+Gen2PPG, SeqDA39C925-1D81-48E2-9C68-D0AE4BBD351F25/5018filter=enabledInfrared 1Infrared 2Green/Red 1Green/Red 2Packet Count[16:1]
range: 0-65535

seq = ((data[16] & 0xff) << 8) | (data[17] & 0xff)
11
MotionSenseHRV+Gen2PPG_DC, SeqDA39C926-1D81-48E2-9C68-D0AE4BBD351F25/5018filter=enabled
12
MotionSenseHRV+Mag, Mag Sensitivity, SeqDA39C924-1D81-48E2-9C68-D0AE4BBD351F12.51716 bit Mag X1
2's complement form

mag_x1 =((short)((bytes[0] & 0xff) << 8) | (bytes[1] & 0xff))*((sen_x-128)*.5/128.0+1)
16 bit Mag X2
2's complement form

mag_x2 = ((short)((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff))*((sen_x-128)*.5/128.0+1);
16 bit Mag Y1
2's complement form

mag_y1 = ((short)((bytes[4] & 0xff) << 8) | (bytes[5] & 0xff))*((sen_y-128)*.5/128.0+1)
16 bit Mag Y2
2's complement form

mag_y2 = ((short)((bytes[6] & 0xff) << 8) | (bytes[7] & 0xff))*((sen_y-128)*.5/128.0+1);
16 bit Mag Z1
2's complement form

mag_z1 = ((short)((bytes[8] & 0xff) << 8) | (bytes[9] & 0xff))*((sen_z-128)*.5/128.0+1)
16 bit Mag Z2
2's complement form

mag_z2 = ((short)((bytes[10] & 0xff) << 8) | (bytes[11] & 0xff))*((sen_z-128)*.5/128.0+1)
Mag sensitivity X
sen_x = bytes[12] & 0xff
Mag sensitivity X
sen_y = bytes[13] & 0xff
Mag sensitivity X
sen_z = bytes[14] & 0xff
Packet Count[16:1]
range: 0-65535

seq = ((data[15] & 0xff) << 8) | (data[16] & 0xff)
13
MotionSenseHRV+_V2Mag, Seq12.514Packet Count[16:1]
range: 0-65535

seq = ((data[12] & 0xff) << 8) | (data[13] & 0xff)
14
MotionSenseHRV+_Gen2Mag, Seq12.51416 bit Mag X1
2's complement form

mag_x1 =((short)((bytes[0] & 0xff) << 8) | (bytes[1] & 0xff))*0.15
16 bit Mag X2
2's complement form

mag_x2 = ((short)((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff))*0.15
16 bit Mag Y1
2's complement form

mag_y1 = ((short)((bytes[4] & 0xff) << 8) | (bytes[5] & 0xff))*0.15
16 bit Mag Y2
2's complement form

mag_y2 = ((short)((bytes[6] & 0xff) << 8) | (bytes[7] & 0xff))*0.15
16 bit Mag Z1
2's complement form

mag_z1 = ((short)((bytes[8] & 0xff) << 8) | (bytes[9] & 0xff))*0.15
16 bit Mag Z2
2's complement form

mag_z2 = ((short)((bytes[10] & 0xff) << 8) | (bytes[11] & 0xff))*0.15
Packet Count[16:1]
range: 0-65535

seq = ((data[12] & 0xff) << 8) | (data[13] & 0xff)
15
16

Click to get the packet format

mcerebrum-motionsenselib's People

Contributors

monowar avatar

Watchers

 avatar James Cloos avatar

Forkers

sameerthereds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.