Documentation
Sensor Agnostic Module for Sensor-Works BluVib P-V-T
roto_bluvibpvt.aar Library for Androidâ„¢
- Version: 1.01
- Author: David Bukowitz
- Created: 11 Nov, 2020
- 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.aar is an Androidâ„¢ library that allows communication with the Sensor-Works BluVib P-V-T bluetooth single-axis acceletometer. The library provides simple commands to scan, connect, collect and post-process the vibration data.
Installation
Follow the steps below to install the roto_bluvibpvt.aar library
- In your projects top bar menu, select >File >New >New Module... A new window will appear, select "Import .JAR/.AAR Package" from the options
- In the new popup window browse and select the roto_bluvibpvt.aar library adn click on "Finish"
- The roto_bluvibpvt library will appear on the right
- in your App build.gradle add the following dependency
...
dependencies {
...
implementation files('libs/roto_bluvibpvt.aar')
}
...
Configuring your project
- Add the ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permits to the Android Manifest
- In your Activity add the permissions request
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rotovibes.sam_modules_test">
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
...
public class MainActivity extends AppCompatActivity {
private static final int PERMISSION_REQUEST_FINE_LOCATION = 1;
private static final int PERMISSION_REQUEST_BACKGROUND_LOCATION = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActivityCompat.requestPermissions(this,new String[]{
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, 1001);
...
Connecting to the Sensor
- Create actions to scan and connect to the bluetooth sensor.
...
//start scanning for the ble sensor
BluVib3_conn.bluvib3_start();
//connect the ble sensor
BluVib3_conn.bluvib3_connect();
...
The output in the log console should display the ID and the calibration value of the connected sensor
Collecting Data
- Once connected to a sensor, send the BluVib_conn.bluvib_collect(int numberSamplesCode, int samplingRateCode) 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.
//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
...
BluVib_conn.bluvib_collect(int numberSamplesCode, int samplingRateCode)
...
The output in the log console should look like this:
Combine this framework with vibEngine.framework to perform signal post-processing and with the vibeFDaD.framework to analize the machine condition. Third party frameworks can also be used to plot and enhance the users interface.
Changelog
See what's new added, changed, fixed, improved or updated in the latest versions.
Version 1.01 (20 Oct, 2021)
- Fixed Bug Fixed
Version 1.0 (11 Nov, 2020)
Initial Release for Androidâ„¢