Arduino and orientation in 3D space

MinImu-9 v2 and an Arduino

This is a module that contains a 3-axis accelerometer, 3-axis magnetometer (LSM303DLHC) and a 3-axis gyroscope (L3GD20). In addition to the sensors on the Board are essential passive elements such as capacitors, resistors, transistors and regultory voltage. Thanks to this the user does not need to worry about the PCB project and the appropriate placement of elements. The system has five conclusions. Three of them służa to the power source, and the other two output I2C (SDA data line and SCL line with clock).



Interefjs consisting of a data line (SDA) and clock line (SCL) and mass. Output/input settings Open-Drain (Open-Collector), so you need resistors podciągające.


Figure: the structure of the I2C bus. (source:


Transfer can be done in three modes:

  • Normal Mode - transfer rate up to 100 kbit / s 7-bit addressing
  • Fast Mode - transfer rate up to 400 kbit / s, 7 or 10-bit adresaca
  • High Speed Mode - data transfer rate up to 3.4 Mbps 7 or 10-bit adresaca


Starting with version Fast Mode device can be solved in mode 10-bit and 7-bit (up to 128 devices, in practice a little less - 112 hi addresses are reserved). Accelerometer, magnetometer and gyroscope in a module MinImu-9, of 7 bits. Mounted respectively on:

  • Accelerometer LSM303DLHC - 0011001b
  • Magnetometer L3GD20 - 0011110b
  • Gyroscope L3GD20 - 1101011b (with the possibility of setting the last bit with the jumpers)


Detailed information on the I2C bus can be found in the documentation from NXP: link.


To connect MinImu9 with the Arduino connect the power supply and output I2C/TWI:


SCLSCLLine clock (processed) I2C/TWI
TrafficTrafficData line I2C/TWI
GNDGNDWeight of both systems must be connected
VIN3.3 V or 5V The system power. MinImu9 has its own regulator with an output voltage of 3V. Doesn't matter if is connected, the voltage of 3.3 V or 5V. Connect a voltage of 3.3 V will give a loss of energy in the form of heat is generated on the stabilizer.
VDD-This output voltage from the stabilizer 3B, located on the Board MinImu9 in maximum load current 150mA max. From the output you can use when the supply voltage (specified on pin VIN) is higher than 3.3 V



MinImu-9 has podciągające resistors (4.7 k Ohms), the two line I2C (accelerometer and gyroscope). Care should be taken resistors on the Arduino side.


Similarly, should do with the layout of the gyroscope L3GD20 and accelerometer with magnetometrem LSM303DLHC .


Libraries and sample programs

For the service module was created library for Arduino. Library for module digital gyroscope L3GD20 and with magnetometrem accelerometer LSM303.


The manufacturer also provides a sample program for Arduino project.



The film is a 3D model managed in real-time using: MinImu-9 Arduino and 3DSMax.