Accelerometer
Measures linear acceleration on X, Y, and Z axes for tilt detection, motion sensing, and vibration monitoring.
Overview
An accelerometer measures the acceleration force acting on it, including gravity. This makes it useful for detecting tilt/orientation, sensing taps and shakes, monitoring vibration, and measuring motion. ArduinoStudio supports I2C accelerometers like the ADXL345.
The component emits sensor-data events with acceleration values (in g-force) for each axis. You can trigger actions when acceleration on a selected axis exceeds a configurable threshold.
Specifications
| Parameter | Value |
|---|---|
| Sensor | ADXL345 |
| Range | +-2g / +-4g / +-8g / +-16g (selectable) |
| Resolution | 13-bit (up to 4mg/LSB) |
| Interface | I2C (or SPI) |
| Operating Voltage | 3.3V |
| I2C Address | 0x53 (SDO→GND) or 0x1D (SDO→3.3V) |
Wiring Guide
| ADXL345 Pin | Arduino Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SDA | A4 (Uno) / 20 (Mega) |
| SCL | A5 (Uno) / 21 (Mega) |
| CS | 3.3V (selects I2C mode) |
| SDO | GND (address 0x53) or 3.3V (address 0x1D) |
Note: The ADXL345 is a 3.3V device. If using a 5V Arduino (Uno, Mega), use a breakout board with a built-in level shifter, or add external level shifting on SDA/SCL lines.
Usage in ArduinoStudio
Drag the Accelerometer component onto the canvas. It uses the I2C bus automatically. Acceleration data streams on all three axes. Use cases include:
- Detect when a device is tilted past a certain angle
- Sense tap or double-tap gestures
- Monitor vibration levels on machinery
- Trigger an alarm when movement is detected (security)