Difference between revisions of "Matrix - 3-Axis Digital Accelerometer"
From FriendlyELEC WiKi
Line 3: | Line 3: | ||
==Introduction== | ==Introduction== | ||
[[File:3AD.png|thumb|3-Axis Digital Accelerometer]] | [[File:3AD.png|thumb|3-Axis Digital Accelerometer]] | ||
− | + | This module measures the static acceleration of gravity in three axis x, y and z resulting from motion or shock. Its digital interface is IIC or SPI. It is integrated with an ADXL345 chip with high resolution (13-bit) measurement at ±2g, ±4g, ±8g and ±16g. The module is powered by 5V and converts 5V to 3.3V to ADXL345. | |
− | + | ||
− | This module measures the static acceleration of gravity in three axis x, y and z resulting from motion or shock. Its digital interface is IIC or SPI. It is integrated with an ADXL345 chip | + | |
Revision as of 07:28, 5 August 2015
Contents
1 Introduction
This module measures the static acceleration of gravity in three axis x, y and z resulting from motion or shock. Its digital interface is IIC or SPI. It is integrated with an ADXL345 chip with high resolution (13-bit) measurement at ±2g, ±4g, ±8g and ±16g. The module is powered by 5V and converts 5V to 3.3V to ADXL345.
2 Features
- SPI/I2C,3.3V
- 13-bit,up to +-16g
- 2.54mm spacing pin interface
3 How To
3.1 Connection
- Connect Tiny4412 SDK (1506)
- GND: Ground
- VCC: 5V
- INT2:N/A
- INT1: N/A
- CS: 5V
- SCL: I2C SCL
- SDA: I2C SDA
- SDO: 5V for slave address
3.2 Code Sample in C Under Linux
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "libfahw-adxl34x.h" int main(int argc, char ** argv) { char *position = (char *) malloc(32); memset(position, 0, 32); if (adxl34xRead(position) > 0) { printf("Get position: %s", position); } else { printf("Fail to get position\n"); } free(position); return 0; }
3.3 Compile and Run
git clone http://github.com/friendlyarm/fa-hardware.git cd fa-hardware cd demo cd matrix-3_axis_digital_accelerometer make
Copy your compiled bin to your board and you are ready to go.