mjs513 / FreeIMU-Updates

IMU - FreeIMU Library Zero Drift, Altitude & LSM303 Heading Stability
MIT License
325 stars 160 forks source link

How do I connect 2 IMU boards to the arduino due? #24

Closed duguyiqiu closed 9 years ago

duguyiqiu commented 9 years ago

Hi Mike!

I'm trying to get two IMUs working on a Arduino DUE board at the same time. One is a 10 DOF IMU board (MS5611+HMC5883L+MPU6050) and the other is a 6 DOF IMU (MPU6050 alone).

I connected the 10 DOF IMU to SCL and SDA pins and it's working fine. But when I connected the 6 DOF IMU to SCL1 and SDA1 and modified the address to 0x77 detected by i2c scanner, I couldn't get anything from it (there's nothing shown in the serial monitor).

Then I tried to use Wire1 object instead of Wire object and added the following line to I2Cdev.cpp:

define Wire Wire1

The 6 DOF IMU is still not working.

I was wondering if you have run into this problem before?

Thank you very much!!

mjs513 commented 9 years ago

Hi Yiqiu

Unfortunately there is no simple way for the library to modified to use the SDA1/SCL1 on the due. The wire wire1 trick will not work - will confuse the compiler. The library is very dependent on i2cdevlib from Jeff Rowberg. Suggest you check out the i2cdevlib where someone else asked the same question: http://www.i2cdevlib.com/forums/topic/15-wire-vs-wire1/

I have seen other code that is custom for using both channels and two IMUs. Right now the library does not support that feature. I did read somewhere that it was on Fabio's to do list before he past. You might want to do a google or youtube search to see what you can find.

Or you might be able to use a i2c multiplexer (http://dsscircuits.com/sale/product/dssc0107). But you would still need to do quite a bit of custom coding.

Hope this helps Mike