I need to connect 6 LIS3DH Accelerometers to a Raspberry Pi. Is this possible, and how would I do this? Do I need to use I2C or SPI? Or do I need something like an I2C multiplexer?

(If another type of accelerometer would be better, that would be OK as well.)

  • 1
    You can use I2C or SPI. If you use I2C it is probably more efficient if you use a hardware I2C multiplexor. You need to decide yourself which option is best for you.
    – joan
    Jan 10, 2019 at 16:24

1 Answer 1


If you are not short on GPIOs, use SPI.

The main difference between SPI and I²C is that I²C uses device addresses to talk to a given device. Of course, those addresses need to be unique on the I²C bus, and that's the problem. The address is pre-set by the manufacturer, and of course, same devices get the same address. Some devices allow to change the address freely, often via I²C, but this requires that no other device with same address is connected at that time. Some devices do not allow to change the address. And some, like the LIS3DH allow to change it a little.
The LIS3DH has a single pin, which, connected either to GND or Vsupply, sets the lowest bit of the address to 1 or 0.
So, you can connect two LIS3DH to a single I²C bus. For six, you either need three buses, or a I²C Multiplexer. A multiplexer is like a relay, allowing to connect one of many I²C buses to the master, and is often controlled via I²C itself.

SPI does not use addresses. Here, each device has a ChipSelect pin (CS). The CS pins of all devices are connected to Vsupply, except that of the device the master wants to communicate with. For your project you can connect all six LIS3DH in parallel to the SPI pins of the Pi, and each CS pin to one GPIO of the Pi. To talk to one device, set its GPIO to 0, and the other five to 1.

While the SPI costs six GPIO pins, it is much easier to setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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