Take a Simpler Route to Low-Power, 9-Axis Motion Tracking

Contributed By DigiKey's North American Editors

For a growing number of wearables and IoT designs, the ability to detect orientation and track motion is emerging as a key requirement. Despite the broad array of available motion sensors, engineers are constantly challenged to more rapidly and effectively integrate these devices at lower power, which is particularly challenging with additional sensors.

To meet these motion tracking challenges, designers need more integrated accelerometer, gyroscope, and magnetometer hardware, as well as more efficient and smarter data fusion algorithms.

This article will introduce a solution from TDK InvenSense that helps with both hardware and software. It will then show how designers can go about applying it to simplify development of complex low-power multi-sensor applications that require sophisticated motion sensing capabilities.

The challenges of efficient motion tracking

With traditional approaches to motion tracking, developers deal with significant integration problems for both hardware and software. On the hardware side, developers typically struggle to minimize complexity, size, and parts count in designs built with separate sensors including accelerometers, gyroscopes, and magnetometers. Software engineers need to take special care to synchronize the diverse sensor outputs to create the kind of unified data stream required for sensor fusion algorithms used in advanced motion tracking applications. For both hardware and software developers, the challenges rise dramatically for applications that require the integration of additional types of sensors in designs.

Using the TDK InvenSense ICM-20948, however, developers can rapidly implement motion tracking designs or other multi-sensor systems with minimal effort.

Motion tracking solution

Measuring only 3 mm x 3 mm x 1 mm, the TDK InvenSense ICM-20948 is a multi-chip module that integrates the full complement of sensors, signal chains, digital processing, and interface circuitry required to provide a complete motion tracking solution (Figure 1).

Image of TDK InvenSense ICM-20948

Figure 1: The TDK InvenSense ICM-20948 implements motion tracking through its dedicated signal chains, programmable filters, interface circuits, and digital motion processor. (Image source: TDK InvenSense)

For all its capability, the module requires only about 3 milliamps (mA) in full operating mode. For power-constrained applications, developers can shut down portions of the module, reducing current draw in stages, down to 8 microamps (μA) in full sleep mode. The resulting power consumption depends on the operating voltage (VDD), which can be between 1.71 volts and 3.6 volts, depending on the design requirements.

Integrated in the module, separate signal chains support each channel of the integrated 3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer, as well as the integrated temperature sensor. Each signal chain includes buffer amplifiers and a dedicated 16-bit analog-to-digital converter (ADC), along with sensor specific circuitry such as current sources for driving the module’s Hall Effect magnetometer.

For enhancing the output of each signal chain, the module includes a signal conditioning stage appropriate to each further sensor type. For example, the magnetometer output passes through an arithmetic circuit for basic signal processing, while the outputs from other sensors each feed into their own sensor specific conditioning stage for processing functions such as sample averaging. Developers can set the ICM-20948 to average up to 128 gyro data samples, or set accelerometer averaging at up to 32 samples. Finally, the output from each channel’s signal conditioning stage feeds into a set of dedicated sensor registers.

At the heart of the ICM-20948, a proprietary digital motion processor (DMP) provides a wide range of features including execution of motion processing algorithms, calibration, and self-test. During normal operation, the DMP processes data from the dedicated sensor registers. It then stores results in the module’s integrated FIFO for access by the host MCU through a shared I2C or SPI bus.

The capabilities of the DMP and FIFO provide an important capability for many real-world applications. In many cases, applications update their motion tracking results at a relatively slow rate, even allowing their host processor to sleep between updates to reduce overall power consumption. Yet, motion tracking algorithms require significantly higher update rates to ensure their ability to provide accurate data with minimal latency when the application does request an update. The DMP’s ability to maintain high update rates, without host involvement, helps ensure accuracy without forcing additional requirements for performance or power consumption on the host application itself.

Simple integration

The combination of small footprint, system integration features, and host independent operation, makes the ICM-20948 particularly well suited for use in mobile devices, wearables, and IoT designs. The module’s high level of integration means that developers can implement a typical motion tracking design with only three capacitors. Following TDK InvenSense’s recommendations for use of ceramic X7R parts, developers would add a 0.1 μF capacitor at the module’s REGOUT pin for regulator filtering, and at its VDD and VDDIO pins for supply bypass (Figure 2).

Diagram of TDK InvenSense ICM-20948 added to an MCU-based design

Figure 2: Designers can easily add the TDK InvenSense ICM-20948 to an MCU-based design, connecting to the MCU through a SPI (shown here) or I2C interface, which uses the same configuration but with pin 22, nCS, tied to VDDIO. (Image source: TDK InvenSense)

While the ICM-20948 provides a near drop-in solution for motion tracking designs, many applications present requirements for additional sensor types. To help developers simplify these multi-sensor designs, the ICM-20948 provides a separate I2C interface and built-in support for additional external sensors. Here, developers connect an I2C-compatible smart sensor to the module’s dedicated auxiliary I2C ports (Figure 3).

Diagram of TDK InvenSense ICM-20948 module’s auxiliary I2C interface

Figure 3: In parallel with SPI (or I2C) connections to the host MCU, developers can use the TDK InvenSense ICM-20948 module’s auxiliary I2C interface (AUX_CL and AUX_DA) to connect external sensors and manage them through the ICM-20948’s dedicated registers for auxiliary devices. (Image source: TDK InvenSense)

In normal operation, the ICM-20948 would act as the I2C bus master for communicating with external sensors. For this mode, developers program a dedicated set of module registers to define the external device’s I2C address, output data address, and additional transfer parameters. Using this information, the module can read external sensor data into its FIFO and external device data registers, using single or multi-byte reads across the sensor I2C bus without involving the host MCU.

The ICM-20948 provides an additional feature designed specifically to coordinate timing between the ICM-20948 and external sensors. Besides using the module’s dedicated interrupt INT pin, developers can also drive the module’s FSYNC pin with an interrupt or synch pulse from an external sensor. For example, in an image stabilization application, developers can use an image sensor’s frame synch output to synchronize image data with ICM-20948 sensor readings. Using the module’s FSYNC_CONFIG register, developers can even configure the module to measure the time between an external sensor’s FSYNC event and an ICM-20948 data event, providing tighter synchronization between image and motion data.

As a dedicated motion tracking device, however, the ICM-20948 lacks the functionality required to configure external sensors using the kind of device specific setup operations typically handled by a host MCU. To simplify system initialization, the module provides a pass-through mode, using its integrated interface bypass multiplexer to connect the host system processor directly to the external sensor.

In pass-through mode, the device uses its integrated analog switches to electrically connect auxiliary I2C pins AUX_CL (pin 7) and AUX_DA (pin 21) directly to the host I2C bus (pins 23 and 24). This operating mode offers a simple method for allowing the host processor to handle any configuration and setup requirements associated with each external sensor. After initialization, developers disable the bypass mux to allow the ICM-20948 to take over external sensor access for normal operations.

Rapid development

Although the ICM-20948 presents relatively straightforward interface requirements, developers looking to evaluate motion tracking solutions can avoid even that level of hardware prototyping. TDK InvenSense’s DK-20948 evaluation board and reference design provide an off-the-shelf development platform that combines a host MCU, embedded debugger, USB interface, and multiple connectors for adding additional sensors, wireless connectivity, and other features (Figure 4).

Image of TDK InvenSense DK-20948 board

Figure 4: The TDK InvenSense DK-20948 board provides a complete motion sensing design that combines the ICM-20948 module with a Microchip Technology ATSAMG55J19B MCU (left center) and an embedded debugger based on a Microchip AT32UC3A4256 MCU (located on the back side of the board). (Image source: TDK InvenSense)

Based on a Microchip Technology ATSAMG55J19B MCU, the DK-20948 board provides a complete motion sensor design using the ICM-20948. Also, the board includes a Microchip AT32UC3A4256 MCU, which provides embedded debugging capability, eliminating the need for external tools when working with the host ATSAMG55 MCU. Developers can use the board to evaluate the ICM-20948 with no further hardware effort or additional custom or available daughter boards to extend its functionality. After they have completed their evaluation of the ICM-20948, the kit’s schematics, detailed BOM, and board design files can be used to create custom designs.

For software engineers, the DK-20948 kit similarly includes options for both quick evaluation and custom development. For evaluation, the company’s MotionLink GUI-based tool allows developers to explore different configuration settings and evaluate their impact on the resulting motion data. For most developers, however, the kit’s software development package will quickly become their primary focus.

Custom software

For custom software development, the TDK InvenSense eMD (embedded motion drivers) SmartMotion software package provides application programming interface (API) documentation, driver source code, sensor fusion libraries, and prebuilt DMP firmware images. Also, the package includes tools for building and flashing custom firmware images as well as a command line utility for console interaction with the board.

Designed for use with the Atmel/Microchip Technology Atmel Studio, the eMD software distribution includes two Atmel Studio packages: core and app. The core package includes the low-level drivers and firmware needed to program and operate the ICM-20948, as well as prebuilt motion algorithm and math files for the DK-20948 board’s Microchip ATSAMG55J19B host MCU.

The app package includes a sample application that demonstrates the use of the core package including key design patterns extending from the top application layer down to serial bus transactions. For example, a main C routine shows how developers can initialize the ICM-20948 and acquire data (Listing 1).

int main (void)

{

   . . .

  

    /* Initialize icm20948 serif structure */

   struct inv_icm20948_serif icm20948_serif;

   icm20948_serif.context   = 0; /* no need */

   icm20948_serif.read_reg  = idd_io_hal_read_reg;

   icm20948_serif.write_reg = idd_io_hal_write_reg;

   icm20948_serif.max_read  = 1024*16; /* max num bytes allowed per serial read */

   icm20948_serif.max_write = 1024*16; /* max num bytes allowed per serial write */

 

   icm20948_serif.is_spi    = interface_is_SPI();

 

   . . .

  

    * Setup the icm20948 device */

   icm20948_sensor_setup();

 

   /*

    * Now that Icm20948 device was initialized, proceed with DMP image loading

    * This step is mandatory as DMP image are not store in non volatile memory

    */

 

   load_dmp3();

 

   /*

    * Initialize Dynamic protocol stuff

    */

   DynProTransportUart_init(&transport, iddwrapper_transport_event_cb, 0);

   DynProtocol_init(&protocol, iddwrapper_protocol_event_cb, 0);

 

   /*

    * Initializes the default sensor ODR in order to properly init the algorithms

    */

   sensor_configure_odr(period_us);

 

   InvScheduler_init(&scheduler);

 

   . . .

  

   while (1) {

      InvScheduler_dispatchTasks(&scheduler);

 

      if (irq_from_device == 1) {

         inv_icm20948_poll_sensor(&icm_device, (void *)0, build_sensor_event_data);

 

         __disable_irq();

         irq_from_device = 0;

         __enable_irq();

      }

   }

 

   return 0;

}

Listing 1: Developers can examine sample source code provided in the DK-20948 eMD SmartMotion software package to learn key design patterns such as the ICM-20948 initialization and sensor polling patterns illustrated in this snippet from a sample application’s main.c routine. (Code source: TDK InvenSense)

In programming a highly integrated device such as the ICM-20948, developers can easily find themselves struggling not only with the device’s many configuration options, but also with the large number of software components required to operate the device efficiently. The eMD core package largely eliminates that complexity through a series of abstractions including software structures and service layers. For example, a key software structure, inv_icm20948, collects all the data and metadata required to operate the ICM-20948, including the definition of its serial interface (Listing 2).

/** @brief ICM20948 serial interface

 */

struct inv_icm20948_serif {

       void *     context;

       int      (*read_reg)(void * context, uint8_t reg, uint8_t * buf, uint32_t len);

       int      (*write_reg)(void * context, uint8_t reg, const uint8_t * buf, uint32_t len);

       uint32_t   max_read;

       uint32_t   max_write;

       inv_bool_t is_spi;

};

Listing 2: To help reduce software complexity, the DK-20948 eMD SmartMotion software core routines provide a number of C language structures such as this one, which defines settings for the ICM-20948 serial interface and pointers to the appropriate low-level read and write routines needed for I2C or SPI transactions. (Code source: TDK InvenSense)

After instantiating eMD structures and initializing the device itself, developers can call a single routine, inv_icm20948_poll_sensor(), which uses the inv_icm20948 structure instance to read sensors and process data with the DMP. Over 900 lines long, this well-documented routine offers developers a detailed demonstration of the use of core functions to operate sensors, manage the FIFO, and utilize the DMP.

Developers interested in understanding ICM-20948 operations at a more fundamental level can turn to lower-level core routines such as those used in the device self-test Icm20948SelfTest.c module. Within this module, routines such as int inv_do_test_accelgyro illustrate typical register operations for controlling the device (Listing 3).

static int inv_do_test_accelgyro(struct inv_icm20948 * s, enum INV_SENSORS sensorType, int *meanValue, int *stMeanValue)

{

   . . .

 

    // Set Self-Test Bit

    if (sensorType == INV_SENSOR_GYRO)

    {

        // Enable gyroscope Self-Test by setting register User Bank 2, Register Address 02 (02h) Bit [5:3] to b111

        result = inv_icm20948_write_single_mems_reg(s, REG_GYRO_CONFIG_2, BIT_GYRO_CTEN | SELFTEST_GYRO_AVGCFG);

    } else

    {

        result = inv_icm20948_write_single_mems_reg(s, REG_ACCEL_CONFIG_2, BIT_ACCEL_CTEN | SELFTEST_ACCEL_DEC3_CFG);

    }

 

   . . .

}

Listing 3: Developers can find routines in the DK-20948 eMD SmartMotion software package that demonstrate use of the ICM-20948 at multiple layers of abstraction including register level access as shown in this snippet from the Icm20948SelfTest.c module. (Code source: TDK InvenSense)

In Listing 3, the (relatively) high level inv_icm20948_write_single_mems_reg() function calls a lower level routine, inv_icm20948_write_reg(), passing along a common inv_icm20948 structure instance. That call cascades to lower layers, finally arriving at a routine that actually performs the register-write operation. In doing so, that final low-level function uses the pointer to the register-write routine loaded during software initialization into the inv_icm20948_serif serial interface structure instance shown earlier in Listing 2. This layered approach is essential to help minimize software complexity and maximize performance.

For developers, the eMD SmartMotion architecture provides a flexible framework built on a consistent set of key predefined structures. With the eMD package, developers can work at a high level, using abstractions to rapidly implement applications. At the same time, developers can easily dive into lower layers to implement custom functionality without losing consistency with their higher level software. Together, the eMD SmartMotion software package and the DK-20948 development board offer a comprehensive platform for rapid development of motion sensing applications.

Conclusion

The TDK InvenSense ICM-20948 module provides a fully integrated solution for motion sensing. Using the associated DK-20948 development kit and eMD SmartMotion software package, developers can quickly build motion sensing solutions able to meet requirements for minimal size and power consumption.

DigiKey logo

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of DigiKey or official policies of DigiKey.

About this publisher

DigiKey's North American Editors