The LilyPad Accelerometer ADXL335 is a small, thin, low-power, complete 3-axis accelerometer with signal-conditioned voltage outputs. It measures acceleration with a minimum full-scale range of ±3 g. It can measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (1 mg/LSB) enables the measurement of inclination changes less than 1.0°.
Common applications of the LilyPad Accelerometer include:
Pin Label | Description |
---|---|
X-OUT | X-axis output voltage |
Y-OUT | Y-axis output voltage |
Z-OUT | Z-axis output voltage |
VCC | Power supply (2.0V to 3.6V) |
GND | Ground |
ST | Self-test (activated by logic high input) |
To use the LilyPad Accelerometer in a circuit:
// Include the Arduino core library
#include <Arduino.h>
// Define the analog pins connected to the accelerometer
const int xPin = A0;
const int yPin = A1;
const int zPin = A2;
void setup() {
// Initialize the serial communication
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 xAccel = (xValue - 338.0) / 100.0; // 338 is zero-g voltage for x-axis
float yAccel = (yValue - 338.0) / 100.0; // 338 is zero-g voltage for y-axis
float zAccel = (zValue - 338.0) / 100.0; // 338 is zero-g voltage for z-axis
// Print the acceleration values to the serial monitor
Serial.print("X: ");
Serial.print(xAccel);
Serial.print("g, Y: ");
Serial.print(yAccel);
Serial.print("g, Z: ");
Serial.print(zAccel);
Serial.println("g");
// Delay before the next reading
delay(100);
}
Note: The zero-g voltage and sensitivity may vary slightly from one device to another. Calibration may be required for precise measurements.
Q: Can the LilyPad Accelerometer be washed? A: The LilyPad Accelerometer is designed for use in e-textiles and wearable projects, but it is not waterproof. It should be removed before washing the fabric.
Q: How do I calibrate the accelerometer? A: Calibration involves recording the output at known orientations and adjusting the readings accordingly. Refer to the datasheet for detailed calibration procedures.
Q: What is the purpose of the self-test pin? A: The self-test pin, when set to a logic high, allows you to check the functionality of the accelerometer by producing a known output signal.
For further assistance, consult the manufacturer's datasheet and technical support resources.