Accelerometer reading stream data

Hi, I'd like to read stream data from the accelerometer (something like in the iOS sample app) but I don't receive anyting on acclerometer.callbak.
I would also like to receive stream freefall event or accelerometer data filtered after high pass data filter douring streaming data.
Here is my code snippet

    private ServiceConnection mServiceConnection = new ServiceConnection() {

        public void onServiceDisconnected(ComponentName name) {
            mServiceBound = false;

        public void onServiceConnected(ComponentName name, IBinder service) {
            mwService = ((MetaWearBleService.LocalBinder) service).getService();
            mwController = mwService.getMetaWearController();
            mServiceBound = true;
            Accelerometer accelCtrllr= (Accelerometer) mwController.getModuleController(Module.ACCELEROMETER);
            accelCtrllr.enableTapDetection(TapType.SINGLE_TAP, Axis.Z);

    private ModuleCallbacks accelCallback = new Accelerometer.Callbacks() {

        public void receivedDataValue(short x, short y, short z) {
            super.receivedDataValue(x, y, z);
            Log.d("accelCallback", "receivedDataValue");

        public void singleTapDetected(MovementData moveData) {
            Log.d("accelCallback", "singleTapDetected");

Actually if I tap or move the metawear board I don't receive anything. I double checked the board or the battery level with the iOS app and everything is ok.


  • Judging from the provided code, you are not connected to the board when you are making the accelerometer calls.  The onServiceConnected callback function indicates your activity or fragment has connected to the MetaWearBleService class, not to a MetaWear board.
  • edited December 2014
    I reviewed my code and I found that somehow I forgot to implement the MetaWearBroadcastReceiver.
    I've some more questions with tha accellerometer.
    The isFreeeFall feature is now deprecated. I've implemented movementdetected wich receives MovementData. During freeFall I receive the movementdetected callback but I can't find any documentation in the 1.0.8 version of docs-api on your website regarding MovementData. Shall I assume that if I receive movementdetected is only FreeFall?
    From the sample app I've found how to read stream data


    but in the docs I can't find FullScaleRange or OutputDataRate
    Could you please also give some example on how to set the highPassFilter to a particular G force?

  • Ah sorry, I forgot to update the doc links.  Javadocs for v1.2 is here ( which has the info for FullScaleRange, OutputDataRate, and MovementData types.

    Yes, the movementDetected function is for freefall.  The deprecated version did not pass in any axis information about the movement.
  • Thanks.
    Have you sheduled some demo app or project that show hot to use highPassFilter ?

  • I don't have anything on the table atm.  Is there anything specific I can help answer for you?
  • edited December 2014
    I'd like to implement something like in
    I'd like to be notified only if the metawear board receive an impact( calculated as rms like in the link above or on at least one axys) greater than 3 or 4g. I thought that the high pass filter could be the right way to achive this but I am not able to implement it.
    Could be something like a tap. Wich is the force needed to the tap to be triggered?
  • Tap detection will do what you are looking for.  You can enable it with enableTapDetection.
This discussion has been closed.