Skip to content

How To Change the Accelerometer Sensitivity in Circuit Playground Express and Circuit Python

I recently ran into a situation that I wanted to know if I could adjust the sensitivity of the accelerometer on the Circuit Playground Express board made by Adafruit. Turns out that you can, but requires a little bit of hacking to do so:

import adafruit_lis3dh
from adafruit_circuitplayground.express import cpx

cpx._lis3dh.range = adafruit_lis3dh.RANGE_16_G

The accelerometer is the LIS3DH device developed by ST. There are actually 4 different settings for the accelerometer:

  • ±2g – RANGE_2_G
  • ±4g – RANGE_4_G
  • ±8g (default) – RANGE_8_G
  • ±16g – RANGE_16_G

The ‘g’ represents gravity (9.8 meters per second^2) and the lower the setting, the higher the sensitivity. Setting it to RANGE_2_G will enable you to detect smaller changes in acceleration, but will also mean that you miss out on the bigger changes. Vice versa, RANGE_16_G will desensitize things, meaning you won’t pick up the smaller changes as much, but the bigger changes you’ll see better.

Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *