Reading I2C and getting Quaternions from Razor IMU M0

I have been searching for how to read the Razor IMU M0 from the I2C bus very little success. What is even more troubling is that the information I found doesnt appear to that you can get back quaternions when you read from the I2C bus. It seems as though you get back data from sensors separately. I need to get the fused quaternion data to my processor that has bluetooth, so I can transmit it to my computer.

A HUGE reason why I purchased this device was because it gave you data in quaternions and didnt require a calibration practice.

  1. What do you need to do to make quaternion data accessible from the I2C bus?

  2. Could someone direct me to how I can read the 9dof Razor IMU M0 from the I2C bus

  3. Do you need to push data into the FIFO buffer so that it can be read from the I2C bus

Thank you

  1. What do you need to do to make quaternion data accessible from the I2C bus?

The Razor IMU M0 really isn’t meant to be used as a I2C device, it’s more of a serial device that reads it’s own sensors via I2C. You could probably write your own firmware to create a new I2C bus and send data out to another system via that I2C bus, but the I2C bus the board has now is meant for attaching more sensors too, not for communication with another system. We have a [tutorial on SAMD21 SERCOMs that you might check out that explains how to create a new I2C bus on the SAMD21. (That’s the processor that runs the Razor M0.)

  1. Could someone direct me to how I can read the 9dof Razor IMU M0 from the I2C bus

You really can’t for the reasons stated above. With the right firmware, you might be able to pull off a multi master I2C setup though. We don’t have firmware that does that so you would have to write your own.](Adding More SERCOM Ports for SAMD Boards - SparkFun Learn)

I apologize for the amount of time its taken to thank you for your assistance. I appreciate the information you have provided.

I am new this, so I’m likely to ask some ‘uninformed’ questions, although I am consuming information as quickly as I can.

Is there another way to do get this information? I have a separate processor (BlueFruit LE) that I have on the same breadboard. That processor is intended to send the data I receive from the Razor and other sensors via Bluetooth to my computer. Could I communicate via serial, using the Razor IMU to get the quaternions data back over serial channel (via the RX/TX) hardware lines. My guess is that the communication between the BlueFruit LE and the Razor would work something like a terminal program. If it is possible, I dont know how much and how fast I get the data over serial lines but this seems like a plausible way to achieve my goal.

I will investigate the information you have provided. I am hoping there are flexible ways to get the information from the IMU. I am open to any ideas.

Thank you

The easiest way to get that data would be to use a USB enabled controller like a Pi and plug the Razor into one of the Pi’s USB ports. (USB is the default method of retrieving data from the Razor.)

The second easiest way to get the data would be over UART, (serial) but even then you will need to modify the firmware a bit. Check the “Serial Output Through Hardware UART Pins” section of our [hookup guide for the details on what to modify to enable the RX/TX pins.

Doing things over I2C should be possible but it’s going to involve custom firmware for sure and manipulating the SERCOMs on the board to create a second I2C bus for external communication since the sensors and SAMD21 on the board are connected over the first bus.

Is there another way to do get this information? I have a separate processor (BlueFruit LE) that I have on the same breadboard. That processor is intended to send the data I receive from the Razor and other sensors via Bluetooth to my computer. Could I communicate via serial, using the Razor IMU to get the quaternions data back over serial channel (via the RX/TX) hardware lines. My guess is that the communication between the BlueFruit LE and the Razor would work something like a terminal program. If it is possible, I dont know how much and how fast I get the data over serial lines but this seems like a plausible way to achieve my goal.](https://learn.sparkfun.com/tutorials/9dof-razor-imu-m0-hookup-guide)

The second easiest way to get the data would be over UART, (serial) but even then you will need to modify the firmware a bit. Check the “Serial Output Through Hardware UART Pins” section of our hookup guide for the details on what to modify to enable the RX/TX pins.

Excellent. I’ll be doing that, since using the USB (except for debugging) would be contrary to my plans for utilizing BLE to communicate the sensor information to the computer.

Doing things over I2C should be possible but it’s going to involve custom firmware for sure and manipulating the SERCOMs on the board to create a second I2C bus for external communication since the sensors and SAMD21 on the board are connected over the first bus.

I naively thought you could get the same information over I2C that you could obtain directly from the IMU but just couldnt find that information. This is when you informed me of the use of SERCOMs. After going over that documentation and getting a better understanding of what is possible, I’m not sure I’ll gain anything with using the SERCOM over utilizing the UART. It will be more work without any gain of functionality or pins. Using the UART might even gain some benefits.

Thank you for your patients and sharing of wisdom. It was really beneficial.

The idea is to use a second serial channel (SERCOM) that is configured as an i2c port to communicate with the ble processor (leaving the existing i2c port to communicate with the IMU chip itself). The firmware would need to be changed to configure this port and send the data to it rather than the UART. What that would give is an I2C port for communications (per your original request) instead of a UART. If you can work with the UART, that would be easier.

/mike