Hey guy,

I want to ask is there an gyro inside the metawear board?(R type), how can I do an android programming to get the pitch angle between the horizontal and metawear(X-axis)?

Thank you!


  • The current MetaWearR board does not have a gyro.
  • OK,  but is it possible to get the angle in another way? thanks Eric
  • Mark,

    The MetaWear RG and the MetaWear RPRO have a gyro on them. The MetaWear R only has an accelerometer.

    Please check out these papers for more information on calculating angles using an accelerometer:

  • Hi Laura,

    Thanks for your sharing link, it can help me!!, 
    but before I using it, I need to filter the gravity effect, how can I remove it? is it use the RMS function? and how?

    thank you once again. 
  • You can enable high pass filtering to filter out gravity.  Documentation about the withHighPassFilter function here.

    public void setupAccelerometer(Accelerometer accelCtrllr) {
        accelCtrllr.enableXYZSampling().withHighPassFilter((byte) 0)

  • Hi Eric,

    public void connected() {

    gpioCtrllr= ((GPIO) mwController.getModuleController(Module.GPIO));
    gpioCtrllr.setPinChangeType((byte) 10, GPIO.ChangeType.ANY);
    gpioCtrllr.enablePinChangeNotification((byte) 0);

    accelCtrllr = ((Accelerometer) mwController.getModuleController(Module.ACCELEROMETER));
    accelCtrllr.enableXYZSampling().withHighPassFilter((byte) 0)


    Toast.makeText(getActivity(), R.string.toast_connected, Toast.LENGTH_SHORT).show();

    Does like that? but it seems can't filter the gravity. 

  • What is some of the data you are receiving with this accelerometer configuration?
  • sometime nothing but sometime correct..!!
  • Hrm..are you using the latest API release by chance?
  • Called KITKAT. API 19 4.4.
  • edited July 2015
    or do you mean the metawear? I am not sure what API I am using, is
    compile 'com.mbientlab:metawear:1.8.0' 
    should I change it to 1.9.3

  • 1.8.0 is sufficient, there isn't anything in 1.9.3 that you would need for what you are doing at the moment.  

    Also, you cannot configure the accelerometer while it is running.  Perhaps the accelerometer is already active when you try to configure it?  You can make a call to stopComponents beforehand to ensure the accelerometer is in standby mode prior to configuring it.
  • Ya, that is why, I never stop it when I disconnect, thank you so much.
  • Hi, is it possible to get the xyz acceleration with and without the gravity at the same time? thanks because when it is moving, it seem can't get the pitch angle.
  • High pass filtering is done on the accelerometer chip.  It does not support reporting both filtered and unfiltered data.
This discussion has been closed.