How to Connect MPU9250 to Arduino Nano

Get started with the MPU9250 on the Arduino Nano to get acceleration, gyro, and magnetometer values.

If you have not already be sure to subscribe for more content and a donation is always appreciated!




Step 1-) Physical Connection

Connect four jumper wires as follows

Step 2-) Download Board and Library

If you are using Arduino Nano Every you will need to download Arduino megaAVR Boards from the board manager in Arduino.

To get the MPU9250 library, go into your library manager and search “mpu9250”, and download the version by hideakitai, which contains many examples of useful starter code. You can find more useful information on the code in their GitHub here

Step 3-) Example Code

You can run their example code by going into File > Examples > MPU9250 > Simple

Make sure you have selected the Arduino Nano board from the Tools and select the appropriate port.

You can now simply upload the code! You can use the function getMagX() to get the magnetic field in the x direction as well, or MagY/MagZ for Y and Z.

There is a lot you can do with this library such as magnetic and gyroscopic calibration which can improve your sensor output.


Hope you enjoyed that quick video tutorial, if you did be sure to subscribe to the channel would be great. Thanks!

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.