Tutorial 2: Orientation Tracking Using MovSens Wireless 9DOF IMU

Introduction

In this second tutorial, we will describe how to use the wireless 9DOF IMU sensor to monitor the orientation or rotation of a target object, in 3-Dimensional space and real time. This small, light, and cost-effective sensing unit (~$75) can be used in areas such as robotics, drones, autonomous vehicles, biomechanics, wearable technologies, gaming, VR/AR, motion monitoring, structural monitoring and many other situations. The wireless feature offers further advantages by eliminating the cables. Starting from Tutorial 3, we will demonstrate a variety of applications using this sensor. Here in this one, we will focus on the sensing technology itself. The step-by-step instruction will be covered in the following order:

  • Set up the hardware

  • Using the Firmware

  • Use MovSens Orientation/Rotation Tracker

  • Calibrate the sensor

Set Up the Hardware

What you need

In order to use the wireless sensor, you need the following parts. If you do not have them already, a link to the place where you can get them is provided.

  • MovSens Wireless 9DOF IMU (Get it here)

  • A pair of XBee Serial 1 modules (Get it here)

  • XBee Explorer USB Dongle (Get it here)

  • A liPo Battery 1000mAh (Get it here)

It is also highly recommended that you have an FTDI basic breakout (Get it here) and a miniUSB cable, for downloading Arduino program to IMU board through UART.

Put them together

As introduced in Tutorial 1, the IMU board is pre-loaded with an orientation/rotation tracking firmware, and you can directly use it. All you need to do is to setup the 2 XBee modules in the same network, and insert them into IMU board and XBee explorer dongle respectively. You can then communicate with the IMU board, receiving data it measures and sending commends to it wirelessly through XBee transceivers.

In future, you probably want to write your own firmware, or revise the firmware for your specific applications, so here we want to introduce how to put hardware pieces together to program the IMU board using Arduino software.

1. Connect the FTDI basic breakout to the IMU board via the 6-pin connector. Match the ports correctly, DO NOT reverse the direction;

2. Connect the IMU board with your PC using a mini USB cable;

At this moment, the hardware is ready for programming. The following section describes the software setup and firmware downloading process.

Setting up the Software

  • Download the latest MovSens_Orientation Firmware from GitHub

  • Download and install the latest Arduino Software. We will use it to upload the firmware. Any Arduino versions 1.x should work fine, tested with versions upto 1.6.7

Uploading the firmware If the XBee modules are set up correctly, you can upload the firmware wirelessly using the XBee modules. You can also use the FTDI adapter to upload the firmware. My experience is that using FTDI to upload the firmware is more convenient.

  • From downloaded MovSens_Orientation Firmware package, open the file /MovSens_Orientation.ino using Arduino

  • In Arduino:

  • Go to "Tools" → "Board" and select "Arduino Pro or Pro Mini";

  • Go to "Tools" → "Processor" and select "ATmega328 (3.3v, 8mhz) ";

  • Go to "Tools" → "Serial Port" and select the port used with the MovSens 9DOF IMU.

  • Go to "Sketch" → "Upload". After a short while, at the bottom of the Arduino code window it should say "Done uploading".

Testing the firmware

Without changing the hardware connection, bring up the Serial Monitor of Arduino under "Tools" → "Serial Monitor". Set it to 115200 baud and you should get output like this:

You can rotate the IMU board now and see the numbers streaming out on the serial monitor change. This suggests the firmware is working fine.

Testing the Wireless Orientation/Rotation Tracking

Now your IMU board is loaded with the latest orientation/rotation tracking firmware, and you can set up the XBee modules and test the wireless tracking.

  • Set up the XBee modules like in Tutorial 1, and make sure the baud rates for both XBee modules are set to 115200.

  • In Arduino software, select the port corresponding to your XBee Explorer and bring up the Serial Monitor of Arduino under "Tools" → "Serial Monitor".

  • Turn on your IMU board. After the initialization process (~2 seconds), the wireless communication starts, and you can see the data steaming on the Serial Monitor.

  • Without the constraint of a cable, you can move the IMU board freely and remotely from the PC, and you can see the 3D Yaw-Pitch-Roll angles are continuously monitored.

Use MovSens Orientation/Rotation Tracker

The wireless 9 Degrees-of-Freedom IMU, together with the "3D Orientation/Rotation Tracking" software, forms a complete inertial tracking system. This system could be directly used for your orientation tracking and data logging projects, or it could serve as your development kit, where you can write your own firmware and visualize the tracking with MovSens software interface.

  • Download the latest version of "3D Orientation/Rotation Tracking" (current version 1.0) from www.movsens.com/downloads, and install it onto your computer;

  • Double click to open the software, and the following graphic interface pops up;

  • On the left side, select the right COM port and baud rate. Then click "Open" button;

  • Rotate your IMU board, and you can see the rotation is continuously tracked by the graphic 3-axis. The numeric values of yaw, pitch and roll, are shown in the text box in real time;

  • If you want to save the data your IMU transmits, you can use the file directory in the bottom to create a file and the data will be continuously saved in this file.

Now you have all the infrastructure to develop your own IMU tracking projects. The next section of this tutorial will describe how to calibrate the sensors and make the orientation tracking more accurate.