The LilyPad Accelerometer - ADXL335 is a compact, lightweight sensor designed by SparkFun for wearable electronics and e-textile projects. It measures acceleration forces in three dimensions (X, Y, and Z axes), making it ideal for detecting motion, orientation, and tilt. Its circular design and sewable pads make it easy to integrate into fabric-based projects.
The LilyPad Accelerometer is based on the Analog Devices ADXL335 sensor. Below are its key technical details:
Parameter | Value |
---|---|
Operating Voltage | 1.8V to 3.6V (3.3V recommended) |
Operating Current | 350 µA |
Measurement Range | ±3g |
Sensitivity | 300 mV/g (typical at 3.3V) |
Output Type | Analog |
Dimensions | 20mm diameter |
Weight | ~1g |
The LilyPad Accelerometer has six sewable connection pads. Below is the pinout:
Pin Name | Description |
---|---|
+ |
Power supply input (3.3V recommended) |
- |
Ground connection |
X |
Analog output for X-axis acceleration |
Y |
Analog output for Y-axis acceleration |
Z |
Analog output for Z-axis acceleration |
ST |
Self-test pin (used for testing the sensor; leave unconnected for normal use) |
+
pad to a 3.3V power source and the -
pad to ground.X
, Y
, and Z
pads to analog input pins on your microcontroller (e.g., Arduino UNO).Below is an example of how to connect and read data from the LilyPad Accelerometer using an Arduino UNO:
+
pad to the Arduino's 3.3V
pin.-
pad to the Arduino's GND
pin.X
, Y
, and Z
pads to the Arduino's A0
, A1
, and A2
pins, respectively.// LilyPad Accelerometer - ADXL335 Example Code
// Reads acceleration data from the X, Y, and Z axes and prints it to the Serial Monitor.
const int xPin = A0; // X-axis connected to analog pin A0
const int yPin = A1; // Y-axis connected to analog pin A1
const int zPin = A2; // Z-axis connected to analog pin A2
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
}
void loop() {
// Read analog values from the accelerometer
int xValue = analogRead(xPin);
int yValue = analogRead(yPin);
int zValue = analogRead(zPin);
// Print the raw values to the Serial Monitor
Serial.print("X: ");
Serial.print(xValue);
Serial.print(" | Y: ");
Serial.print(yValue);
Serial.print(" | Z: ");
Serial.println(zValue);
delay(500); // Wait for 500ms before the next reading
}
No Output or Incorrect Readings
Noisy or Fluctuating Readings
Readings Drift Over Time
Self-Test Pin Confusion
ST
pin.ST
pin unconnected during normal operation.Q: Can I use the LilyPad Accelerometer with a 5V microcontroller?
A: Yes, but you must use a voltage regulator or level shifter to step down the 5V to 3.3V for the sensor.
Q: How do I calibrate the sensor?
A: Measure the output voltage for each axis when the sensor is stationary and level. Use these values as the zero-g offsets in your calculations.
Q: Can the sensor detect free fall?
A: Yes, during free fall, all three axes will measure approximately 0g.
Q: Is the sensor waterproof?
A: No, the LilyPad Accelerometer is not waterproof. Protect it from moisture when used in wearable projects.