AED 45.15
Description
LSM303 Module is a triple-axis accelerometer and magnetometer module integrated with LSM303 IC from STMicroelectronics features a 3D digital linear acceleration and a 3D digital magnetic sensor device. It can also measure the dynamic acceleration resulting from motion, shock, or vibration., provides 16-bit data output via the I2C interface. When this module is placed in a magnetic field, according to the Lorentz law an excitation current induces in its microscopic coil. The compass module converts this current to the differential voltage for each coordinate direction. This module can be used in a lot of projects such as Arduino based compasses, Arduino based Position detection, Map rotation, Pedometers.
Specifications:
- Power supply: 3-5V
- Model: GY-511
- 3 magnetic field channels and 3 acceleration channels
- From ±1.3 to ±8.1 gauss magnetic field full scale
- ±2g/±4g/±8g/±16g linear acceleration full scale
- 16-bit data output
- I²C serial interface
- Power-down mode / low-power mode
- 2 independent programmable interrupt generators for free-fall and motion detection
- Embedded temperature sensor
- Embedded FIFO
- 6D/4D-orientation detection
- chip built-in 12 bit AD converter, 16 bits of data output
- Pin Pitch 2.54 mm
- Size(L x W): 20.5mm x 14.5mm
Application of LSM303 Module
- Tilt-compensated compasses
- Map rotation
- Position detection
- Motion-activated functions
- Free-fall detection
- Click/double-click recognition
- Pedometers
- Intelligent power-saving for handheld devices
- Display orientation
- Gaming and virtual reality input devices
- Impact recognition and logging
- Vibration monitoring and compensation
Package Included:
1 x LSM303DLHC e-Compass 3 axis Accelerometer and 3 axis Magnetometer Module
LSM303DLHC GY-511 Module Pinout:
Pin |
Name |
Description |
1 |
GND |
Ground (It grounds the input and completes the circuit path) |
2 |
3.3V |
Power Supply (It is Recommended Voltage) |
3 |
SDA |
Serial Data (Serial Data used for I2C communication) |
4 |
SCL |
Serial Clock (Serial Clock used for I2C serial clock) |
5 |
INT1 |
Inertial Interrupt 1 (It is External Interrupt Request 1 Enable) |
6 |
INT2 |
Inertial Interrupt 2 (It is External Interrupt Request 1 Enable) |
7 |
DRDY |
Data Ready (It is an output that functions as a new data ready indicator) |
8 |
VIN |
It is for the main 2.5 V to 5.5 V power supply connection |
Arduino Code For the LSM303 Module:
In this code, you need to download the LSM303 library for the compass module. You can download it by clicking here: LMS303.h Library
#include
#include
LSM303 compass;
LSM303::vector running_min = {32767, 32767, 32767}, running_max = {-32768, -32768, -32768};
char report[80];
void setup() {
Serial.begin(9600);
Wire.begin();
compass.init();
compass.enableDefault();
}
void loop() {
compass.read();
running_min.x = min(running_min.x, compass.m.x);
running_min.y = min(running_min.y, compass.m.y);
running_min.z = min(running_min.z, compass.m.z);
running_max.x = max(running_max.x, compass.m.x);
running_max.y = max(running_max.y, compass.m.y);
running_max.z = max(running_max.z, compass.m.z);
snprintf(report, sizeof(report), "min: {%+6d, %+6d, %+6d} max: {%+6d, %+6d, %+6d}",
running_min.x, running_min.y, running_min.z,
running_max.x, running_max.y, running_max.z);
Serial.println(report);
delay(100);
}
compass.init();
compass.enableDefault();