Parts
You'll need the following hardware to follow this guide:
- Board running CircuitPython. Currently ESP8266 or SAMD21-based boards are supported by CircuitPython. The Feather HUZZAH ESP8266 or Feather M0 boards are great options that can easily be connected to an accelerometer. See the guide on loading MicroPython & CircuitPython firmware on a board for details on loading CircuitPython. Remember you want to run Adafruit CircuitPython and not MicroPython to follow this guide!
- LIS3DH accelerometer breakout board.
- Breadboard, hookup wires, and soldering tools. You'll need to solder headers to the accelerometer breakout, be sure to see the guide to excellent soldering if you're new to it.
Start by following the LIS3DH breakout guide to assemble and test the board. Then continue on below to learn how to wire it to a Feather for use with CircuitPython.
Wiring
There are two ways to connect the LIS3DH accelerometer to a board, either with an I2C or SPI connection. The I2C connection requires just a couple data lines and is the recommended way to use the accelerometer. However if for some reason you can't use I2C the board also supports a SPI interface which uses a few more data lines. See below for details on wiring up either interface to your board.
- LIS3DH Vin to board 3V (or 5V) output - red wire.
- LIS3DH GND to board GND/ground - black wire.
- LIS3DH SCL to board SCL (I2C clock) - orange wire.
- LIS3DH SDA to board SDA (I2C data) - yellow wire.
- LIS3DH Vin to board 3V (or 5V) output - red wire.
- LIS3DH GND to board GND/ground - black wire.
- LIS3DH SCL to board SCK (SPI clock) - orange wire.
- LIS3DH SDA to board MOSI (SPI microcontroller out/sensor in) - yellow wire.
- LIS3DH SDO to board MISO (SPI microcontroller in/sensor out) - green wire.
- LIS3DH CS to board pin #6 (or any free digital I/O pin) - blue wire.
Once the LIS3DH is wired to your board continue on to learn how to install the CircuitPython modules necessary to control it from your Python code.
Text editor powered by tinymce.