If you want to use SPI-
The homepage of the library you mentioned, clearly explains the circuit connections.-
The MPU-9250 pins should be connected as:
- VDD: this should be a 2.4V to 3.6V power source.
- GND: ground.
- VDDI: digital I/O supply voltage. This should be between 1.71V and
- FSYNC: not used, should be grounded.
- INT: (optional) used for the interrupt output setup in
enableDataReadyInterrupt and enableWakeOnMotion. Connect to
interruptable pin on microcontroller.
- SDA / SDI: connect to MOSI.
- SCL / SCLK: connect to SCK.
- AD0 / SDO: connect to MISO.
- nCS: connect to chip select pin. Pin 10 was used in the code snippets
in this document and the included examples, but any digital I/O pin
can be used.
- AUXDA: not used.
- AUXCL: not used.
Each sensor's nCS (chip select pin) needs to be connected to a slave select pin (any digital pin) on the NodeMCU. This allows the NodeMCU toselect which sensor it wants to talk to.
Another easy way of connecting multiple sensors with the same I2C address is by using an I2C multiplexer like the Adafruit TCA9548A
This would allow you to connect up to 8 sensors having the same I2C address. Here's a youtube video explaining how to do so.
However, if you just want connect two MPU9250s, you dont need to do any of this, as the board offers two unique addresses via the AD0 pin-
- 0x68 if AD0 is grounded
- 0x69 if AD0 is pulled high