12-01-2014 02:13 PM
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!
12-02-2014 03:11 PM - last edited on 10-13-2024 11:00 PM by Content Cleaner
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.
https://forums.ni.com/t5/Example-Programs/ct-p/code-documents
12-30-2014 09:01 PM
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
12-31-2014 11:31 AM
Hey Andy,
The MPU-9250 Product Specification document walks through configuring the SPI interface. Check out page 26.
Happy New Year!
01-02-2015 03:31 AM
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
01-05-2015 12:14 PM - last edited on 10-13-2024 11:00 PM by Content Cleaner
05-10-2015 08:55 AM
07-21-2015 12:45 PM - edited 07-21-2015 12:49 PM
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.
07-21-2015 02:01 PM
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.
07-21-2015 08:28 PM
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.