Skip to main content

A python module to enable a Raspberry Pi to access an LSM9DS1 IMU sensor.

Project description



This is a device driver that enables a Raspberry Pi to access an LSM9DS1 IMU sensor.

The LSM9DS1 combines a 3D accelerometer, 3D rate gyroscope and a 3D magnetometer. It's useful in robotics and other applications for measuring a robot's attitude and movement. The LSM9DS1 is made by ST Microelectronics. The datasheet is available from their website.

Low cost breakout boards are available from various vendors including Adafruit and Sparkfun.

Driver Features

  • Connects with I2C or SPI
  • Preconfigured for 230 Hz output data rate
  • Converts accelerometer and gyro output to use the same axes as the magnetometer by flipping the direction of the x axis.
  • Detects data ready in software or with an optional GPIO hardware interrupt.
  • Provides raw, unscaled data. i.e. max acceleration is 32768 not 2g.
  • Extensible
  • Optionally enables high priority thread scheduling


  • Not a complete implementation of the sensor's API.


This driver returns raw unscaled data. This is a deliberate choice to make it easier to scale the data with your application.

Data Ready

If you don't check for data ready and just read data then you will miss some samples. Worse than that, in some cases you'll read part of one sample and part of the next. This provides plausible looking but incorrect data. You must wait for data ready before reading the sensor values. See the examples.


Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lsm9ds1-rjg, version 0.9.2
Filename, size File type Python version Upload date Hashes
Filename, size lsm9ds1_rjg-0.9.2-py3-none-any.whl (13.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size lsm9ds1-rjg-0.9.2.tar.gz (9.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page