NAME
Device::Accelerometer::LSM303DLHC - I2C interface to Accelerometer on the LSM303DLHC 3 axis magnetometer(compass) and accelerometer using Device::SMBus
VERSION
version 0.012
ATTRIBUTES
I2CDeviceAddress
Contains the I2CDevice Address for the bus on which your Accelerometer is connected. It would look like 0x6b. Default is 0x19.
gCorrectionFactor
This is a correction factor for converting raw values of acceleration in units of g or gravitational acceleration. It depends on the sensitivity set in the registers.
gravitationalAcceleration
This is the acceleration due to gravity in meters per second square usually represented as g. default on earth is around 9.8 although it differs from 9.832 near the poles to 9.780 at equator. This might also be different if you are on a different planet or in space.
mssCorrectionFactor
This attribute is built from the above two attributes automatically. This is usually gCorrectionFactor divided by gravitationalAcceleration. This is the inverse of relation between raw accelerometer values and its value in meters per seconds.
METHODS
enable
$self->enable()
Initializes the device, Call this before you start using the device. This function sets up the appropriate default registers. The Device will not work properly unless you call this function
getRawReading
$self->getRawReading()
Return raw readings from accelerometer registers
getAccelerationVectorInG
returns four acceleration vectors with accelerations in multiples of g - (9.8 meters per second square) note that even when stationary on the surface of earth(or a earth like planet) there is a acceleration vector g that applies perpendicular to the surface of the earth pointing opposite of the surface.
getAccelerationVectorInMSS
returns four acceleration vectors with accelerations in meters per second square note that even when stationary on the surface of earth(or a earth like planet) there is a acceleration vector g that applies perpendicular to the surface of the earth pointing opposite of the surface.
getAccelerationVectorAngles
returns coordinate angles between the acceleration vector(R) and the cartesian Coordinates(x,y,z).
getRollPitch
returns Roll and Pitch from the accelerometer. This is a bare reading from accelerometer and it assumes gravity is the only force on the accelerometer, which means it will be quiet inaccurate for a accelerating accelerometer.
calibrate
placeholder for calibration function
REGISTERS
CTRL_REG1_A
CTRL_REG4_A
OUT_X_H_A
OUT_X_L_A
OUT_Y_H_A
OUT_Y_L_A
OUT_Z_H_A
OUT_Z_L_A
CONSTANTS
PI
AUTHOR
Shantanu Bhadoria <shantanu at cpan dott org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Shantanu Bhadoria.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.