Forum Rule: Always post complete source code & details to reproduce any issue!

# Thread: Best way to connect 6 IMUs to Teensy 4

1. ## Best way to connect 6 IMUs to Teensy 4

Hi,

Can someone point the differences or best possible way to connect 6 IMUs to a Teensy 4.0.

1. Connect them using a TCA9548A I2C Multiplexer (i2c multiplexer to create separate i2c buses for each of the sensors).

2. Or place two on each I2C bus of the teensy SL0*2 + SL1*2 + SL2*2 using the two addresses of the IMU

Example;
In I2C mode, this selects the LSb of the I2C address (SD0_M)
In I2C mode, this selects the LSb of the I2C address (SD0_AG)

#if SDO
#else

3. Is it possible to switch between the 6 IMUs one bus USING digital pins?

IMU1
(SD0_M) + (SD0_AG) = 1

IMU2
(SD0_M) + (SD0_AG) = 0

IMU3
(SD0_M) + (SD0_AG) = 0

IMU4
(SD0_M) + (SD0_AG) = 0

IMU5
(SD0_M) + (SD0_AG) = 0

IMU6
(SD0_M) + (SD0_AG) = 0

Then,

IMU1
(SD0_M) + (SD0_AG) = 0

IMU2
(SD0_M) + (SD0_AG) = 1

IMU3
(SD0_M) + (SD0_AG) = 0

IMU4
(SD0_M) + (SD0_AG) = 0

IMU5
(SD0_M) + (SD0_AG) = 0

IMU6
(SD0_M) + (SD0_AG) = 0

Do this 6 times in a loop (using a digital pin to select), where the address that is high is of interest to me in the sequence?

I have read up on this. I'm a beginner with great interest. Can someone point out the best method for speed, consider using the same microcontroller? It would be deeply appreciated.

Jeffrey

2. Which IMUs?

EDIT: nevermind, saw the code snippet of LSM9DS1.

I haven't worked with that IMU, but just based off the fact that SPI is available, my initial reaction would be to go with SPI. Put all the IMUs on one SPI bus with different chip select pins. Maybe someone with experience with that IMU can chime in...

3. Interesting, how to connect 6 IMUs to Teensy ? o((>ω< ))o

4. Originally Posted by brtaylor
Which IMUs?

EDIT: nevermind, saw the code snippet of LSM9DS1.

I haven't worked with that IMU, but just based off the fact that SPI is available, my initial reaction would be to go with SPI. Put all the IMUs on one SPI bus with different chip select pins. Maybe someone with experience with that IMU can chime in...
Hi, Thank you for your reply and advice. I'm familiar with I2C but haven't looked yet at SPI. Yes, I'm familiar with LSM9DS1, but MPU9250 is of interest to me also.

5. Using all three I2C ports may give you 3x the sampling rate that you would get with a multiplexer. Answering the following questions might get more complete responses:

1. What are your desired and minimum acceptable sampling rates?
2. Do all 6 IMUs need to be sampled at the same rate?
3. What level of precision do you need? (Will oversampling and filtering be needed?)

6. Originally Posted by TeensyJeffrey
Hi, Thank you for your reply and advice. I'm familiar with I2C but haven't looked yet at SPI. Yes, I'm familiar with LSM9DS1, but MPU9250 is of interest to me also.
MPU9250 is way faster on SPI than I2C. It's been several years since I tested the performance, but if I recall correctly it's something around 22 us to get data from one IMU on SPI and around 200 us to do that over I2C. Which tends to be the case with most sensors, you typically will get much faster reads over SPI.

7. Originally Posted by mborgerson
Using all three I2C ports may give you 3x the sampling rate that you would get with a multiplexer. Answering the following questions might get more complete responses:

1. What are your desired and minimum acceptable sampling rates?
2. Do all 6 IMUs need to be sampled at the same rate?
3. What level of precision do you need? (Will oversampling and filtering be needed?)
.

Hi, sample rates, I wouldn't be sure of as of yet. I wanted to run tests initially to come to a conclusion.
Yes, all devices need to be sampled at the same rate. Same project/ with same measurements of interest.
I was looking at one-degree accuracy, but I wanted to demo the sensor first? Yaw is of interest to me (z-axis rotation)

Thank you

8. Originally Posted by brtaylor
MPU9250 is way faster on SPI than I2C. It's been several years since I tested the performance, but if I recall correctly it's something around 22 us to get data from one IMU on SPI and around 200 us to do that over I2C. Which tends to be the case with most sensors, you typically will get much faster reads over SPI.
Thank you, again. To be honest, I have always been backward when it comes to SPI. Maybe, I'm overthinking it or just use to I2C. I will look into it over the next few days. Some really good points :-) cheers

9. Originally Posted by TeensyJeffrey
.

Hi, sample rates, I wouldn't be sure of as of yet. I wanted to run tests initially to come to a conclusion.
Yes, all devices need to be sampled at the same rate. Same project/ with same measurements of interest.
I was looking at one-degree accuracy, but I wanted to demo the sensor first? Yaw is of interest to me (z-axis rotation)

Thank you
Just to be clear, IMUs don't measure angles, they measure angular rates (i.e. deg/s), acceleration (m/s/s) and sometimes magnetic field (uT). You'll need a filter to estimate the attitude from those measurements. Depending on the dynamics and the filter, pitch and roll accuracy around 1-2 degrees is possible. Yaw is much more difficult, typically you're happy if you get yaw angle to within 5 degrees.

10. Originally Posted by brtaylor
Just to be clear, IMUs don't measure angles, they measure angular rates (i.e. deg/s), acceleration (m/s/s) and sometimes magnetic field (uT). You'll need a filter to estimate the attitude from those measurements. Depending on the dynamics and the filter, pitch and roll accuracy around 1-2 degrees is possible. Yaw is much more difficult, typically you're happy if you get yaw angle to within 5 degrees.
Hi, yes I have converted these rates already to Euler angles and through filters. Yes, I noticed Yaw is worst off. Pitch and roll are around 1 degree.

11. Some IMUs do conversion internally to DCM/quaternion/etc, which is very handy as all the complexity of combining sensors
is done for you and calibrated... But if you just have bare sensors on an IMU make sure there's a matching library that does
most of the work for you if possible.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•