Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython
Raspberry Pi Raspberry Pi Pico Projects

ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython

Mamtaz AlamBy Mamtaz AlamUpdated:July 24, 20254 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview

This tutorial explains how to interface the ADXL375 Accelerometer module with the Raspberry Pi Pico using MicroPython Code.

This is the ADXL375 module, which is a digital MEMS accelerometer from Analog Devices. The sensor is small and thin, with ultra-low power consumption as low as 35 µA in measurement mode.  The best thing about this sensor is that it can measure acceleration up to ±200 g. Imagine reading such a high gravitational pull of the Earth or measuring the acceleration of a very fast-moving object—here, the ADXL375 is perfect.

ADXL375 Accelerometer
Fig: ADXL375 Accelerometer Module

In this tutorial, we will first go through the ADXL375 features, capabilities, pinout, and other details. Then, we will show you how you can use the ADXL375 accelerometer with Raspberry Pi Pico using MicroPython code.

Components Required

The following are the components required for making this guide.

S.N.Components NameQuantityPurchase Link
1Raspberry Pi Pico1Amazon | AliExpress
2ADXL375 Accelerometer1Amazon | AliExpress
3Connecting Wires10Amazon | AliExpress
4Breadboard1Amazon | AliExpress



ADXL375 Accelerometer

The ADXL375 is a small, thin, 3-axis accelerometer that provides low power consumption and high resolution measurement up to ±200 g.

ADXL375
Fig: ADXL375 Accelerometer Module

The digital output data is formatted as 16-bit, two’s complement data and is accessible through a SPI or I2C digital interface. It supports a bandwidth of up to 1 Kilo Hertz. The bandwidth is selectable via Serial Command. An integrated memory management system with a 32-level FIFO buffer can be used to store data to minimize host processor activity and lower overall system power consumption.

ADXL375 Functional Diagram
Fig: ADXL375 Functional Diagram

The sensor has the ability to determine shock, even, or could be used in an activity or inactivity monitoring system. One shocking thing to notice about this module is, it has a 10,000g shock survival, which is amazing. According to the datasheet, it could be used for concussion and head trauma detection, and also for high-force event detection. To learn more about the ADXL375 Module, you may go through the ADXL375 Datasheet.

ADXL375 Features & Specifications

  • Measurement Range: ±200 g (fixed) with 13-bit two ’s-complement output
  • Sensitivity: 49 mg/LSB (0.049 g/LSB) → ~0.4805 mg resolution when converted to m/s²
  • Power Consumption:
    • Measurement mode: 35 µA typical
    • Standby mode: 0.1 µA typical (VS = 2.5 V)
    • Note: Supply current varies with output data rate/bandwidth setting
  • Output Data Rate / Bandwidth:
    • User-selectable via serial registers
    • Bandwidth up to 1 kHz (ODR up to 1 kHz)
  • FIFO Buffer: 32-sample watermark FIFO reduces host-processor load
  • Event Detection:
    • Single-tap / double-tap (impulse) detection
    • Activity/inactivity monitoring with programmable thresholds & durations
  • Digital Interfaces:
    • I²C (7-bit address = 0x53 when ALT_ADDRESS = LOW)
    • SPI (3- or 4-wire)
  • Supply Voltage: 2.0 V to 3.6 V
  • I/O Voltage Range: 1.7 V to VS
  • Operating Temperature: –40 °C to +85 °C
  • Shock Survivability: 10,000 g (non-operating)
  • Package / RoHS: 3 × 5 × 1 mm LGA, RoHS-compliant



Hardware Connection between Raspberry Pi Pico & ADXL375 Accelerometer

First, let’s perform basic testing of ADXL375 with the Raspberry Pi Pico. Here is the simple schematic

Raspberry Pi Pico ADXL375 Accelerometer

We can connect the ADXL375 to the Raspberry Pi Pico via the I²C interface.

ADXL375 MicroPython Raspberry Pi Pico

We can simplify the breadboard wiring with jumper cables and ensure the ADXL375 is oriented as shown on the breakout board.

Source Code/Program: Getting Acceleration Readings

Lets develop a basic MicroPython sketch to get Acceleration reading on all the 3-axis for ADXL375 & Raspberry Pi Pico

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from machine import Pin, I2C
import time
 
class ADXL375:
    _REG_BW_RATE   = 0x2C
    _REG_POWER_CTL = 0x2D
    _REG_DATA      = 0x32
    _SCALE = 0.049 * 9.80665  # g-scale → m/s²
 
    def __init__(self, i2c, addr=0x53):
        self.i2c  = i2c
        self.addr = addr
        if addr not in self.i2c.scan():
            raise OSError("ADXL375 not found at 0x%02X" % addr)
 
        # Standby → 100 Hz → Measure
        self._write(self._REG_POWER_CTL, 0x00)
        time.sleep_ms(10)
        self._write(self._REG_BW_RATE, 0x0A)
        self._write(self._REG_POWER_CTL, 0x08)
        time.sleep_ms(10)
 
    def _write(self, reg, val):
        self.i2c.writeto_mem(self.addr, reg, bytes([val]))
 
    def _read(self, reg, n):
        return self.i2c.readfrom_mem(self.addr, reg, n)
 
    def _twos_comp(self, val, bits=16):
        # convert unsigned to signed (two's complement)
        if val & (1 << (bits - 1)):
            val -= (1 << bits)
        return val
 
    def read_raw(self):
        buf = self._read(self._REG_DATA, 6)
        # little-endian, manual two’s-comp
        x = buf[0] | (buf[1] << 8)
        y = buf[2] | (buf[3] << 8)
        z = buf[4] | (buf[5] << 8)
        return (self._twos_comp(x),
                self._twos_comp(y),
                self._twos_comp(z))
 
    def read_mps2(self):
        x, y, z = self.read_raw()
        return (x * self._SCALE,
                y * self._SCALE,
                z * self._SCALE)
 
# ——— Example ——————————————————————————————
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
 
try:
    accel = ADXL375(i2c)
except OSError as e:
    print(e)
    while True:
        time.sleep(1)
 
print("ADXL375 ready!")
 
while True:
    x, y, z = accel.read_mps2()
    print("X:{:+6.2f} Y:{:+6.2f} Z:{:+6.2f} m/s²".format(x, y, z))
    time.sleep_ms(500)

Copy the above code and paste it on the editor window of Thonny IDE. Run this code, you will see the Acceleration data on the terminal window for all the x, y, and z axes.

The x and y data should be almost zero as the sensor is placed on a flat surface. The z-axis data should be almost 9.8 m/s2 due to the gravitational pull of the Earth. But it’s showing some offset readings. That’s why you modified the MicroPython code for auto calibration.



Source Code/Program: Read Acceleration with Auto Calibration

Here is the modified code for reading the correct values of acceleration in the x, y, and z axis.

We first average 100 readings with the board held flat to compute x_offset, y_offset, and z_offset = avg_z – 9.80665 m/s². Then, on each loop, we subtract those offsets from the raw readings so that X/Y read ~0 and Z reads ~9.8 m/s² when the sensor is level.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
from machine import Pin, I2C
import time
 
# Standard gravity (m/s²)
G = 9.80665
 
class ADXL375:
    _REG_BW_RATE   = 0x2C
    _REG_POWER_CTL = 0x2D
    _REG_DATA      = 0x32   # DATAX0..DATAZ1
    _SCALE = 0.049 * G      # 0.049 g/LSB → m/s²
 
    def __init__(self, i2c, addr=0x53):
        self.i2c    = i2c
        self.addr   = addr
        # calibration offsets (m/s²)
        self.x_offset = 0.0
        self.y_offset = 0.0
        self.z_offset = 0.0
 
        # check device present
        if addr not in self.i2c.scan():
            raise OSError("ADXL375 not found at 0x%02X" % addr)
 
        # Standby → 100 Hz → Measure
        self._write(self._REG_POWER_CTL, 0x00)
        time.sleep_ms(10)
        self._write(self._REG_BW_RATE, 0x0A)   # 100 Hz
        self._write(self._REG_POWER_CTL, 0x08) # Measure on
        time.sleep_ms(10)
 
    def _write(self, reg, val):
        self.i2c.writeto_mem(self.addr, reg, bytes([val]))
 
    def _read(self, reg, n):
        return self.i2c.readfrom_mem(self.addr, reg, n)
 
    def _twos_comp(self, val, bits=16):
        if val & (1 << (bits - 1)):
            val -= (1 << bits)
        return val
 
    def read_raw(self):
        buf = self._read(self._REG_DATA, 6)
        x = buf[0] | (buf[1] << 8)
        y = buf[2] | (buf[3] << 8)
        z = buf[4] | (buf[5] << 8)
        return (
            self._twos_comp(x),
            self._twos_comp(y),
            self._twos_comp(z),
        )
 
    def read_mps2(self):
        x, y, z = self.read_raw()
        return (
            x * self._SCALE,
            y * self._SCALE,
            z * self._SCALE,
        )
 
    def calibrate(self, samples=100, delay_ms=20):
        """Auto-calibrate: assume sensor is flat & still."""
        sum_x = sum_y = sum_z = 0.0
        for _ in range(samples):
            x, y, z = self.read_mps2()
            sum_x += x
            sum_y += y
            sum_z += z
            time.sleep_ms(delay_ms)
        avg_x = sum_x / samples
        avg_y = sum_y / samples
        avg_z = sum_z / samples
 
        # X/Y→0, Z→+1 g
        self.x_offset = avg_x
        self.y_offset = avg_y
        self.z_offset = avg_z - G
 
        print("Calibration complete:")
        print("  x_offset = {:.4f} m/s²".format(self.x_offset))
        print("  y_offset = {:.4f} m/s²".format(self.y_offset))
        print("  z_offset = {:.4f} m/s²".format(self.z_offset))
 
# ——— Example usage ——————————————————————————————————————————
 
# I2C0: GP0=SDA, GP1=SCL
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
 
try:
    accel = ADXL375(i2c)
except OSError as e:
    print(e)
    while True:
        time.sleep(1)
 
# Auto-calibrate (keep Pico + ADXL375 flat & still during this)
accel.calibrate()
 
print("\nReading calibrated acceleration (m/s²):\n")
while True:
    x, y, z = accel.read_mps2()
    # subtract offsets
    x -= accel.x_offset
    y -= accel.y_offset
    z -= accel.z_offset
 
    print("X:{:+6.2f}  Y:{:+6.2f}  Z:{:+6.2f}".format(x, y, z))
    time.sleep_ms(500)

Run this code again. The reading will be correct now.

To observe the change in reading, shake the sensor or move the sensor, or jerk it. You will see a massive change in the reading.

This is how you can interface the ADXL375 accelerometer with Raspberry Pi Pico using the MicroPython code.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleSecuring IoT Devices With Microchip ATECC608A
Next Article Why DIY IoT Prototype Fails at Scale: Hidden Component‑Sourcing Trap

Related Posts

Interface BMI160 with Raspberry Pi Pico & MicroPython

Interface BMI160 with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Updated:February 2, 202513K
Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Modbus RTU with Raspberry Pi Pico & Micropython

Modbus RTU with Raspberry Pi Pico & MicroPython

Updated:February 2, 20258K
Fever Detector with MLX90640 & OpenCV Raspberry Pi

Thermal Fever Detector with MLX90640 & OpenCV Raspberry Pi

Updated:February 2, 20256K
Thermal Imaging Camera with MLX90640 & Raspberry Pi

DIY Thermal Imaging Camera with MLX90640 & Raspberry Pi

Updated:May 2, 2026618K
Add A Comment

CommentsCancel reply

Latest Posts
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

May 31, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

February 1, 2026
Top Posts & Pages
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • How to use INA219 DC Current Sensor Module with Arduino
    How to use INA219 DC Current Sensor Module with Arduino
  • Designing of MPPT Solar Charge Controller using Arduino
    Designing of MPPT Solar Charge Controller using Arduino
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
    ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (204)
    • ESP32 MicroPython (7)
    • ESP32 Projects (81)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.