
Interfacing ADXL335 Accelerometer Sensor with Arduino Uno
Introduction
In this blog, we will explore what an accelerometer is and how to interface the ADXL335 accelerometer sensor with an Arduino Uno.
If you have ever noticed your smartphone automatically changing screen orientation when rotated, that’s due to an accelerometer. These sensors play a crucial role in motion detection, and they have applications in various fields, including automotive safety, geolocation tracking, gaming, and image stabilization.
Let’s dive into the working principle, types, and real-world applications of accelerometers before learning how to interface the ADXL335 with Arduino Uno.
What is an Accelerometer?
An accelerometer is an electromechanical device that measures acceleration forces. These forces can be:
- Static – like gravity (measuring tilt and orientation).
- Dynamic – such as vibrations and motion detection.
Modern devices, including smartphones, cameras, and vehicle airbags, integrate accelerometers to detect motion, impact, and direction.
How Does an Accelerometer Work?

At rest, an accelerometer measures 1g (9.81 m/s²), which is Earth’s gravitational pull. Different accelerometers use various techniques to measure acceleration, including:
- Piezoelectric Effect – Uses crystal structures that generate electrical charge under stress.
- Capacitive Sensing – Measures variations in capacitance between tiny plates as acceleration causes movement.
Many accelerometers support multiple axes (typically 2-axis or 3-axis) to detect movement in different directions.
Types of Accelerometers
Accelerometers are broadly classified into two categories:
1. DC Response Accelerometers
- Can measure static acceleration like gravity.
- Useful for applications requiring precise tilt or orientation detection.
2. AC Response Accelerometers
- Used for vibration sensing and motion detection.
- Cannot measure static acceleration.
Other Common Types
- Compression Mode Accelerometers – Rugged and used in automotive, aerospace, and industrial applications.
- Shear Mode Accelerometers – More resistant to thermal changes and mechanical stress.
- Capacitive Accelerometers – Used in smartphones, gaming controllers, and medical devices due to their high precision.
Interfacing ADXL335 Accelerometer with Arduino Uno

Components Required
To interface the ADXL335 with an Arduino Uno, you will need:

- Arduino Uno
- ADXL335 Accelerometer Module
- Breadboard
- Jumper Wires
- Arduino IDE (Software for programming)
Connection Diagram


ADXL335 Pin | Arduino Pin |
VCC | 3.3V |
GND | GND |
XOUT | A0 |
YOUT | A1 |
ZOUT | A2 |
Arduino Code for ADXL335 Sensor
cpp
CopyEdit
const int xpin = A0;
const int ypin = A1;
const int zpin = A2;
void setup() {
Serial.begin(9600);
}
void loop() {
int x = analogRead(xpin);
int y = analogRead(ypin);
int z = analogRead(zpin);
Serial.print(“X: “); Serial.print(x – 322); Serial.print(“\t”);
Serial.print(“Y: “); Serial.print(y – 320); Serial.print(“\t”);
Serial.print(“Z: “); Serial.println(z – 263);
delay(100);
}
How It Works
- The X, Y, and Z-axis values are read from the accelerometer.
- These values help determine the tilt and motion of the sensor.
- The program prints real-time sensor data to the Serial Monitor.
Real-World Applications of Accelerometers
Accelerometers are widely used in consumer electronics, automotive, and industrial sectors. Some applications include:
1. Consumer Electronics
- Smartphones & Tablets – Detects screen rotation, gaming controls.
- Smartwatches & Fitness Trackers – Monitors step count, running, and movement.
- Gaming Consoles – Used in controllers for motion-based gameplay (e.g., PlayStation, Xbox).
2. Automotive & Aerospace
- Airbag Deployment – Detects collisions and activates airbags instantly.
- Vehicle Stability Control – Helps in navigation and anti-rollover systems.
- Drones & UAVs – Maintains stability and orientation.
3. Industrial & Medical Uses
- Earthquake Detection – Measures seismic activity.
- Medical Devices – Used in CPR training tools to measure chest compressions.
- Robotics – Ensures balance and movement tracking.
Conclusion
In this blog, we explored:
✅ What an accelerometer is and how it works.
✅ Different types of accelerometers and their real-world applications.
✅ How to interface the ADXL335 accelerometer with an Arduino Uno using simple code.
The use of accelerometers continues to expand across industries, making them an essential component in motion-sensing technology.
Have any thoughts or project ideas using an accelerometer? Drop your comments below!
Stay tuned for more tutorials from Regent Electronics! 🚀