# LSM303DLHC e-compass (GY-511): specs and pinout

> A module built around the LSM303DLHC chip, which combines a 3-axis accelerometer and a 3-axis magnetometer (e-compass) with a temperature sensor,…

[HTML version](https://soldr.ai/docs/components/lsm303dlhc-gy-511)

[Docs](https://soldr.ai/docs) / [Components](https://soldr.ai/docs/components)

A module built around the LSM303DLHC chip, which combines a 3-axis accelerometer and a 3-axis magnetometer (e-compass) with a temperature sensor, read over I2C. The figures here are for the chip, not the module board.

Every value cites its sourceOfficial pinout

[Buy on Compoden](https://compoden.com/products/gy-511-lsm303dlhc-3-axis-e-compass-sensor-module-0348)

## Specs

| Spec | Value | Source |
|---|---|---|
| Supply voltage (Vdd) | 2.16 V to 3.6 V | source Features, p.1; Table 5 Electrical characteristics |
| I/O supply voltage (Vdd_IO) | 1.71 V to Vdd plus 0.1 V | source Table 5 Electrical characteristics, p.12 |
| Interface | I2C, standard (100 kHz) and fast (400 kHz) modes; external pull-ups required | source Features, p.1; 2.4 Communication interfaces |
| I2C address, accelerometer | 0011001b (0x19), 7-bit | source 5.1.2 Linear acceleration digital interface |
| I2C address, magnetometer | 0011110b (0x1E), 7-bit | source 5.1.3 Magnetic field digital interface |
| Acceleration full scale | plus or minus 2 g, 4 g, 8 g or 16 g selectable | source Features, p.1; Table 3 |
| Magnetic full scale | plus or minus 1.3, 1.9, 2.5, 4.0, 4.7, 5.6 or 8.1 gauss selectable | source Features, p.1; Table 3 |
| Data output | 16 bit | source Features, p.1 |
| Operating temperature | -40 C to +85 C | source Description, p.1; Table 3 |
| Current consumption, normal mode | 110 uA typical (magnetometer 7.5 Hz, accelerometer 50 Hz output rate) | source Table 5, note 2, p.12 |

## Power

| | Value | Source |
|---|---|---|
| Supply | Vdd 2.16 V to 3.6 V; Vdd_IO 1.71 V to Vdd plus 0.1 V | source Table 5, p.12 |
| Current | 110 uA typical in normal mode (magnetometer 7.5 Hz, accelerometer 50 Hz) | source Table 5, p.12 |

## Pinout

The module board is not covered by an official document. Its regulator, pull-up resistors, address jumpers, level handling and header order are not documented by a source; check the printed labels on the board. The numbers on this page are for the chip.

| Pin | Function | Voltage | Notes | Source |
|---|---|---|---|---|
| 1 | Vdd_IO | | Power supply for I/O pins | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 2 | SCL | | Signal interface I2C serial clock | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 3 | SDA | | Signal interface I2C serial data | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 4 | INT2 | | Inertial interrupt 2 | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 5 | INT1 | | Inertial interrupt 1 | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 6 | C1 | | Reserved capacitor connection (C1) | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 7 | GND | | 0 V supply | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 8 | Reserved | | Leave unconnected | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 9 | DRDY | | Data ready | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 10 | Reserved | | Connect to GND | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 11 | Reserved | | Connect to GND | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 12 | SETP | | S/R capacitor connection (C2) | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 13 | SETC | | S/R capacitor connection (C2) | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |
| 14 | Vdd | | Power supply | source 1.2 Pin description, Table 2, p.9 (LGA-14 chip) |

## Build with it
Project ideas for the LSM303DLHC e-compass (GY-511). Each link opens Soldr with the prompt filled in; Soldr assigns the pins, checks power and shows how to wire every part.

- [Compass heading display](https://app.soldr.ai/?prompt=I%20want%20to%20build%20a%20compass%20heading%20display%20with%20an%20ESP32%2C%20an%20LSM303DLHC%20e-compass%20module%20and%20an%20OLED%20display): The chip runs at 3.3 V on I2C (magnetometer address 0x1E), matching the ESP32 and the OLED. Hold it level and away from magnets and iron, which shift the reading. Learning project, not for navigation.
- [Tilt angle display](https://app.soldr.ai/?prompt=I%20want%20to%20build%20a%20tilt%20angle%20display%20with%20an%20ESP32%2C%20an%20LSM303DLHC%20e-compass%20module%20and%20an%20OLED%20display): The accelerometer (address 0x19) reads gravity on three axes at plus or minus 2 g, from which the ESP32 computes tilt for the OLED.
- [Shake counter](https://app.soldr.ai/?prompt=I%20want%20to%20build%20a%20shake%20counter%20with%20an%20ESP32%2C%20an%20LSM303DLHC%20e-compass%20module%20and%20an%20LED): Spikes in the accelerometer reading are counted by the ESP32, and an LED with a resistor from the packs flashes on each one. Learning project.

## Common mistakes

- Powering the chip from 5 V: Vdd is 2.16 V to 3.6 V (source: [link](https://www.pololu.com/file/0J564/LSM303DLHC.pdf), Table 5). Check how the module board handles a higher supply.
- Using one address: the accelerometer answers at 0x19 and the magnetometer at 0x1E, so both must be addressed separately (source: [link](https://www.pololu.com/file/0J564/LSM303DLHC.pdf), sections 5.1.2 and 5.1.3).
- No pull-ups on SDA and SCL: external pull-up resistors are required for standard and fast mode (source: [link](https://www.pololu.com/file/0J564/LSM303DLHC.pdf), section 2.4).

## Not covered by the official source

- ST&#x27;s own site returned no PDF to this machine, so the verbatim copy of the maker&#x27;s document on a mirror was used.
- The magnetometer address is given as the 7-bit value 0011110 from section 5.1.3.

## Sources

- [link](https://www.pololu.com/file/0J564/LSM303DLHC.pdf) (LSM303DLHC Ultra-compact high-performance eCompass module, ST, DocID018771 Rev 2, November 2013; verbatim maker PDF on a mirror)
