I am trying to find the simplest way to connect multiple (preferably around 10-20) IMU sensors to one controller. There are two constraints: sampling at 60Hz and reasonably simple wiring as I want to put it on clothes.

I am totally new to the Arduino world, please let me know what other details I should provide.

It seems that just having multiple IMUs on the I2C bus would work great, but they usually all come with the same address.

So, the solutions I found so far:

  • Using several different IMUs from different companies - hard to find 20 of them
  • Using a multiplexer - requires star-like wiring topology.
  • Using multiple controllers - inefficient and doesn't seem right.

For now, the solution with a multiplexer seems to me the most reasonable, but is there any other way I am missing? Can I somehow produce IMUs with, say, 16 different addresses and wire them all together to one I2C?

Thanks for your help!


If you're using MPU6050 IMUs, there's an easy trick: put them all on the I2C bus, and connect each IMU's AD0 pin to a separate digital pin on the Arduino[*]. When you want to read from a specific IMU, set all AD0s to HIGH, except the one you want to read to LOW. All the IMUs with AD0 set to HIGH with have an I2C address of 0x69, whereas the only one on LOW will have an address of 0x68.

If you want to read them all, you just go through a loop and set the one you want to LOW, the others to HIGH, and you're set.

[*] If you want 20 IMUs, you'd better get a Mega, or, even better, a Maple. Small form factor, quite a bit of oomph, lots of pins and flash, and some clones cost next to nothing; eg Itead sells Maple clones for 6 bucks. ElecFreaks sells them for 9 bucks. You could use the 16 pins at the bottom for the AD0s.

This trick works with any kind of I2C device that has a customizable address scheme through one or more pins. I do that with AT24Cxx EEPROMS, which have a 0x50-57 address range. When you want to have more than eight chips, setting all but one to 0x50 and one to 0x51 solves the problem pronto.

Reference: https://github.com/PaulStoffregen/FreeIMU_original/blob/master/documents/PS-MPU-6000A-00v3.4.pdf

| improve this answer | |
  • 3
    That's a pretty clever idea! – Nick Gammon Jan 5 '17 at 6:56
  • 4
    And coming from you, that's a nice compliment, Nick! – dda Jan 5 '17 at 6:56

You can also get I2C Multiplexers such as the TCA9545A that can split one I2C line into 4 buses. I have connected up to 9 MPU9150 on one line with that.

| improve this answer | |

Another way is to use a software emulation of the I2C interface so that any of the digital I/O pins may act as an I2C pin. One well-written library you can use for this is SoftWire by Steven Marple. It can be installed via the Arduino Library Manager or directly from its GitHub repository here.

With this, you can select arbitrary pairs of pins to act as SDA and SCL for each I2C device and then you can communicate with each device individually.

Note that with this method, you need two digital pins for each I2C device. In that sense, I believe @dda's answer is the best in regard to these IMUs in question.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.