control multible Mirror Shields with ESP32 Thing

Hi everybody,

I would like to connect 4 ESP32 Thing Motion Shields to one ESP32 Thing.

I understand that I have to do that with I2C or with SPI. But I got the following problems:

I2C:

The problem with the I2C bus is that the address is assigned via pin SDO_M / SDO_AG. From this I understand that only two different addresses can be assigned. But since I want to connect 4 sensor modules, this is not an option.

SPI:

For SPI, the device is selected via the CS line. But for the ESP Thing Motion Shield the CS line of the LSM9DS1 is not available.

Is my understanding right? It is possible on another way?

Thanks for your help.

Best Regards

rob0204

Hi rob0204,

Unfortunately, there is not really an easy way to use four of these shields with an ESP32 Thing. All of the pins for using the LSM9DS1 in SPI mode are tied high to set the IMU in I2C mode and to set the I2C address to default. There are a couple of ways around this but none of them are simple. One option would be to use a [MUX so you can have multiple I2C devices with the same address on a single bus. The issue here is you would not be able to stack them effectively and would need extra boards to get everything working properly. Technically, you could just break out the I2C pins from the Motion Shield and run those to something like the Qwiic MUX Breakout but again, it’s not a very elegant fix.

The other option would require physically modifying the board to re-route the SPI pins that are pulled high via resistors to the SPI pins on your ESP32 Thing. The pins in question are tied to the cluster of four resistors next to the 3-pin JST connector for a GPS module. Essentially, you would just need to remove those resistors and then run wire from the pads tied to the IMU to the SPI pins on the ESP32 Thing.

If you want to go this route, I would recommend reading through the [Hookup Guide for the breakout of the LSM9DS1 to familiarize yourself with the pins on the IMU and what you would need to enable SPI and I would recommend downloading and reviewing the Eagle design files. You can download these from the “Documents” tab on the [product page. One last note about using SPI with this shield is you will need I/O pins for both CS lines on each LSM9DS1 so, with four of these, you will need 8 free I/O pins along with the SPI pins.

I hope this information helps outline some options you may have here to get multiple ESP32 Thing Motion Shields running on a single ESP32 Thing. Let us know if you have any other questions about this and we would be happy to help as much as we can.](SparkFun ESP32 Thing Motion Shield - DEV-14430 - SparkFun Electronics)](LSM9DS1 Breakout Hookup Guide - SparkFun Learn)](Mux - SparkFun Electronics)

Hi TS-Mark,

Thank you very much. I’ve already thought something like that.I prefer the SPI solution.

You wrote that I need 8 I/O Pins for the CS wire. Is that a must have or can I use also Input-Only-Pins, like for example Pin 36 of the ESP32 Thing?

So when I remove the Resistor 9 and 11 of the motion shield and connect these CS-Pins with the ESP32 Thing like shown in the image. And I would use the SD-Cards from the shields via SPI too, would it work?

Thank you for your help!

BR rob0204

Unfortunately, you are not going to be able to use input only pins for CS as the microcontroller/master device needs to drive those pins LOW to initiate data transmission on the bus.

Also, you need to break out the data pins for the accel/gyro and magnetometer (SDO AG and SDO M, respectively). You can net them together on MISO. The SPI Hardware Hookup from [this section of the guide for the LSM9DS1 shows all of the connections needed to use this IMU with SPI.](https://learn.sparkfun.com/tutorials/lsm9ds1-breakout-hookup-guide#hardware-hookup)