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 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.1

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.1
File Size Uploaded Provenance Actions
circuitpython_adxl36x-0.2.1.tar.gz 19.4 kB With provenance Details for circuitpython_adxl36x-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 38.8 kB

Release files / circuitpython_adxl36x-0.2.1.tar.gz

Download URL circuitpython_adxl36x-0.2.1.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
20afc4240f3be52c34277e8d941f692de0b616b7aacb54a64e38982e1527e531
BLAKE2b-256 checksum
How to use checksums
ce6e43aea0417dc0f878b80ad590f4cde3df4a4fee6303014dce8dff52f6d7ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 15, 2026.

Transparency log

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

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

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 Nov 15, 2026.

Transparency log

Security for circuitpython-adxl36x 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for circuitpython_adxl36x-0.2.1.tar.gz

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 Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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