• Arduino Mega 2560
• USB B-type cable
• MPU-9150 breakout board
• Breakout pin headers
• Arduino male-to-female jumper wires
The MPU-9150 is a popular IMU from a company
called InvenSense ( www.invensense.com). It has a
built-in accelerometer, gyroscope, and magnetometer.
It also has a motion processing unit called DMP
(Digital Motion Processing) to fuse all three sensor data
to get accurate orientation information. The MPU-9150
can be easily interfaced to an Arduino using the Arduino
After retrieving the orientation information from the
sensors, it will send it to ROS via the ROS-Arduino
interface. The Arduino-ROS client will publish an IMU ROS
message and also publish Transform (TF) information. The
TF data can be directly visualized on Rviz.
Soldering MPU-9150 Pin Headers
When you purchase the MPU-9150, you will get its pin
headers which have to be soldered to the breakout board.
Figure 14 shows how the pin headers are soldered. These
pins can be interfaced to an Arduino using the male-to-female jumper wires.
You should be very cautious while soldering because
excessive heat can damage the main IC on the board. You
should keep the pin header alignment perpendicular to the
board while soldering. If the pin alignment is not proper,
we can’t mount the IMU into a breadboard.
After soldering, we can connect the IMU module using
the M/F jumper wires. The female connector can be used
to attach the IMU, and the male connector can be used for
the Arduino. Figure 15 shows the circuit of the IMU to the
Programming the Arduino
To start programming with the Arduino, we first need
to download the Arduino library for the MPU-9150. We can
download it from https://github.com/sparkfun/MPU-
9150_Breakout. Copy the content of the firmware folder
to the <arduino_sketchbook location>/libraries folder. Open
the Arduino IDE; if everything is set, you should get what
you see in Figure 16.
If you get this, you can copy the ROS_IMU interfacing
code to the Arduino IDE; compile and burn it to the
Arduino. The complete explanation of the code is
commented in the code itself.
After burning the ROS_IMU
code into the Arduino, start
Figure 14. MPU-9150 breakout board.
Figure 15. MPU-9150
Arduino interfacing circuit.
SERVO 11.2016 35
Figure 16. MPU-
9150 library on
Figure 17. Running rosserial node.