lsm6ds3-micropython


Namelsm6ds3-micropython JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryMicroPython device library for the LSM6DS3TR-C IMU
upload_time2024-09-04 11:17:27
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "lsm6ds3-micropython",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Ryan <ryan@pimoroni.com>",
    "download_url": "https://files.pythonhosted.org/packages/61/c4/600445b7e40feb3b2d38a5dc4f8cb80d52ed9915683a1a7d1b61ade6ef21/lsm6ds3_micropython-0.0.3.tar.gz",
    "platform": null,
    "description": "# LSM6DS3TR-C MicroPython Library\n\nThe LSM6DS3TR-C is an always-on 3D accelerometer and 3D gyroscope that includes additional built-in functions such as:\n\n- Pedometer\n- Tap and double tap recognition\n- Significant motion and tilt detection\n- Free-fall detection\n\n# Example Program\nAn example showing the basic setup and reading of the Gyro and Accelerometer. \n\n```\nfrom machine import I2C\nfrom lsm6ds3 import LSM6DS3, NORMAL_MODE_104HZ\nimport time\n\ni2c = I2C(0, scl=13, sda=12)\nsensor = LSM6DS3(i2c, mode=NORMAL_MODE_104HZ)\n\nwhile True:\n    ax, ay, az, gx, gy, gz = sensor.get_readings()\n    print(\"Accelerometer\\nX:{}, Y:{}, Z:{}\\nGyro\\nX:{}, Y:{}, Z{}\\n\\n \".format(ax, ay, az, gx, gy, gz))\n    time.sleep(1.0)\n```\n\n# Functions\n\n### `.get_readings()`\n\nGet the current X Y Z values from the Accelerometer and Gyro. Returns `ax` `ay` `az` `gx` `gy` `gz`\n\n#### Output:\n```\n>>> sensor.get_readings()\n(-5839, -5124, -10199, 192, 12030, 24831)\n```\n### `.get_step_count()`\nGet the current number of steps detected by the sensor. Returns an integer value.\n\n#### Output:\n```\n>>> sensor.get_step_count()\n29\n```\n### `.reset_step_count()`\nReset the step counter to 0\n\n### `.tilt_detected()`\nReturns `1` if the sensor detects tilt on the X Y or Z axis and `0` if no tilt detected.\n\n### `.sig_motion_detected()`\nReturns `1` if the sensor detects significant motion and `0` if no significant motion detected.\n\n### `.single_tap_detected()`\nReturns `1` if the sensor detects a single tap on the X Y or Z axis and `0` if no tap detected.\n\n### `.double_tap_detected()`\nReturns `1` if the sensor detects a double tap on the X Y or Z axis and `0` if no double tap detected.\n\n### `.freefall_detected()`\nReturns `1` if the sensor detects it is currently in free fall and `0` if no free fall detected.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "MicroPython device library for the LSM6DS3TR-C IMU",
    "version": "0.0.3",
    "project_urls": {
        "GitHub": "https://www.github.com/pimoroni/lsm6ds3-micropython",
        "Homepage": "https://www.pimoroni.com"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c4805d079b4e61ccf9067518fe3a53ac38465bf1d363aa0b930722d446ddfa2e",
                "md5": "a0fdba4939ad0b98ae5a400d60425e34",
                "sha256": "37f7a8bd2cf0c618cdc89816016a7aebf4c869152622a6b243b818a2468d2658"
            },
            "downloads": -1,
            "filename": "lsm6ds3_micropython-0.0.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0fdba4939ad0b98ae5a400d60425e34",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 4839,
            "upload_time": "2024-09-04T11:17:26",
            "upload_time_iso_8601": "2024-09-04T11:17:26.643791Z",
            "url": "https://files.pythonhosted.org/packages/c4/80/5d079b4e61ccf9067518fe3a53ac38465bf1d363aa0b930722d446ddfa2e/lsm6ds3_micropython-0.0.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "61c4600445b7e40feb3b2d38a5dc4f8cb80d52ed9915683a1a7d1b61ade6ef21",
                "md5": "69839f8717722834f7adcaad98218331",
                "sha256": "7689c6765e1bd16d4b2f0d894b03217794d71e8173a665a5a48a3f5a69e597c8"
            },
            "downloads": -1,
            "filename": "lsm6ds3_micropython-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "69839f8717722834f7adcaad98218331",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3189,
            "upload_time": "2024-09-04T11:17:27",
            "upload_time_iso_8601": "2024-09-04T11:17:27.999592Z",
            "url": "https://files.pythonhosted.org/packages/61/c4/600445b7e40feb3b2d38a5dc4f8cb80d52ed9915683a1a7d1b61ade6ef21/lsm6ds3_micropython-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-04 11:17:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pimoroni",
    "github_project": "lsm6ds3-micropython",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lsm6ds3-micropython"
}
        
Elapsed time: 0.46844s