LSM9DS1 driver

Introduction

The LSM9DS1 driver for inertial measurement is used in conjunction with the LSM9DS1 inertial measurement unit to measure the values of roll, pitch, and heading. The LSM9DS1 provides these readings through the use of a gyroscope, an accelerometer and a magnetometer.

Note: if the IMU used can measure its heading (has a magnetometer) then the heading readings will be supplied instead of yaw data.


Driver Parameters

The LSM9DS1 driver for the LSM9DS1 IMU has two parameters that need to be configured:

M I2C Address

This is the address through which the magnetometer can be interfaced. The address is fixed at 0x1e.

AC I2C Address

This is the address through which the accelerometer and the gyroscope can be interfaced. The address is fixed at 0x6b.


Wiring

Example

On the LSM9DS1 sensor the SDA and SCL ports are connected to the SDA and SCL ports on the Builder Base. The GND and VDD ports on the chip are then connected to the GND and 3.3V ports on the Builder Base respectively.

Breadboard 

Schematic 

Used Pins

Used Pins

Description

Used Pins

Description

SCL

Serial Clock Line

SDA

Serial Data Line

5V 

This pin provides the power

GND

This pin provides the GND


How to write an App

Navigate to the App Builder and create a new application. You can find the “IMU” code object under the “Hardware” Tab in the object drop down menu on the left, or you can also use the search bar.

 

 

 

 

 

 Drag the “IMU” object onto the grid.

Next, locate the “Text” Object under the Interface tab and drag five of them onto the grid.

 

 

Finally, connect the “IMU”, “Roll”, “Pitch”, “Yaw”, and “Heading” ports from the IMU Object block to the “In” ports on each of their respective text blocks, name each of the text blocks accordingly, and save your application.


How to create a firmware

Navigate to the Firmware Builder and create a new firmware file.

Click the “+ Add Hardware” button and listed under the “Sensors” tab find the “Distance Measurement” hardware option.

Give your device a name, and click “Add Device”

 

Next, select the “LSM9DS1” under the driver dropdown menu.

 

For this example we select:

  • M I2C address: 0x1e

  • AC I2C address: 0x6b

You may now save your firmware file and upload it to one of your clients.

 

 


Supported Hardware

  • LSM9DS1


Downloads

Apps

Firmware

Assets