dIMU Sensor

dIMU The Inertial Motion Sensor for LEGO Mindstorms NXTIntroduction

The Dexter Industries Inertial Motion Unit (IMU) Sensor measures acceleration, tilt, and rotation on all three axes.  The sensor combines an accelerometer and a gyroscope into one sensor for the LEGO Mindstorms system.  Build robots that know which way is up, can measure tilt, balance themselves, and measure acceleration and rotation on all axes all at once.

Accelerometer: Measure up to 8 g’s on all three axes.  Measure between ±2g, ±4g, and ±8g.

Gyroscope: Measures rate of rotation.  The sensor can measure ±250, ±500, and ±2,000 degrees per second.


The Inertial Motion Unit Sensor for LEGO Mindstorms NXT by Dexter IndustriesLayout


Below are diagrams of the axes of the gyroscope sensor and the accelerometer sensor with directions of the angular axes.

dIMU Setup Diagram of the Accelerometer and Gyroscope for the LEGO Mindstorms NXT Combined Axes




NXT-G Blocks are provided for the dIMU.  Separate blocks are provided for the gyroscope and for the accelerometer.  For instructions on how to install the NXT-G blocks into NXT-G, please see our video.  The easiest way to get started with the dIMU is to use the Hello World program found in the NXT-G Block download in our downloads section.

Gyroscope Block - The gyroscope sensor can be read with the Gyroscope Block.  The gyroscope block outputs degrees per second (dps) for the axis you select.  The below program shows the Gyroscope reading the x-axis.  All three axes can be read at once.

Fast Gyroscope Block – The Fast Gyroscope Block is similar to the Gyroscope block.  There are two things to be aware of:  at the beginning of your program, you must run a normal Gyroscope Block.  This will set up the sensor for operation.  Use the block to designate the degrees-per-second you would like to read.  You must also specify which axis you want the robot to read.  The more axes you check, the slower the sensor will read.  To get the fastest response, you should only read one axis.  Examples are provided in the Fast Gyroscope Block for NXT-G in our downloads section.

dIMU Accelerometer NXT-G Block DiagramAccelerometer Block – The accelerometer sensor can be read with the Accelerometer Block.  The accelerometer block returns milli-G’s (1000th of a G, a unit of gravity) for the axis you select.  For example, if the sensor is placed perpendicular to the ground and not moving, it will read “1000″ or 1 G.  The below program shows the Accelerometer reading the x-axis.  All three axes can be read at once.

The Sensitivity Selection input allows you to select the maximum number of G’s to be read by the accelerometer.  At times you may want to read very small changes in gravity.  For this, the default maximum acceleration reading is 2 G.  At other times, you may want to read very large changes in gravity.  For this you can input “1″ to read a maximum of 4 G or “2″ to read a maximum of 8 G.

dIMU Accelerometer NXT-G BlockAccelerometer Calibration Block – The accelerometer sensor can be calibrated with the Accelerometer Calibration Block.  To calibrate the block, you must select the Gravity Sensitivity (G Select) and the axis of the accelerometer that gravity will be passing through.  For example, if you lay the sensor flat on the ground, you must calibrate to the “Z” axis.  If you lay the sensor on any other side, you must calibrate to that axis.

dIMU Accelerometer NXT-G Control Panel

An example program of the dIMU using NXT-G to read an accelerometer and gyroscope for the LEGO Mindstorms NXT.

An example program of the dIMU using NXT-G to read an accelerometer and gyroscope for the LEGO Mindstorms NXT.


RobotC Logo.  Yeah, we have RobotC examples for the dIMU for Lego Mindstorms NXT.

RobotC code is provided in the Downloads section of our website.  RobotC drivers have been directly incorporated into the latest 3rd Party Drivers Suite, which can be found on the BotBench website.

A basic example for both the gyroscope and the accelerometer are provided in our Downloads section, with detailed commenting to better your understanding of the senor and its operation.  The example provides an in-depth explanation of the I2C calls for communicating with the dIMU.


Example code is provided for NXC in our Downloads section.  These examples were developed by Matthew and John Hanson (thanks!).

Labview for Lego Mindstorms

VI’s for Labview for Lego Mindstorms are provided by Tufts CEEO.  You can find them on our downloads page.


You can find Lejos software in our downloads section and a great explanation and tutorial on Aswin’s site here.

Calibration of the Accelerometer

Calibration of the Accelerometer is done by writing values to the sensor.  The accelerometer stores these values into memory and offsets readings by this value.  The calibration will be lost however when power is lost to the sensor.

Technical Specifications

The dIMU is both an accelerometer and a gyroscope.  For each part, we’ve outlined the technical specifications below.  Both sensors are digital and use unique I2C addresses.  This allows them to be used alongside other I2C sensors on the same port.

Accelerometer Technical Specifications

Gyroscope Technical Specifications

Data Sheets

The gyroscope is manufactured by ST and the accelerometer is manufactured by Freescale.  Datasheets and application notes for both the accelerometer and gyroscope can be downloaded here.

Accelerometer Registers

Accelerometer Register Summary for the Dexter Industries dIMU for Lego Mindstorms NXT. The dIMU is an accelerometer and gyroscope for the LEGO MINDSTORMS NXT system.

Accelerometer Register Summary. See Page 21 of the supplied datasheet for more information.

Gyroscope Registers

Gyroscope Register Summary for the Dexter Industries dIMU for Lego Mindstorms NXT. The dIMU is an accelerometer and gyroscope for the LEGO MINDSTORMS NXT system.

Gyroscope Register Summary. See Page 27 of the supplied datasheet for more information.

Helpful Hints

Other Links and Examples:

Project: Unicycle Balancing Robot


Got a question?  Ask on our forum!

Author: Administrator on May 16, 2011
23 responses to “dIMU Sensor”
  1. I so cannot wait for this. Any idea how much it will cost? How will it compete with the HiTechnic Sensors?

  2. [...] Industries are currently developing a great new sensor, a proper 6 Degree of Freedom (DOF) Inertial Measurement Unit (IMU) for the NXT. It consists of two [...]

  3. luca says:

    When do you plan to realise it(date)? I’m involved in medical simulation training and I would like add it to my mannequin.


    • Administrator says:

      Hopefully next week! Our first batch has been held up in customs, but we are selling individual IMU’s to those who contact us directly.

  4. [...] software contains of drivers for the Dexter Industries IMU sensor, programs to calibrate the sensor and the IMU filter that I wrote about on this blog before. The [...]

  5. Bjorn Leenen says:

    Do you have an advise for the portnumber to connect this nice module to? And will the read frequency be lower when the sensitivity is set lower, or is the smallest step just bigger/smaller?

    • Administrator says:

      Bjorn, you can hook the dIMU up to any sensor port, no problem.

      Read frequency should be faster when the sensitivity is lower; because of the limitations on speed on the NXT, depending on the language you use, it really won’t make much of a difference.

  6. Diyath Yavin says:

    Hi! Is there anyway to read the x, y & z for both the gyroscope and accelerometer simultaneously of this wonderful product? If so, can you datalog the results into a spreadsheet or table of some sort? Thanks! =D

    • Administrator says:

      Hello Diyath,
      You can read the values sequentially: the gyro and the accelerometer are both on the same I2C bus. You can read them extremly quickly, but no simultaneously. You can, indeed, save the values to a text file / table on the NXT and upload the values to your computer. YOu could also datalog movements with the LegoEducation software, extremely easy!



  7. wweghorst says:

    Will there be an example to use the dIMU Fast Gyroscope NXT-G Blocks to create a segway robot?

  8. Jordan says:

    How many grams does a dIMU board weigh, do you guys know?

  9. Demetri says:

    Is there a way to connect this to a breadboard? because my FTC team wants to use it, but we can’t because all non-lego sensors have to be connected to a breadboard.

    • Administrator says:

      Probably the best way to do that is to use this: http://www.dexterindustries.com/NXTBreadBoard.html

      Didn’t know about that rule before, that’s really awesome news! Is that new, the ability to hook it up to a breadboard, or has that always been around?

      • Demetri says:

        Is there a way to take off the adapter and connect the diMU to the breadboard? So diMU would be connected to the breadboard and the breadboard to the NXT via the Breadboard Adapter.
        As far as I know it has been a rule, but we compete in Oregon so the rules may be a bit different.

        • Administrator says:

          Hey Demetri,
          If you’d prefer to do some soldering/desoldering, you can certainly do this. The dIMU uses the typical I2C pins for a LEGO sensor, and you can breadboard them out. You could also cut a LEGO cable in half, and solder the wires to a set of 2.54mm pins, and stick those into a breadboard. Lot’s of ways to make that happen I think.

          • Demetri says:

            Do you know where I could get information on how to connect it to the Hitechnic prototype board?

          • Administrator says:

            Hey Demetri,
            Not sure, we don’t have a HiTechnic prototype board. Have you contacted HiTechnic?
            Thanks! John

  10. wweghorst says:

    Can you tell me when the imu software block will be made available for ev3

  11. John says:

    wweghorst, we’re working on it, I promise! No, I don’t have a timeline for it though yet.

Leave a Reply

+ 9 = fifteen