ADXL335 Triple-Axis Accelerometer
ADXL335 Triple-Axis Accelerometer
The ADXL335 is a high-performance, low-power, triple-axis accelerometer from Analog Devices. It is a popular component in the Internet of Things (IoT) ecosystem, used in a wide range of applications that require motion sensing, vibration monitoring, and orientation detection.
The ADXL335 is designed to measure acceleration forces in three orthogonal axes (x, y, and z) simultaneously. It converts the acceleration measurements into analog voltage signals, which can be easily read and processed by a microcontroller or other devices.
| ### Sensor Characteristics |
3g (g = 9.8 m/s)
265 mV/g (typical)
10 bits (1024 levels)
1600 Hz (typical)
| ### Output Characteristics |
Analog (voltage)
0 V to VCC (typically 3.3 V or 5 V)
32 k (typical)
| ### Power Management |
2.0 V to 3.6 V
350 A (typical) at 3.3 V supply
Yes, with reduced current consumption (10 A typical)
| ### Operation Modes |
Continuous acceleration measurement
Power-saving mode with reduced current consumption
Low-power mode with minimal current consumption
| ### Package and Pinout |
5 mm 5 mm 1.45 mm (16-lead LFCSP)
| + VCC | Power supply pin |
| + GND | Ground pin |
| + XOUT | X-axis output pin |
| + YOUT | Y-axis output pin |
| + ZOUT | Z-axis output pin |
| + SCL | Serial clock input pin (for SPI interface) |
| + SDA | Serial data input/output pin (for SPI interface) |
| ### Other Features | |
| Self-test | Built-in self-test capability for device verification |
Internally filtered outputs for reduced noise
-40C to +125C ( industrial temperature range)
| The ADXL335 is a versatile and reliable accelerometer suitable for various IoT applications, such as |
Motion detection and gesture recognition
Vibration monitoring and analysis
Orientation and tilt sensing
Inertial measurement and navigation
Robotics and unmanned systems
Industrial automation and condition monitoring
When using the ADXL335, developers can take advantage of its high sensitivity, low power consumption, and compact package to design innovative IoT devices that require precise acceleration measurements.
ADXL335 Triple-Axis Accelerometer DocumentationOverviewThe ADXL335 is a low-power, triple-axis accelerometer with high sensitivity and low noise. It measures acceleration in three axes (x, y, z) and provides analog output voltages proportional to the acceleration. This component is suitable for a wide range of applications, including robotics, industrial automation, and wearable devices.Pinout and ConnectionsThe ADXL335 has 8 pins:VCC: Power supply (2.0-3.6V)
GND: Ground
XOUT: X-axis output
YOUT: Y-axis output
ZOUT: Z-axis output
ST: Self-test (optional)
0G/CS: Zero-g detection/output (optional)
Vin: Analog input (optional)Example 1: Basic Accelerometer Reading with ArduinoIn this example, we will connect the ADXL335 to an Arduino board and read the acceleration values in three axes.Connections:VCC to Arduino 3.3V
GND to Arduino GND
XOUT to Arduino A0
YOUT to Arduino A1
ZOUT to Arduino A2Code:
```c++
const int xPin = A0; // X-axis output
const int yPin = A1; // Y-axis output
const int zPin = A2; // Z-axis outputvoid setup() {
Serial.begin(9600);
}void loop() {
int xValue = analogRead(xPin);
int yValue = analogRead(yPin);
int zValue = analogRead(zPin);float xAccel = (xValue 3.3) / 1024;
float yAccel = (yValue 3.3) / 1024;
float zAccel = (zValue 3.3) / 1024;Serial.print("X: ");
Serial.print(xAccel);
Serial.print(" g, Y: ");
Serial.print(yAccel);
Serial.print(" g, Z: ");
Serial.print(zAccel);
Serial.println(" g");delay(100);
}
```
Example 2: Measuring Tilt Angle with Raspberry PiIn this example, we will connect the ADXL335 to a Raspberry Pi and calculate the tilt angle of the device using the acceleration values.Connections:VCC to Raspberry Pi 3.3V
GND to Raspberry Pi GND
XOUT to Raspberry Pi ADC channel 0
YOUT to Raspberry Pi ADC channel 1
ZOUT to Raspberry Pi ADC channel 2Code:
```python
import RPi.GPIO as GPIO
import time
import mathGPIO.setmode(GPIO.BCM)x_channel = 0
y_channel = 1
z_channel = 2GPIO.setup(x_channel, GPIO.IN)
GPIO.setup(y_channel, GPIO.IN)
GPIO.setup(z_channel, GPIO.IN)def read_accel(channel):
return GPIO.input(channel) 3.3 / 1024while True:
x_accel = read_accel(x_channel)
y_accel = read_accel(y_channel)
z_accel = read_accel(z_channel)# Calculate tilt angle
roll = math.atan2(y_accel, z_accel) 180 / math.pi
pitch = math.atan2(x_accel, math.sqrt(y_accel2 + z_accel2)) 180 / math.piprint("Roll: {:.2f}, Pitch: {:.2f}".format(roll, pitch))time.sleep(0.1)
```
Example 3: Wake-on-Motion with ESP32In this example, we will connect the ADXL335 to an ESP32 board and use the accelerometer to wake up the board from deep sleep mode when motion is detected.Connections:VCC to ESP32 3.3V
GND to ESP32 GND
XOUT to ESP32 ADC channel 0
YOUT to ESP32 ADC channel 1
ZOUT to ESP32 ADC channel 2Code:
```c++
#include <WiFi.h>
#include <ESP32AnalogRead.h>const int xPin = 0; // X-axis output
const int yPin = 1; // Y-axis output
const int zPin = 2; // Z-axis outputvoid setup() {
Serial.begin(115200);// Configure ADC channels
analogReadResolution(12);
analogSetAttenuation(ADC_6db);// Configure wake-up pin
esp_sleep_enable_ext0_wakeup(GPIO_NUM_0, 1);
}void loop() {
int xValue = analogRead(xPin);
int yValue = analogRead(yPin);
int zValue = analogRead(zPin);float xAccel = (xValue 3.3) / 4096;
float yAccel = (yValue 3.3) / 4096;
float zAccel = (zValue 3.3) / 4096;// Check if motion is detected
if (xAccel > 0.5 || yAccel > 0.5 || zAccel > 0.5) {
Serial.println("Motion detected! Wake up!");// Wake up from deep sleep mode
esp_deep_sleep_start();
}delay(100);
}
```
Note: In this example, we assume that the ESP32 is in deep sleep mode and will wake up when motion is detected. The specifics of deep sleep mode configuration may vary depending on the ESP32 board and firmware used.