element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Xsens
  • Products
  • Manufacturers
  • Xsens
  • More
  • Cancel
Xsens
Blog Interfacing MTi devices with the Raspberry Pi
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Xsens to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: xsenssupport
  • Date Created: 1 Jul 2021 10:26 AM Date Created
  • Views 5796 views
  • Likes 2 likes
  • Comments 5 comments
  • ins
  • xsens
  • inertial sensors
  • library
  • get started coding with raspberry pi library
  • imu
  • rpi
  • rspberry pi
Related
Recommended

Interfacing MTi devices with the Raspberry Pi

xsenssupport
xsenssupport
1 Jul 2021

Introduction

The Raspberry Pi is an ARM-based mini PC that is amongst other applications used for prototyping and development of robotics. In this article we will explain how to connect your Xsens MTi device to a Raspberry Pi, and how to easily communicate with it by using our MT Software Development Kit (MT SDK).

Raspberry Pi boards run on ARM Cortex CPUs, which means that they are not compatible with the regular Xsens Device API. Fortunately, Xsens has made a large part of the API open source, allowing users to develop applications for ARM-based platforms as well. Xsens provides C++ example codes as well as a ROS driver that make use of this open source API.

We have used the Raspberry Pi 4 Model B for this article, but the guidelines can also be used for other Raspberry Pi models. Xsens has tested the following motion trackers with the Raspberry Pi:

  • MTi 1-series Development Kit (USB, UART)
  • MTi 600-series Development Kit (USB, UART)
  • MTi 10-series (USB)
  • MTi 100-series (USB)

 

Setup

Start by downloading the latest MT Software Suite for Linux from our website and unpack the .tar.gz package at your desired location. Then, install the MT SDK:

sudo ./mtsdk_linux-xxx_xxxx.x.x.sh 
 

This article will cover two hardware interfaces of the Raspberry board: USB and TTL UART. If possible, we recommend using USB as a starting point, to verify that your hardware and software can detect and communicate with external sensors. Simply connect your MTi to one of the USB ports of the Raspberry using the USB cable included in your Development Kit.

 

1. C++ example codes

Inside the MT SDK you will find an examples folder. Open it and navigate to the xda_public_cpp folder. You will find two example codes:

  • example_mti_receive_data: Scans for, and connects with MTi devices, configures their outputs, and prints/logs the received data.
  • example_mti_parse_logfile: Opens a .mtb log file and parses its contents.

In this folder, open a terminal and build the example codes:

sudo make

Note: If you are using the MTi 10-series or MTi 100-series with a direct USB cable, make sure to have libusb installed, and build the examples using:

sudo make HAVE_LIBUSB=1
 

You should end up with two executable files, one for each example code. Upon executing example_mti_receive_data your connected MTi should be detected automatically. We refer to the Troubleshooting section of this article if the MTi is not detected.

 

2. ROS driver

Inside the MT SDK you will find the xsens_ros_mti_driver. Simply follow the README.txt file inside this folder or our guidelines at http://wiki.ros.org/xsens_mti_driver to install and launch the ROS driver. Your MTi should be detected automatically, and a variety of data topics are available to subscribe to. We refer to the Troubleshooting section of this article if the MTi is not detected.

Note: the ROS driver publishes data, but unlike the C++ example code, it does not actually configure the outputs of the MTi. Use the C++ example code or a PC with our GUI MT Manager to configure the MTi such that it outputs the data that are required for your application.

 

Serial hardware interfaces

Next to the plug-and-play USB interface, Raspberry Pi boards offer various other interfaces that allow you to communicate with MTi devices. For this article we used the mini UART interface that is accessible via the GPIO pins 14 (TXD) and 15 (RXD). We also used the 5V/3V3 and Ground pins to power the MTi.

Note: The configuration and availability of the UART interface varies between Raspberry Pi models. For this article we first had to enable the mini UART. Refer to this article for more information.

Note: The UART interface of an MTi 1-series Development Board will be disabled when the board is powered at 5V. Use the 3.3V output of the Raspberry instead.

image

In Ubuntu, this UART port will show up as /dev/ttyS0. By default, the ROS driver and C++ example code do not scan this location. Fortunately, it is easy to modify the source code such that it scans for your specific location:

Open example_mti_receive_data.cpp (in case of the C++ example code) or xsens_ros_mti_driver/src/xdainterface.cpp (in case of the ROS driver) and replace the following lines:

XsPortInfoArray portInfoArray = XsScanner::scanPorts();
XsPortInfo mtPort;
for (auto const &portInfo : portInfoArray) { if (portInfo.deviceId().isMti() || portInfo.deviceId().isMtig()) { mtPort = portInfo; break; } }
 

with

XsPortInfo mtPort = XsScanner::scanPort("/dev/ttyS0",XBR_230k4); 

...where in this case we scan "/dev/ttyS0" for an MTi device that is configured at a baud rate of 230400 bps.

 

Alternatively, the ROS driver also allows you to configure the desired port and baud rate manually without modifying the source code. To do so, uncomment and modify the following lines in the file xsens_mti_node.yaml, located at xsens_ros_mti_driver/param:

# port: '/dev/ttyS0' # baudrate: 921600
 

You should now be able to detect and access the MTi via the UART interface.

 

Troubleshooting

  • “No MTi device found.” or “Could not open port.”

    • Ensure that you have the rights to access the port of the MTi (e.g. /dev/ttyUSB0). If you are using the C++ example code, you can check this by executing the code with sudo. Possibly you are not in the right group to access the port of the MTi. See MTSDK.README, located in your MT SDK folder, for further guidelines on changing group access permissions.
    • If you are using the MTi 10-series or MTi 100-series with a direct USB cable, make sure to have libusb installed, and build your code as:
      sudo make HAVE_LIBUSB=1 
    • If you are using a robust MTi 600-series with a USB dongle, make sure to have the relevant drivers installed.
    • If you are not using the USB port or if you are using a custom serial-to-USB converter, try specifying the exact port and baud rate at which your MTi is communicating. See paragraph Serial hardware interfaces of this article.
  • My USB-connected MTi does not show up as /dev/ttyUSB#.

    • If you are using the MTi 10-series or MTi 100-series with a direct USB cable, then it is not necessary for the MTi to show up as /dev/ttyUSB#. Make sure to have libusb installed, and build your code as:
      sudo make HAVE_LIBUSB=1 
      The MTi should now be recognized whenever you launch the ROS driver or C++ example code.
  • The data I am receiving never reaches the expected data output rate (e.g. 400 Hz).Still facing challenges? Don’t hesitate to contact our Field Application Engineers for further support.

    • We have noticed that the ROS node can cause a high CPU load, leading to lower data output rates. This issue has been fixed in ROS nodes available in MTSS2019.3.2 and later. We recommend migrating to the latest version.
    • If you have connected the MTi via the USB interface, we recommend enabling the low latency mode using setserial. See this page for more details.
  • Still facing challenges? Don’t hesitate to contact our Field Application Engineers for further support.

  • Sign in to reply

Top Comments

  • xsenssupport
    xsenssupport over 4 years ago in reply to dougw +1
    Thanks for the clarification Douglas. On top of the Inertial Sensor data (gyroscope, accelerometer, magnetometer and barometer), the MTi Series can output 3D orientation (roll, pitch, yaw) and for the…
  • ssmong
    ssmong 1 month ago

    Hi I'm currently using MTi-630 AHRS and ran the example code.
    However, I only received the quaternion and 3D orientation data

    What should I do?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • xsenssupport
    xsenssupport over 4 years ago in reply to volley36

    Hello Will,

     

    Interesting project!!

    Let me know if you need any support.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • volley36
    volley36 over 4 years ago

    I'm working on a joystick conrolled tadpole trike for people with disabilities.

    Before I read this, I was looking for a cheapish gyro to be certain about conditions of operation and this might be the ticket.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • xsenssupport
    xsenssupport over 4 years ago in reply to dougw

    Thanks for the clarification Douglas.

     

    On top of the Inertial Sensor data (gyroscope, accelerometer, magnetometer and barometer), the MTi Series can output 3D orientation (roll, pitch, yaw) and for the GNSS/INS versions 3D velocity and 3D position data.

     

    More information of the MTi-Series portfolio can be found here:

    https://www.xsens.com/inertial-sensor-modules

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dougw
    dougw over 4 years ago

    It isn't quite clear from this article but Xsens makes MEMS sensors that measure linear acceleration, angular rate, barometric pressure and magnetic field.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube