I'd like to connect 12 mpu9250 sensors to one arduino board.
I can't find documentation on how to change the addresses of mpu9250 boards. (i read through the reference ). Some tutorials talk about changing addresses for other device so i assume it is possible for mpu9250.
I realize that mpu9250 might be too specific, so general guidance on how to solve these problems would be highly appreciated.
mpu9250 is similar to more popular mpu9150 and mpu6050. It is also known as GY-9250
The MPU-6050 can have 2 addresses on the I2C bus with the AD0 pin. I didn't read all 4 datasheets, but since the MPU-9250 also has a AD0 pin, I assume it can be set to one of the two I2C addresses.
That means you can have only two MPU-9250 on the I2C bus. If you want more, you have to use a multiplexer.
Using 12 sensors on the I2C bus is very slow.
The SPI bus is fast and has no problem with the addresses, but you need a chip select per sensor.
That means that you need a total of 15 pins.
Which Arduino board do you use ? If you use a 5V Arduino board, you need a level shifter for 15 SPI signals.
Where is all that data going ? 12 sensors with 9 axis each is 216 bytes for a single sample of all sensors.
Do you know a good library for the MPU-9250 in SPI mode ? Or are you going to develop that yourself ?
Seems like spi is a way to go in my case. but i'd have to read tutorials. I don't know a good library and i'm not sure that I will put time into writing one. I might just use 6 arduino boards with 2 sensors for each.
I use mega, it has 3.3v. but I might order arduino nano or pro mini to use with 2 i2c sensors.
The Mega board has three spare serial ports. If you use three Pro Mini boards each with 2 sensors, you can transmit the data to a Serial port of the Mega. The Mega collects it and transmits it to the computer. But that is only for 6 sensors.
For I2C you might need a hardware mux for the I2C, to have more than 2 sensors with an Arduino.
Do you have a good library for I2C for the MPU-9250 ?
Did you try a single MPU-9250 to test if you can measure what you want ?
I'm not sure how to do you project with I2C. Do you ?
multiplexer is a good way to go but SPI might be just better since i have enough pins or i can use a multiplexer. i'm also looking into raspbery pi since it has an spi library already.
For now i might just keep it simple and have 6 arduinos connecting through bluetooth to the computer.
The richards-tech library is looking good. Very consistant code. I give it 9 points out of 10.
It uses a copy of the i2cdevlib.
The i2cdevlib itself has no support for the MPU-9250 yet, only for MPU-9150. I think they are almost the same, they have a different magnetometer inside, but I don't know if that means that the code is different.
For SPI you would need a working example for the MPU-9250.... I think you are stuck with I2C for the moment.
A Raspberry Pi with SPI and 12 sensors ? I like that. Go for it
SPI is only with short wires, I hope you know that.
The length of the I2C bus is limited by capacitance. With 4 wires in a standard ribbon cable, you can run into problems around 10cm if you don't choose your layout properly. With high-current drivers the bus can be quite long. There's no easy answer for "how long."
SPI doesn't have the same limitation. I've used 10-ft high-speed SPI a few times with no problems.