From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

MPU-9250 myRIO

Hello,

 

I have attached code to share for using a NI myRIO to interface with an InvenSense MPU-9250 9-axis IMU.  I have used this great IMU as part of the control effort for a two wheel balancing robot called a "Segbot".  Please note that the offset registers for the IMU will vary for each specific IMU.

 

Thanks!

Message 1 of 31
(21,104 Views)

Thanks for sharing! Another great place to upload code would be in the NI Community Examples. Here users can upload and make their content searchable for other LabVIEW users in the community. Follow the link below and click Upload Example Program

 

http://www.ni.com/community/

 

 

 

Cameron Schaefer

Applications Engineer
National Instruments
0 Kudos
Message 2 of 31
(21,072 Views)

hi

 

This is a great example for using MPU-9250. I have a some question about hardware connection between MPU-9250 & myRIO. There are 10 pins on 9250(VCC, GND, SCL, SDA, EDA,ECL,ADO,INT, NCS,FSYNC). if i want to use SPI interface to receive data, which pins i need to connect to myRIO?

 

Thanks

Andy

0 Kudos
Message 3 of 31
(20,891 Views)

Hey Andy, 

 

The MPU-9250 Product Specification document walks through configuring the SPI interface. Check out page 26. 

 

Happy New Year!

0 Kudos
Message 4 of 31
(20,878 Views)

hi

 

Thanks for your help. I still can't get any data. This is my connection

 

vcc   --> pin 33

gnd   --> pin 30

sclk  --> pin 21

sdi    --> pin 23

sdo   --> pin 25

ncs   --> pin 13 (?)

 

In the eaxmple vi, there is a DIO(pin 13). So i am not sure it should connect to ncs. 

Does i make a  wrong connection ?

 

Thanks

Andy

Message 5 of 31
(20,859 Views)

According to the manual, pin 13 is a DIO channel, and nCS should be the output according to this page. Are you receiving any errors? 

0 Kudos
Message 6 of 31
(20,818 Views)
Have u solved the problem connecting mpu9250 to myrio?
0 Kudos
Message 7 of 31
(20,180 Views)

I was also playing with the code recently. Thank you OP for posting this code available!

 

I figured out that the sdi and sdo need to be swapped in Andy's wiring setup to get the reading. This is because myRIO by default can only work as a master, so pin 25 is MOSI which corresponds to SDI on 9250, whereas, pin 23 is MISO which should be connected to SDO on 9250.

 

Andy's understanding of nCS is right, nCS needs to be low when communicating thru SPI. For the case we only have one 9250, nCS can also be directly connected to ground. For the case multiple slaves are on the line, each slave needs its own Digital IO nCS control when communicating.

 

 

0 Kudos
Message 8 of 31
(19,656 Views)

Sorry, I made a mistake in my previous post, the nCS pin needs to be connected to a DIO for data transmission control, it needs to be low (active) at start and high (inactive) at the end. Only connecting it to ground will not work.

0 Kudos
Message 9 of 31
(19,648 Views)

QQ图片20150722092042.png

thx very much for sharing this vi! it helps alot! but do you know why i can't get the date from y accel? Thanks.

0 Kudos
Message 10 of 31
(19,640 Views)