BT-350 Documentation

6. Sensor Control

6.1. Sensor control summary

This section provides a list of the sensors available in the BT-350. You can acquire the values for each sensor in the same way as for a general sensor by using the standard Android API.
When you can not use sensor type, you can also specify the value of sensor ID directly. Also, if an unresolved situation of the source code occurs, you can also solve it the method of 2.5.2 Reference: If you get an unsolved situations in Android Studio.
Please calibrate the sensor before use.

6.1.1. Sensor list

Table 6-1 Sensor list
Sensor type Sensor ID (Hex) Contents Built-in location Android Standard
TYPE_ACCELEROMETER 0x00000001 Accelerometer Headset
TYPE_MAGNETIC_FIELD 0x00000002 Geomagnetic sensor Headset
TYPE_ORIENTATION 0x00000003 Azimuth detection Headset
TYPE_GYROSCOPE 0x00000004 Gyroscope sensor Headset
TYPE_LIGHT 0x00000005 Illumination sensor Headset
TYPE_TEMPERATURE 0x00000007 Temperature sensor Headset
TYPE_GRAVITY 0x00000009 Gravity sensor Headset
TYPE_LINEAR_ACCELERATION 0x0000000a Linear acceleration sensor Headset
TYPE_ROTATION_VECTOR 0x0000000b Rotation vector sensor Headset
TYPE_MAGNETIC_FIELD_UNCALIBRATED 0x0000000e Geomagnetic sensor Headset
TYPE_HEADSET_TAP 0x00002001 Tap detector Headset  
TYPE_CONTROLLER_ACCELEROMETER 0x00100001 Accelerometer Controller  
TYPE_CONTROLLER_MAGNETIC_FIELD 0x00100002 Geomagnetic sensor Controller  
TYPE_CONTROLLER_GYROSCOPE 0x00100004 Gyroscope sensor Controller  
TYPE_CONTROLLER_ROTATION_VECTOR 0x0010000b Rotation vector sensor Controller  

* You can use the sensors in the headset and the controller at the same time. There is no real limit to the number of sensors that can be used at the same time, but we recommend that the listener only registers necessary sensors to prevent a decline in performance.

* TYPE_ROTATION_VECTOR algorithm has been changed in the system software R1.3.0.
Please specify 0x00002005 as sensor ID to use TYPE_ROTATION_VECTOR which was implemented in system software prior to R1.3.0.

6.1.2. Coordinations axis for each sensor

From the sensors built into the headset and controller, a sensor value is output for each sensor with an X, Y, Z axis according to the coordinate axis shown in the following figure.

6.1.3. Sensor calibration function

A magnetic sensor and gyroscope sensor of BT-350 is calibrated as shown below. When you use BT-350 first time or after initializing the device to factory default state, it is needed a sensor calibration.
If sensor is used in application software, the calibration of the sensors is automatically done and the calibration data is saved into the system. Therefore, it is not necessary to perform calibration every time.

How to calibrate the sensor

Sensors are located both a headset and a controller. Sensor calibration must be done by each location. And that, the acceleration, gyroscope, and magnetic sensor must be performed at the same time.
Please follow below instructions with registering all sensors (SensorManager.registerListener).

  1. Calibration of magnetic sensor

    Please move headset as drawing infinity sign ten times under running the application software. The direction of the headset or controller changes depending on movement of the hand. Moving hand low and up, the direction of the device turns over.
    When doing this operation, please pay attention to surroundings.

  2. Calibration of gyroscope sensor

    Please leave the headset or controller for more than 1 second on a stable horizontal table without vibration.

    Be sure to unregister the listener (SensorManager.unregisterListener) within the application after the operation is completed. If listener release is not carried out, calibration data will not be saved in the device.

6.2. Using the sensors

The sensors use the standard Android API, SensorEventListener

6.2.1. Import module

To use the sensors, import the following modules

  • android.hardware.Sensor
  • android.hardware.SensorEvent
  • android.hardware.SensorEventListener

6.2.2. Using SensorEventListener

It is necessary to implement SensorEventListener for sensors using Activity or Service.

Example) Implementing SensorEventListener in Activity

public class SampleActivity extends Activity implements SensorEventListener

6.2.3. Registering sensors being used

When using a sensor, you need to register a sensor listener.

Example) Registering an accelerometer

//System sensor service acquisition
SensorManager sm = (SensorManager)getSystemService(SENSOR_SERVICE);
//Registering an accelerometer (TYPE_ACCELEROMETER)
Sensor s = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
sm.registerListener(this, s, SensorManager.SENSOR_DELAY_NORMAL);

6.2.4. Acquiring a sensor value

You can use the sensor value by acquiring a sensor event in onSensorChanged for SensorEventListener.

Example) Acquiring a sensor value for the accelerometer

public void onSensorChanged(SensorEvent event) {
  //Acquiring the accelerometer value (display log)
  if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){

The sensor value that can be received by onSensorChanged differs depending on the sensor type being used. The SensorEvent array element numbers that support each sensor type are shown below.

Table 6-2 Sensor values acquired with Epson original sensor
Sensor type Unit SensorEvent
Array element
Sensor value
TYPE_HEADSET_TAP - 0 2: Tap from the left or right
1 Y axis
2 Z axis
1 Y axis
2 Z axis
1 Y axis
2 Z axis
1 Y axis
2 Z axis

* For standard Android sensor types, these values are omitted to conform to the Android standard.

6.3. Sample Code

When using sensor type TYPE_HEADSET_TAP, Toast is displayed in the sample code when a tap is detected.

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends Activity implements SensorEventListener {
  protected void onCreate(Bundle savedInstanceState) {
    SensorManager sm = (SensorManager)getSystemService(SENSOR_SERVICE);
    Sensor sensor = sm.getDefaultSensor(Sensor.TYPE_HEADSET_TAP);
    sm.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL);
  public void onSensorChanged(SensorEvent event) {
    if(event.sensor.getType() == Sensor.TYPE_HEADSET_TAP){
      //if tap event occurs, show Toast
      Toast.makeText(this, "tap event!", Toast.LENGTH_SHORT).show();
  protected void onPause() {
    SensorManager sm = (SensorManager)getSystemService(SENSOR_SERVICE);
    if (sm != null) {
  public void onAccuracyChanged(Sensor sensor, int accuracy) {
Go to Top