Need Resource for Learning Development


I'm trying to make a UWP app that gives me the Sensor Fusion quaternions. Although I have some coding experience, i'm not familiar with app dev. I've done some intro C# tutorials, but I still don't understand anything that is happening in the Free Fall Detector tutorial videos. Does anyone have a resource that they could point me to that would help me learn how to use the C++ API in my app to get the sensor fusion quaternions?

Thank you!


  • Follow this tutorial on the mbientlab website which instructs you on setting up a stream for acceleration data.
  • Hi Eric,

    Thanks for the response. I have done this tutorial before. Could you give me some idea of how closely this would parallel the process of getting data with sensor fusion? 

  • It is the same setup except you use the sensor fusion data signals instead of the accelerometer ones.
  • Hi again Eric,

    I really appreciate your help. I'm now closer than ever to getting this project done. The only thing I'm not sure about is what I put in for MBL_MW_SENSOR_FUSION_DATA_QUATERION in the following line:
    mbl_mw_sensor_fusion_enable_data(board, MBL_MW_SENSOR_FUSION_DATA_QUATERION);

  • Hi Eric, I tried to implement Sensor Fusion, but am getting the following error:

    System.Runtime.InteropServices.SEHException occurred
      Message=External component has thrown an exception.
      Source=<Cannot evaluate the exception source>
       at MbientLab.MetaWear.Functions.mbl_mw_sensor_fusion_set_mode(IntPtr board, Mode mode)
       at MbientLab.MetaWear.Template.DeviceSetup.accStart_Click(Object sender, RoutedEventArgs e) in C:\Users\Dan\Documents\Angle Sensor Project\MetaWear-UwpStarter-master\CS Template\DeviceSetup.xaml.cs:line 79

    Here's my accStart_click function where the error is taking place:

    private void accStart_Click(object sender, RoutedEventArgs e)
                mbl_mw_settings_set_connection_parameters(cppBoard, 2F, 7.5F, 0, 5000);
                mbl_mw_sensor_fusion_set_mode(cppBoard, SensorFusion.Mode.NDOF);
                mbl_mw_sensor_fusion_set_acc_range(cppBoard, SensorFusion.AccRange.AR_4G);


                IntPtr fussionsAccSignal = mbl_mw_sensor_fusion_get_data_signal(cppBoard, SensorFusion.Data.QUATERION);

                mbl_mw_datasignal_subscribe(fussionsAccSignal, fusionAccHandler);
                mbl_mw_sensor_fusion_enable_data(cppBoard, SensorFusion.Data.QUATERION);

    I added the line "using static MbientLab.MetaWear.Functions;" and all the text highlighting etc. suggests that imports are correct. Any help you could give me would great. Let me know if there's any other info related to that you need.
  • The code works fine for me. Are you using a metamotion board?
  • Interesting. I'm using a CPRO.

  • Sensor fusion is only available on MetaMotion boards.
  • Oh, in some emails with mbientlabs about the various sensor I was told that the sensor fusion app should work with the C and the CPRO. Here's a direct quote from the email:

    The Sensor fusion App works with the C and the CPRO.

    Is this not the case? It it possible to get any kind of sensor fusion working with the CPRO? Could raw sensor data be sent to my computer for sensor fusion processing?


  • The demo iOS sensor fusion apps collect raw sensor data perform sensor fusion on the iOS device using an external library.  MetaMotion boards have a sensor fusion algorithm as part of the firmware and do the computations on-board.
  • I see. Do you provide any libraries for performing sensor fusion on the computer itself? 
  • No, we do not provide sensor fusion code for standalone applications though you can try the libraries mentioned in this post:

  • Thanks a lot, I really appreciate your quick responses and help. I'll check out those resources.

This discussion has been closed.