Skip to main content

circuitpython-adxl36x

PyPI Python versions License: MIT CI Downloads Ruff

CircuitPython driver for the Analog Devices ADXL366 and ADXL367 ultra-low-power 3-axis MEMS accelerometers.

ADXL367 implements the full shared register map and is the base class. ADXL366 subclasses it, adding the pedometer, Z-axis nonlinearity compensation, and activity/inactivity reference readback - the three features the ADXL367 silicon doesn't implement. Both support SPI and I2C.

Relationship to adafruit_adxl34x

This library's public API deliberately mirrors the shape of Adafruit's adafruit_adxl34x driver for the ADXL34x family (.acceleration, .events, enable_tap_detection(), enable_motion_detection(), data_rate) so that code written against a 34x-family chip needs minimal changes to run against a 366/367. The two chip families are not register-compatible — only the driver's Python API shape is shared. Notable differences:

  • range is named g_range here instead — range shadows the Python builtin, and compatibility with the ADXL34x API takes a back seat to that on this one property.
  • No enable_freefall_detection() — the 366/367 has no freefall-detection hardware.
  • Range tops out at RANGE_8_G — the 366/367 doesn't support ±16g.
  • DataRate only has 6 discrete rates (12.5 Hz-400 Hz) vs. the 34x's 16.
  • .events includes many more keys (FIFO, pedometer, ADC/temperature thresholds) since the 366/367 exposes far more interrupt sources.

Supported features

✅ Supported    🚫 Not present on this chip    🚧 Not yet supported by this driver

Feature ADXL367 ADXL366
Acceleration (raw + scaled m/s^2) ✅ ✅
g_range / data_rate ✅ ✅
Power mode (standby / measurement) ✅ ✅
Wake-up mode (wakeup_mode, wakeup_rate) ✅ ✅
Linked/looped activity mode (link_loop_mode) ✅ ✅
Autosleep (autosleep) ✅ ✅
Motion (activity) detection ✅ ✅
Inactivity detection (see note below on free fall) ✅ ✅
Offset trim (offset) ✅ ✅
Sensitivity trim (sens) ✅ ✅
Axis masking (tap_axis, blocked_axes) ✅ ✅
Keep-alive timer (keep_alive_timer) ✅ ✅
FIFO (oldest-saved / stream / triggered) ✅ ✅
Temperature sensor ✅ ✅
External ADC value (adc_value) ✅ ✅
Self-test (self_test()) ✅ ✅
Tap detection (single/double) ✅ ✅
Interrupt mapping (map_interrupt) / .events ✅ ✅
Z-axis nonlinearity compensation 🚫 ✅
Activity/inactivity reference readback 🚫 ✅
Pedometer (pedometer_enabled, steps) 🚫 ✅
Noise modes (low-noise / ultra-low-noise) 🚧 🚧
External ADC as activity/inactivity threshold source 🚧 🚧
External clock 🚧 🚧
External trigger 🚧 🚧

Free fall isn't a separate feature/method - it's a documented usage pattern of absolute (non-referenced) inactivity detection (enable_inactivity_detection(referenced=False)), already fully supported.

The 🚧 rows are real hardware features (confirmed present on both chips, same register addresses, per each chip's own datasheet) that this driver doesn't expose yet - they need either extra wiring/signal sources not on the current breadboard (external ADC input, external clock, external trigger) or aren't yet confirmed as needed by any downstream project (noise modes). Contributions welcome.

Installation

On a CircuitPython board, copy src/adxl36x/ into CIRCUITPY/lib/adxl36x/. No other bundle libraries are required - this driver talks to busio.I2C/busio.SPI directly.

For boards tight on RAM/flash, or if raw source ever fails to compile on-device, each GitHub release also attaches a precompiled .mpy bundle (lib/adxl36x/__init__.mpy) - unzip it and copy lib/adxl36x/ into CIRCUITPY/lib/ instead. It's compatible with any CircuitPython release sharing the same .mpy bytecode version (stable across CircuitPython 9.0.0+ as of this writing) - not just the exact version it was built against.

For host-side development (type checking, tests) in another project:

uv add --editable ~/src/circuitpython-adxl36x

Hardware validation setup

The examples/hw_*.py scripts and examples/hw_checks.py exercise real silicon and are set up to run against a doit_esp32_devkit_v1 board wired to an EVAL-ADXL366Z breakout, over either I2C or SPI:

I2C (hw_sanity_check.py / hw_interactive_check.py - edit their board.I2C() call to busio.I2C(board.D26, board.D33) to match these pins):

Signal GPIO
SDA 33
SCL 26
INT1 27
INT2 14

The EVAL-ADXL366Z has no onboard I2C pull-ups - add external 4.7kOhm pull-ups from SDA and SCL to 3.3V.

SPI (hw_spi_sanity_check.py / hw_spi_interactive_check.py):

Signal GPIO
SCK 18
MOSI 23
MISO 19
CS 26
INT1 27
INT2 14

INT1/INT2 are only needed for the interactive checks (motion/inactivity/tap interrupts, autosleep wake cycle, orientation, pedometer) - the non-interactive sanity checks only need the data bus.

Development

uv sync
uv run ruff check --fix
uv run ruff format
uv run ty check
uv run pytest

Metadata

Release files for circuitpython-adxl36x 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for circuitpython-adxl36x 0.2.0
File Size Uploaded
circuitpython_adxl36x-0.2.0.tar.gz 18.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for circuitpython-adxl36x 0.2.0
File Interpreter ABI Platform
circuitpython_adxl36x-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.3 kB

Release files / circuitpython_adxl36x-0.2.0.tar.gz

Download URL circuitpython_adxl36x-0.2.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
882f6a021f5c44fe118ccecf683a5a9f75b941b4b2ad58799b844ef6161cf531
BLAKE2b-256 checksum
How to use checksums
a843f835448ed83f0be6c1833d3461c971e500a134cb5bd6b15422727a29e8d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / circuitpython_adxl36x-0.2.0-py3-none-any.whl

Download URL circuitpython_adxl36x-0.2.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68ce20173af51f9b84033cddab0419e7e9be36a9c9d65446a2c15418f418ee6e
BLAKE2b-256 checksum
How to use checksums
c0409048b02ad25bd6e0db32dd2f8e34fb2e0d108b1406c102674a8336e68a48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page