Adafruit Circuit Playground

I’ve got my hands on an Adafruit Circuit Playground and have managed to get most all of the sensors working apart from the LIS3DH 3-axis accelerometer.
There is a patch for this at xod-dev/st-mems/lis3dh-accelerometer but it connects via I2C, and unfortunately the Circuit Playground has decided to connect it via SPI.
From the manual “The LIS3DH is connected to the hardware SPI pins (to leave the I2C pins free) and has the chip select (CS) pin on digital pin #8 and an optional interrupt output on digital pin #7 (also known as IRQ #4)”
Can anyone help me to get this thing running via SPI?

If you haven’t done so already, check which version of the Adafruit Circuit Playground you have:

It appears that the classic version has the accelerometer on SPI, but the express version uses I2C.

Classic
If you have the classic version, you can try this library:
https://xod.io/libs/wayland/lis3dh-accelerometer-spi/

I’ve not tested this library, because I don’t have a lis3dh breakout board with an SPI interface.

Express
If you have the express version, you’ll need the I2C version of my library:
https://xod.io/libs/wayland/lis3dh-accelerometer/

This library has been tested extensively. According to the Adafruit library for the Circuit Playground, the accelerometer is on Wire1 (i.e. the 2nd I2C bus). XOD defaults to Wire0 (the first I2C bus), so you need to specify Wire1 using this node:
https://xod.io/libs/wayland/i2c-additional-buses/i2c-wire1/

The lis3dh-accelerometer library includes an example patch that uses Wire1:
https://xod.io/libs/wayland/lis3dh-accelerometer/example-wire1/

Wayland, you are a champion!
My unit is a classic clone by duinotech so it is definitely SPI not I2C.
Your library worked first time. All I have to do now is play with the numbers its giving me for x,y & z.
Thank you for the library and the speed at which you provided it. It is very much appreciated.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.