LSM303DLM Tilt Compensated Compass

Pololu LSM303DLM Tilt Compensated Compass
Click to enlarge
Model: LSM303DLM
Manufacturer: Pololu
Average Rating: Not Rated

Pololu

LSM303DLM Tilt Compensated Compass

The LSM303DLM combines a digital 3-axis accelerometer and 3-axis magnetometer into a single package that is ideal for making a tilt-compensated compass. The six independent readings, whose sensitivities can be set in the ranges of ±2 to ±8 g and ±1.3 to ±8.1 gauss, are available through an I²C interface. This LSM303 carrier board includes voltage regulators and a level-shifting circuit that allows operation from 2.6 to 5.5 V, and the 0.1" pin spacing makes it easy to use with standard solderless breadboards and 0.1" perfboards.

Note: This board is a higher-performance drop-in replacement for the original LSM303DLH 3D compass and accelerometer carrier with voltage regulators. In general, this board can be used interchangeably with the original LSM303DLH version, but note that our original LSM303DLH Arduino library will not fully work with this board (magnetometer Y and Z output registers have been swapped on the LSM303DLM). If you were previously using our LSM303DLH library, you should switch to our newer LSM303 library instead, which works with both the DLH and DLM versions.

The LSM303 sensor has many configurable options, including dynamically selectable sensitivities for the accelerometer and magnetometer, a choice of output data rates, and two independently-programmable external inertial interrupt pins. The magnetometer and accelerometer can be individually turned on and off to save power, and a special sleep-to-wakeup function allows the accelerometer to sleep until an inertial interrupt is triggered. The six independent magnetic and acceleration readings (sometimes called 6DOF) are available through an I²C/TWI interface and can be used for many applications, including making a tilt-compensated compass that can be used to determine headings regardless of how the board is inclined (ST provides an application note that explains the details of making one).

The carrier board includes two voltage regulators that provide the 1.8 V and 3 V required by the LSM303 sensor, which allows sensor to be powered from a single 2.6 – 5.5 V supply. The regulator outputs are available on the 1V8 and 3V pins and can supply almost 150 mA and 300 mA, respectively, to external devices. The breakout board also includes a circuit that shifts the I²C clock and data lines to the same logic voltage level as the supplied VIN, making it simple to interface the board with 3.3 V or 5 V systems, and the board’s 0.1" pin spacing makes it easy to use with standard solderless breadboards and 0.1" perfboards.

Specifications

  • Dimensions: 0.5" × 0.9" × 0.1" (13 × 23 × 3 mm)
  • Weight without header pins: 0.84 g (0.03 oz)
  • Operating voltage: 2.6 to 5.5 V
  • Supply current: 10 mA
  • Output format (I2C):
    • Accelerometer: one 12-bit reading (left-justified) per axis
    • Magnetometer: one 12-bit reading (right-justified) per axis
  • Sensitivity range (configurable):
    • Accelerometer: ±2, ±4, or ±8 g
    • Magnetometer: ±1.3, ±1.9, ±2.5, ±4.0, ±4.7, ±5.6, or ±8.1 gauss

Included components

A 9×1 strip of 0.1" header pins and a 9×1 strip of 0.1" right-angle header pins are included.

Pinout

PIN Description
VIN This is the main 2.6 – 5.5 V power supply connection. The SCL and SDA level shifters pull the I²C bus high bits up to this level.
GND The ground (0 V) connection for your power supply. Your I²C control source must also share a common ground with this board if the two do not share the same power supply.
1V8 Regulated 1.8 V output. Almost 150 mA is available to power external components.
3V Regulated 3.0 V output. Almost 300 mA is available to power external components.
SCL Level-shifted I²C clock line: HIGH is VIN, LOW is 0 V
SDA Level-shifted I²C data line: HIGH is VIN, LOW is 0 V
DRDY Magnetometer data ready indicator, a 1.8V-logic-level output. HIGH (1.8 V) indicates magnetometer data can be read. LOW (0 V) indicates the magnetometer is writing new data to the data registers. This output is not level-shifted.
INT1 Inertial interrupt 1, a 1.8V-logic-level output. This output is not level-shifted.
INT2 Inertial interrupt 2, a 1.8V-logic-level output. This output is not level-shifted.

 

I²C Communication

The LSM303DLM readings can be queried and the device can be configured through the I²C bus. The module acts as two chained I²C slave devices, with the accelerometer and magnetometer clock and data lines tied together to the same I²C bus to ease communication. Additionally, level shifters on the I²C clock (SCL) and data lines (SDA) enable I²C communication with microcontrollers operating at the same voltage as VIN (2.6 – 5.5V).

The accelerometer and the magnetometer have separate slave addresses on the I²C bus. The magnetometer’s slave address cannot be changed. The accelerometer’s 7-bit slave address has its least significant bit (LSb) determined by the voltage on the slave address selector pad (SA0_A). The carrier board pulls SA0_A to ground through a 4.7kΩ resistor. If the accelerometer’s selected slave address happens to conflict with some other device on your I²C bus, it is possible to access SA0_A through the untented via on the bottom of the board and pull it up.

Protocol Hints

The user’s guide provides all the information you need to use this sensor, but picking out the important details can take some time. Here are some pointers for communicating with and configuring the LSM303DLM that we hope will get you up and running a little bit faster:

  • The magnetometer and accelerometer are off by default. You have to turn them on by setting the correct configuration registers.
  • The magnetometer will not update its data until all 6 data bytes have been read during a single I²C transfer. All the bytes can be read in the same transfer using the the magnetometer’s automatic subaddress updating feature (this feature is enabled by default).
  • The accelerometer also has an automatic subaddress updating feature, if you assert the most significant bit of the subaddress. The accelerometer does not require you to read all of the output bytes before updating by default.
  • The accelerometer and magnetometer combined in this IC are made by separate manufacturers, so there are fairly significant differences in their features, functionality, and interfaces.

Inertial Interrupts

The inertial interrupts (INT1 and INT2) are highly configurable 1.8V-level outputs that can change due to accelerations (the magnetometer has no effect on INT1 or INT2). If the sleep-to-wakeup feature of the accelerometer is enabled, when an interrupt is triggered, the accelerometer wakes up.

Sample Code

We have written a basic Arduino library for this LSM303 carrier board that makes it easy to interface this sensor with an Arduino board. The library makes it simple to read the raw accelerometer and magnetometer data, and it has a function for computing the tilt-compensated heading for those looking to use this sensor as a tilt-compensated compass.

We also provide an AVR Studio project that demonstrates how to use an Orangutan robot controller to interface with the LSM303DLM and make a tilt-compensated compass. The project is set up for an ATmega328P microcontroller.
This needs to be modified very slightly to work with LSM303DLM (the magnetometer Y and Z output registers need to be swapped)

Documents:

 

Write Review
Your Name:


Your Review: Note: HTML is not translated!

Rating: Bad            Good

Enter the code in the box below:

LSM303DLM Tilt Compensated Compass
Click to enlarge
LSM303DLM Tilt Compensated Compass
Click to enlarge
LSM303DLM Tilt Compensated Compass
Click to enlarge
LSM303DLM Tilt Compensated Compass
Click to enlarge
LSM303DLM Tilt Compensated Compass
$ 14.40 New In Stock
Shopping Cart
0 items
 
DELIVERY/PAYMENT

Free Delivery Orders over £50

UK - £2.40 orders under £50
Airmail from £2.95 (+VAT)
More Details...

 
Brands
 
 Check out our videos
Follow us on:
acebook