The Adafruit ADXL326 is a small, thin, low-power, triple-axis accelerometer with signal conditioned voltage outputs. It is capable of measuring acceleration up to ±16 g. It is designed to measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion, shock, or vibration. Common applications include:
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (1.8V to 3.6V) |
2 | GND | Ground connection |
3 | XOUT | Analog voltage output for X-axis |
4 | YOUT | Analog voltage output for Y-axis |
5 | ZOUT | Analog voltage output for Z-axis |
6 | ST | Self-test pin (leave unconnected if not used) |
To use the ADXL326 in a circuit:
// Include the Arduino Wire library for I2C
#include <Wire.h>
// ADXL326 outputs are analog and need to be read using analog pins
const int xPin = A0;
const int yPin = A1;
const int zPin = A2;
void setup() {
// Initialize serial communication at 9600 baud rate
Serial.begin(9600);
}
void loop() {
// Read the analog values from the accelerometer
int xValue = analogRead(xPin);
int yValue = analogRead(yPin);
int zValue = analogRead(zPin);
// Convert the analog values to acceleration in g's
float xG = (xValue - 512) * (16.0 / 1024.0);
float yG = (yValue - 512) * (16.0 / 1024.0);
float zG = (zValue - 512) * (16.0 / 1024.0);
// Print the acceleration values to the serial monitor
Serial.print("X: ");
Serial.print(xG);
Serial.print("g, Y: ");
Serial.print(yG);
Serial.print("g, Z: ");
Serial.print(zG);
Serial.println("g");
// Delay before the next reading
delay(100);
}
Q: Can the ADXL326 be used with a 5V system? A: While the ADXL326 is rated for 1.8V to 3.6V, a logic level converter should be used when interfacing with a 5V system.
Q: How can I improve the accuracy of the sensor? A: Calibration is key. Perform a calibration routine at startup and consider implementing a filtering algorithm to smooth out the data.
Q: What is the purpose of the ST pin? A: The ST pin is used for self-testing the sensor. When activated, it can help verify that the sensor is functioning correctly.
Q: How do I interpret the analog output values? A: The output is proportional to the acceleration measured. You'll need to convert the analog readings to g's using the sensitivity factor provided in the technical specifications.
For further assistance, consult the Adafruit ADXL326 datasheet and additional resources provided by Adafruit.