One-stop-fusion-shopping at

Guest post by Mike Stanley, Systems Engineer at Freescale

Back in February, I wrote an article describing the Xtrinsic sensor fusion library for Kinetis MCUs. Over the intervening months, we’ve made a number of improvements:

  • Demo and Development versions of the kit have been consolidated into a single installer that covers all options.
  • The limited “Evaluation” version has been removed. In its place, we offer free board-locked licenses tied to your Freedom development board. Licenses are generated automatically during the installation procedure.  You now have access to the full development version with your first download.
  • We’ve added support for two new base boards, bringing the total to four: FRDM-KL25ZFRDM-KL26ZFRDM-K20D50M and FRDM-K64F.
  • We’ve updated the Xtrinsic Sensor Fusion Toolbox for Android to support the new boards.  We also added several neat new features I’ll mention below.
  • We’ve published our Xtrinsic Sensor Fusion Toolbox for Windows.  It’s not a clone of the Android variant, although there are some common features.  It goes will beyond that tool, offering a deeper understanding into some of the underlying calibration and fusion routines.
  • We’ve reworked the Android app landing page into a one-stop-shop for all things related to sensor fusion.  Visit to find convenient links for everything you’ll need to get your project started.  That includes all of the above, plus training materials, and a link to the Freescale Software Services group.  They can provide quotes for production software licenses and custom consulting work.

Figure 1 will look familiar to readers who have experimented with the Xtrinsic Sensor Fusion Toolbox for Android. The rotating PCB display shown here was inspired by that app.  The Windows version gives you some really nice additions.  First and foremost are support (via UART/USB wired connections) for the FRDM-FXS-9AXIS and FRDM-FXS-MULTI sensor boards.  Unlike the FRDM-FXS-MULTI-B board, these do not have Bluetooth modules, and cannot be used with the Android version of the toolbox.  That’s no problem for the Windows variant, which uses the virtual serial port feature of the OpenSDA interface to talk with the boards.  Simply plug your boards into your Windows machine, start the application and click the “Auto Detect” button you see in the upper right of the figure.  The application will cycle through your PCs serial ports until it finds one connected to a Freedom board and running the template app from the Xtrinsic Sensor Fusion Library for Kinetis MCUs.  And if you have a Bluetooth enabled PC, pair it to your FRDM-FXS-MULTI-B and run wirelessly.  The communications interface is the same from the perspective of the Windows GUI.


Figure 1: Xtrinsic Sensor Fusion Toolbox for Windows – Device View

Just like the Android version, you can select from a variety of fusion algorithms.  Also shown are the version of embedded firmware running on your Freedom board, along with the type of board (assuming you have debug packets enabled on the board).



Figure 2: Xtrinsic Sensor Fusion Toolbox for Windows – Sensors View

Figure 2 shows you the “Sensors” view of the application.  Here you have current values and value versus time plots for raw accelerometer and gyro readings, plus calibrated magnetometer.


Figure 3: Xtrinsic Sensor Fusion Toolbox for Windows – Dynamics View

The “Dynamics” view, shown in Figure 4, lets you look at some of the virtual sensor outputs from the sensor fusion library.  These include orientation in roll/pitch/compass heading form, angular velocity and acceleration.  You might wonder what the difference is between “angular velocity” and the gyro readings on the “Sensors” page.  If your algorithm selection supports a physical gyro, then the values in Figure 3 have had gyro offsets subtracted from them.  If your algorithm does not include gyro support, then the angular velocity included here is the result of a “virtual gyro calculation” (see “Building a virtual gyro“).

The accelerometer reading on the “Sensors” page included the effects of both gravity and linear acceleration.  The “Acceleration” item on the “Dynamics” page has had the effects of gravity removed, so it represents only the linear acceleration of your board.



Figure 4: Xtrinsic Sensor Fusion Toolbox for Windows – Magnetics View

I think Figure 4 shows the neatest feature introduced in the toolbox.  Those of you who have seen prior generations of Freescale magnetometer demos will recognize computed hard and soft iron correction coefficients on the left, along with our “magnetic calibration meter”.  What’s new is the 3D-to-2D projection shown on the right.  These are the measured data points selected by the magnetic calibration library for use in determining the correction coefficients.  Ideally, the figure should be circular in shape, be centered at 0,0 and have a radius equal to the magnitude of the earth magnetic field.  Nearby magnets, fixed spatially relative to the sensor, will shift the center to some non-zero value.  Ferrous materials, fixed spatially relative to the sensor, will distort the circle into an ellipsoid, and possibly rotate it.   If sources of interference are not fixed relative to the sensor, you’ll still see distortion, but it will not behave in as predictable a fashion, and isn’t as easily corrected.   It’s educational to bring your board near sources of magnetic interference, and watch how the constellation will distort, then self-repair over time.


Figure 5: Xtrinsic Sensor Fusion Toolbox for Android – Device View

Figures 5 and 6 are screen dumps from the latest version of the Xtrinsic Sensor Fusion Toolbox for Android.  If you enable display of debug packet information in the preferences screen, you’ll get additional information displayed on the device view:

  • The version of software running on your development board (Version 417 in this case)
  • The number of ARM CPU “systicks” occurring during one iteration of the main sensor fusion loop.  Take this number, divide by the CPU clock rate, and you have the number of seconds required for each iteration through the loop.  For the case above, 514,860/48MHz = 10.7ms.  The number is computed in real time, and changes depending upon which algorithm you are running.
  • The board type you are using (a lot of the boards look alike)

I should mention that all of the above are also shown in the “Device” tab in the Windows-based toolbox.


Figure 6: Xtrinsic Sensor Fusion Toolbox for Windows – Canvas View


Figure 6 shows the new “Canvas View” which was just added to the Android version of the Toolbox.  It demonstrates how we could use the sensor fusion quaternion output to create a wireless pointer.  The accel/gyro and 9-axis algorithms work best.  The 3-axis options are pretty much worthless due to basic limitations of using just those sensors, although I will note that gyro-based air mice are possible, just not with this particular algorithm. Check/UnCheck the “Absolute” checkbox on the Fusion Settings Bar to switch between the “absolute” and “relative” versions of the wireless pointer algorithm.  And be sure to read the “Canvas” chapter of the in-app documentation to get full details about how it works.

Our goal with the new page is to give you everything you need to get started quickly.  Relevant hardware, libraries, tools, training materials and support options have been brought together in one place.  If you already have the CodeWarrior for Kinetis MCUs IDE installed on your Windows machine, and have your development boards on hand, you can be up and running ten minutes from the time you land on the page.  And as always, if you have suggestions or ideas for how to improve things, just drop me a line.

Leave a Reply

Your email address will not be published. Required fields are marked *