sensor-experiments

Objective

This experiment uses the ADXL335 accelerometer to measure acceleration along the X, Y, and Z axes.

Required Components

No Ads Available.

Working Principle

The ADXL335 is a 3-axis accelerometer that measures changes in acceleration and outputs analog values corresponding to X, Y, and Z axes.

Circuit Diagram

Arduino Code


/*
 * Accelerometer Data Collection with ADXL335
 * This code reads the acceleration values from the ADXL335 sensor.
 */

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
}

void loop() {
  int xVal = analogRead(xPin);  // Read X-axis value
  int yVal = analogRead(yPin);  // Read Y-axis value
  int zVal = analogRead(zPin);  // Read Z-axis value

  Serial.print("X: ");
  Serial.print(xVal);
  Serial.print(" Y: ");
  Serial.print(yVal);
  Serial.print(" Z: ");
  Serial.println(zVal);

  delay(1000);  // Wait for 1 second before the next reading
}
            

Results

The serial monitor will display the acceleration values along the X, Y, and Z axes.

Applications

Conclusion

The ADXL335 accelerometer is a useful tool for measuring acceleration along three axes, enabling applications in motion sensing, gaming, and crash detection systems.

Contact Us

If you have any questions or inquiries, feel free to reach out to us at Microautomation.no@icloud.com .

Follow our Socials for the newest updates!