Documentation
Sensor Agnostic Module for Sensor-Works BluVib P-V-T
roto_bluvibpvt.framework for iOS®/iPadOS®
- Version: 1.01
- Author: David Bukowitz
- Created: 5 May, 2021
- Update: 20 Oct, 2021
If you have any questions that are beyond the scope of this help file, Please feel free to email via info@rotovibes.com
Description
roto_bluvibpvt framework is an iOS®/iPadOS® library that allows communication with the Sensor-Works BluVib P-V-T bluetooth single-axis acceletometer. The framework provides simple commands to scan, connect, collect and post-process the vibration data.
Installation
Follow the steps below to install the roto-bluvibmvt3 framework
- Drag and drop the roto_bluvib.framework file into your Xcode project
- Select the "Embed & Sign" option in the Framworks, Libraries and Embedded Content menu
Configuring your project
- Add the bluetooth usage key "NSBluetoothAlwaysUsageDescription" to the info plist and enter your customized value string
- Import the roto_bluvib.framework to your project class
#import "ViewController.h"
#import "roto_bluvibpvt/roto_bluvib.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
Connecting to the Sensor
- Create an action to scan the bluetooth sensors and add the scanBleSensor function.
- Request the available sensors periphearl info using (NSMutableArray*)getListOfSensor function. This will return an array of CBPeripheral.
- Connect to a specific sensor by sending the selected peripheral Id using: connectToSensorId: (CBPeripheral*)sensorId. Pass the object from the previous sensor array list to this command
...
- (IBAction) scanBleSensor {
[roto_bluvib scanBleSensor];
}
The output in the log console should display:
...
- (IBAction) scanBleSensor {
[roto_bluvib scanBleSensor];
}
- (IBAction) getListOfSensor {
NSLog(@"ListOfSensor: %@", [roto_bluvib getListOfSensor]);
}
The output in the log console should display:
...
- (IBAction) getListOfSensor {
NSLog(@"ListOfSensor: %@", [roto_bluvib getListOfSensor]);
}
- (IBAction) connectToSensorId {
[roto_bluvib connectToSensorId:[[roto_bluvib getListOfSensor] objectAtIndex:yourSelectedPeripheralId]];
}
The output in the log console should display:
Collecting Data
- Once connected to a sensor, send the getDataWithSamplingRate: (int)samplingRate numberOfSamples:(int)numberOfSample command to collect data with the specific number of samples and sampling rate. There are 6 sampling rates and 7 number of samples options in this sensor. Use (int)samplingRateCode:(int)samplingRateCode and (int)numberSamplesCode:(int)NumberSamplesCode to return the actual number of samples and sampling rate.
- Use (bool)didFinishMeasuring to check if data collection is completed. Use the getOverallRmsAcc, getOverallRmsAcc and getOverallRmsAcc to return the Acceleration Overall, Velocity Overall and Raw Data Arrays repectively. Note: Data returned wil be for 1 Axis.
//samplingRateCode:0 -> SamplingRate = 512
//samplingRateCode:1 -> SamplingRate = 1280
//samplingRateCode:2 -> SamplingRate = 2560
//samplingRateCode:3 -> SamplingRate = 5120
//samplingRateCode:4 -> SamplingRate = 12800
//samplingRateCode:5 -> SamplingRate = 25600
//numberSamplesCode:0 -> NumberOfSamples = 512
//numberSamplesCode:1 -> NumberOfSamples = 1024
//numberSamplesCode:2 -> NumberOfSamples = 2048
//numberSamplesCode:3 -> NumberOfSamples = 4096
//numberSamplesCode:4 -> NumberOfSamples = 8192
//numberSamplesCode:5 -> NumberOfSamples = 16384
//numberSamplesCode:6 -> NumberOfSamples = 32768
...
- (IBAction) connectToSensorId {
[roto_bluvib connectToSensorId:[[roto_bluvib getListOfSensor] objectAtIndex:yourSelectedPeripheralId]];
}
- (IBAction) getDataWithParamters {
[roto_bluvib getDataWithSamplingRate:2 numberOfSamples:2];
NSLog(@"NumSamples: %i", [roto_bluvib numberSamplesCode:2]);
NSLog(@"SampRate: %i", [roto_bluvib samplingRateCode:2]);
}
The output in the log console should display:
...
- (IBAction) getOVerallRmsGs {
if ([roto_bluvib didFinishMeasuring]) {
NSLog(@"Overall Acc: %g", [roto_bluvib getOverallRmsAcc]);
NSLog(@"Overall Vel: %g", [roto_bluvib getOverallRmsVel]);
NSLog(@"Raw Data: %@", [roto_bluvib getsignalRawData]);
}
}
The output in the log console should display:
Changelog
See what's new added, changed, fixed, improved or updated in the latest versions.
Version 1.01 (20 Oct, 2021)
- Updated Optimized for iOS®ƒios15
Version 1.0 (5 June, 2021)
Initial Release