Vsens Sofware Design Document
Vsens Sofware Design Document
Vsens Sofware Design Document
Document
Date Comments Author Reviewers
04-5-2019 Added vSens generic sensor architecture Vijaylakshmi K Chethan S
different layers
17-05-2019 Added Packet Information and Parsing logic
31-05-2019 Feasibility Check for wired vibration sensor. Vishwanath G G Chethan S
08-07-2019 Configuration Packet details Vijaylakshmi K Chethan S
25-07-2019 Moved vSens generic information to Vijaylakshmi K
corresponding section
24-05-2021 Added Analytics configuration and data packet Vamshi Krishna Chethan S
formats
22-10-2021 Described accelerometer & velocity RMS packet Vijaylakshmi K Chethan S
structure
Abbreviations
Abbreviations Description
CC Connected Continuous
UUID Universally Unique Identifier
BLE Bluetooth Low Energy
BIST Built-In Self test
POR Power On Reset
BLE Bluetooth Low Energy
BI Burst Interval
BD Burst Duration
Abbreviations..............................................................................................................................................1
1 Introduction........................................................................................................................................4
2 vSens Advertising Packet Information................................................................................................4
2.1 Accelerometer Data.........................................................................................................................5
2.2 EPOCH timestamp Parser:...............................................................................................................6
2.3 Accelerometer Data Parser:.............................................................................................................7
2.4 Calculate Timestamp for each sample.............................................................................................8
2.5 Temperature Data...........................................................................................................................8
2.6 Battery Data.....................................................................................................................................9
3 Feasibility Check for Wired Vibration Sensor...................................................................................11
3.1 Block Diagram with Wired Sensor Approach.................................................................................11
3.2 Hardware (Wired Vibration Sensor)...............................................................................................11
3.3 Software (Wired Vibration Sensor)................................................................................................12
4 Generic Sensor Architecture.............................................................................................................13
5 Generic Configuration Packet Details...............................................................................................15
5.1 vSens Product................................................................................................................................16
5.2 Accelerometer...............................................................................................................................16
5.2.1 Sensor Configuration.........................................................................................................17
5.2.2 Sampling Frequency...........................................................................................................17
5.2.3 Range.................................................................................................................................17
5.2.4 Accelerometer offset Operation........................................................................................17
5.3 Temperature..................................................................................................................................17
5.3.1 Sensor Configuration.........................................................................................................18
5.3.2 Read Rate...........................................................................................................................18
5.3.3 Thresholds.........................................................................................................................18
5.4 Battery...........................................................................................................................................19
5.4.1 Read Rate...........................................................................................................................19
Header
Byte Name Value
1 Length of this Data 0x02
2 Advertisement type flag. General Discoverable mode 0x01
Data
Explained under each p acket Identifier
Packet Identifier Types
Different data packets are advertised.
Sl Packet Data Data type Description
No
Note-If all 3 axis sample value is 0x00, which indicates no accelerometer sample.
Example –If byte number from 26 to 31 received values is 0x00 which indicates no accelerometer
sample.
And Apply 2’s compliment on the results of above calculation to obtain signed values.
4. Calculate Sample_Timestamp.
* Apply the formula:
- sample_timestamp = packet_timestamp + (Sampling Seconds * (sample number -1)).
Sample number: Indicates the position of the sample from 3 samples which are available in
Accelerometer packet
* This will give the time of when each sample was obtained.
For ex: Let’s consider the sample accelerometer packet:
0201061BFF0F5CD4015F09010069FA673F2A04F5FA8A3F4404E9FAA93E2904
For first sample time stamp would be 1557397855
Softwar
e Layer Software Details Sensor-Accelerometer Sensor -Temperature
Name
OnPor()
All sensor’s BLE sensor
layer OnPor() function is called here
OnBleInit()
Initialize the BLE GAP & GATT services
All sensor’s BLE Sensor layer OnBleInit() function is called
OnAdvertisement()
Reconfigure & start BI clock
OnEvent()
typedef
{ 1. OnBroadcastEvent()
OnPor, Fetch sensor data & store it in a advert buffer
OnBleInit, Broadcast data
OnAdvertisement, 2. BIEvent()
OnEvent, Call accelerometer & temp’s OnEventPost(GAP)
App
OnConnect, Enable Broadcast clock
OnbleCfgParamWrite, 3. OnConnectSensorEvent()
OnSubscribe, All sensor’s BLE sensor
ConnectedSensorEvent layer OnEventPost(GATT) function is called here
OnDisconnect
}t_appl; OnConnect()
ResetGlobalVar()
OnBleCfgParamWrite()
All sensor’s BLE sensor
layer OnbleCfgParamWrite functions are called here
OnSubscribe()
Based on request start the sensors
OnDisconnect()
All sensor’s BLE sensor
layer OnDisconnect functions are called here
OnBleCfgParamWrite()
Update acc cfg global variables
OnEventPost(GATT)
4. WaterMark
Gap Role Profile state –Connected
OnConnectWmIntr
ReadAccelDataFromFifo()
Form & send the packet using BLE data uuid OnSubscribe
call back function. Start Tmp read clock based on
the request
OnEventPost(GAP)
OnBleCfgParamWrite ()
OnSubscribe, 5. WaterMark Update tmp global cfg variables
OnEventPost Gap Role Profile state –Advertisement & reconfigure tmp read rate clock
OnbleCfgParamWrite, OnAdvertismentWmIntr
OnDisconnect ReadAccelDataFromFifo() OnEventPost()
}t_BleSensorApp; Update total number of samples generated Event-Tmp read rate clock
ConfigAccelerometer(Disable) ReadTmpData()
.
Update Global tmp Global
6. BI Clock variables
OnBurstIntervalEvent()
ConfigAccelerometer(Enable) OnDisconnect()
Disable tmp read rate clock
7. Two Second Clock
BroadcastEvent()
Load acc data & broadcast
8. BMAInterAcitivity Clock
CheckBmaActivity()-Does
ConfigAccelerometer(Enable)
OnConnect()
EnableClock BMAInterAcitivity
OnDisconnect()
Close the flash
ConfigAccelerometer(Disable)
Disable BMA interrupt activity clocks
Configuration packet has the configuration information in it. The configuration information has
the following structure,
Byte 1 2 3 4 5 6
Numb
er
Field Sensor Configuration Configuration Configuration Configuration Configuration
ID ID{Mapped to Data Byte-1 Data Byte-2 Data Byte-3 Data Byte-4
configuration
of sensor}
Byte 1 2 3 4 5 6
Number
Field Sensor Configuration Configuration Configuration Data Configuration Configuration
ID ID{Mapped Data Byte-1 Byte-2 Data Byte-3 Data Byte-4
to
configuration
of sensor}
Device 0x01 1-Burst NA NA NA
Mode 2-
Continuous
BI 0x02 Minutes NA NA NA
BD 0x01 0x03 <*Value> NA NA NA
Time 0x04 EPOCH time EPOCH time EPOCH time EPOCH time
stamp byte stamp byte 2 stamp byte 1 stamp byte 0
3
Device 0x05 0– Active NA NA NA
status 1 – Sleep
Data Type 0x06 1 - Raw Data NA NA NA
2 - Analytics
Data
*TBD
5.2 Accelerometer
Byte Number 1 2 3 4 5 6
Field Sensor Configuration Configuration Configuration Configuration Configuration
ID ID{Mapped Data Byte-1 Data Byte-2 Data Byte-3 Data Byte-4
to
configuration
of sensor}
Sensor Config 0x01 <MSB Byte> <LSB Byte> NA NA
NA-Contains 0x00
0x01 0.78125
0x02 1.5625
0x03 3.125
0x04 6.25
0x05 12.5
0x06 25
0x07 50
0x08 100
0x09 200
0x0a 400
0x0b 800
0x0c 1600
5.2.3 Range
Cfg Data Byte1 Range
0 2G
1 4G
2 8G
3 16G
5.3 Temperature
Byte Number 1 2 3 4 5 6
Field Sensor Configuration Configuration Configuration Configuration Configuration
Cfg Description
Byte1
1-255 Min
5.3.3 Thresholds
Cfg Data Byte1 Cfg Data Byte2 Cfg Data Byte3 Cfg Data Byte4
Different Alert Warning temperature Critical temperature Fatal temperature
Enable/disable value value value
Alert Description
Value
0 alert is disabled
1 warning alert is enabled
2 critical alert is enabled
3 fatal alert is enabled
If user don’t want to monitor any of the above levels then app has to intimate sensor tag with
Alert = 0x00. The Android App takes care of following condition while user enters the
5.4 Battery
Byte 1 2 3 4 5 6
Number
Field Sensor Configuration Configuration Configuration Data Configuration Configuration
ID ID{Mapped Data Byte-1 Byte-2 Data Byte-3 Data Byte-4
to
configuration
of sensor}
Read Rate 0x01 Cfg Data 0 0 0
0x04 Byte1
Thresholds 0x02 Cfg Data Cfg Data Byte2 0 0
Byte1
5.4.2 Thresholds
Cfg Data Byte1 Cfg Data Byte2
Alert Threshold
Enable/Disable
0x00-Disable *64-99%
0x01-Enable
*Critical threshold value is 65%, which is not configurable from the application.
5.5 Analytics
Byte Number 1 2 3 4 5 6
Field Sensor Configuration Configuration Configuration Configuration Configuration
ID ID {Mapped Data Byte-1 Data Byte-2 Data Byte-3 Data Byte-4
to
configuration
of sensor}
FFT Enabled 0x01 Cfg Data 0 0 0
Byte1
Acceleromete 0x02 Cfg Data 0 0 0
r RMS Enabled Byte1
Velocity RMS 0x05 0x03 Cfg Data 0 0 0
Enabled Byte1
FFT window 0x04 Cfg Data 0 0 0
FFT enabled
Cfg Description
Byte1
5.5.4 Averaging
Cfg Description
Byte1
0x00 No averaging
0x01 2 FFT windows
Type Of Data
Sensor Data Packet
ID
0x02
Accelerometer
Data
Temperature 0x03
Data
Battery Data 0x04
Accelerometer 0x05
Offset result
6.1 Accelerometer
6.2 Temperature
Byte 1 2 3 4 5-244
Numbe
r
Brief Data Packet Alert Data NA
Packet Count 1
ID
Byte 1 2 3 4 5-244
Numbe
r
Brief Data Packet Alert Data NA
Packet Count 1
ID
Byte 1 2 3--244
Numbe
r
Brief Data Offset NA
Packet Correction
ID Operation
Status
Byte 14 15 16-244
Numbe
r
Brief Axis FFT FFT
sample Data
count
FFT sample count- Number of FFT samples being sent in the packet
Note: Gateway Packet structure is not yet finalized regarding the flag, it can be either a flag added from
the gateway or FFT packet could have entirely different Packet ID based on if RMS is enabled or no.
In NCB analytics mode there are 2 packet types information and data packet.
Information packet is sent once a burst and for 1 minute duration and it has only metadata
information.
Metadata size=4
Packet payload size 22, ie 11 FFT samples.