Skip to main content

LSM6DS3TR-C MicroPython Library

The LSM6DS3TR-C is an always-on 3D accelerometer and 3D gyroscope that includes additional built-in functions such as:

  • Pedometer
  • Tap and double tap recognition
  • Significant motion and tilt detection
  • Free-fall detection

Example Program

An example showing the basic setup and reading of the Gyro and Accelerometer.

from machine import I2C
from lsm6ds3 import LSM6DS3, NORMAL_MODE_104HZ
import time

i2c = I2C(0, scl=13, sda=12)
sensor = LSM6DS3(i2c, mode=NORMAL_MODE_104HZ)

while True:
    ax, ay, az, gx, gy, gz = sensor.get_readings()
    print("Accelerometer\nX:{}, Y:{}, Z:{}\nGyro\nX:{}, Y:{}, Z{}\n\n ".format(ax, ay, az, gx, gy, gz))
    time.sleep(1.0)

Functions

.get_readings()

Get the current X Y Z values from the Accelerometer and Gyro. Returns ax ay az gx gy gz

Output:

>>> sensor.get_readings()
(-5839, -5124, -10199, 192, 12030, 24831)

.get_step_count()

Get the current number of steps detected by the sensor. Returns an integer value.

Output:

>>> sensor.get_step_count()
29

.reset_step_count()

Reset the step counter to 0

.tilt_detected()

Returns 1 if the sensor detects tilt on the X Y or Z axis and 0 if no tilt detected.

.sig_motion_detected()

Returns 1 if the sensor detects significant motion and 0 if no significant motion detected.

.single_tap_detected()

Returns 1 if the sensor detects a single tap on the X Y or Z axis and 0 if no tap detected.

.double_tap_detected()

Returns 1 if the sensor detects a double tap on the X Y or Z axis and 0 if no double tap detected.

.freefall_detected()

Returns 1 if the sensor detects it is currently in free fall and 0 if no free fall detected.

Release files for lsm6ds3-micropython 0.0.3

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

Source distribution (sdist)

Source distribution for lsm6ds3-micropython 0.0.3
File Size Uploaded
lsm6ds3_micropython-0.0.3.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lsm6ds3-micropython 0.0.3
File Interpreter ABI Platform
lsm6ds3_micropython-0.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 8.0 kB

Release files / lsm6ds3_micropython-0.0.3.tar.gz

Download URL lsm6ds3_micropython-0.0.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7689c6765e1bd16d4b2f0d894b03217794d71e8173a665a5a48a3f5a69e597c8
BLAKE2b-256 checksum
How to use checksums
61c4600445b7e40feb3b2d38a5dc4f8cb80d52ed9915683a1a7d1b61ade6ef21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / lsm6ds3_micropython-0.0.3-py2.py3-none-any.whl

Download URL lsm6ds3_micropython-0.0.3-py2.py3-none-any.whl
Size 4.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
37f7a8bd2cf0c618cdc89816016a7aebf4c869152622a6b243b818a2468d2658
BLAKE2b-256 checksum
How to use checksums
c4805d079b4e61ccf9067518fe3a53ac38465bf1d363aa0b930722d446ddfa2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

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