How do I use SPI on LIS3DH?

How can I use the SPI protocol on the piccodev LIS3DH as it only has SDA, SCL, 3.3V, GND, INT1 and INT2 ports. In the description on the LIS3DH it says that it is compatible with both i2c and spi. Thanks!

1 Like

The LIS3DH chip supports I2C and SPI, but the LIS3DH Piicodev module from Core supports I2C only. The connectors you have listed correspond to the Core module, so I guess that is the module you are referring to. There are modules from other vendors that support SPI - you can identify them by the SDI, SDO and CS connection points.

2 Likes

Oh, I see. Thanks.

2 Likes

IS3DH Piicodev module from Core supports I2C only. However, The LIS3DH chip supports I2C and SPI. Here is an example of the SPI communication of LIS3DH. Here you’ll find the example code and circuit diagram.
https://learn.sparkfun.com/tutorials/lis3dh-hookup-guide/all#example-spi-and-fifo-usage
The SPI interface operates at 3.3v, so use a logic level converter if you use it with a 5V board.

You can also think about using a HMC6343 Accelerometer Module instead.

The HMC6343 is a solid-state compass module with tilt compensation from Honeywell. The HMC6343 has three axis of magneto, three axis of accelerometer, and a core running all the calculations. What you get is a compass heading over I2C that stays the same even as you tilt the board. Solid-state (and many classic water based) compasses fail badly when not held flat. The tilt compensated HMC6343 is crucial for those real-world compass applications.

1 Like