ADXL335 analog accelerometer
The ADXL335 sensor is a three-axis accelerometer: it measures acceleration in the X, Y, and Z axes simultaneously. It is an “analog” sensor, meaning that it reports data back to you through analog input lines.
The sensor is very easy to wire; 5 volts to VCC
, ground to GND
, and feed each of the outputs to one of the analog input lines on the Arduino. If you only want to use it to measure acceleration in one or two axes, you may simply only wire the ones you want to read.
Arduino code to read and Serial.print
three successive analog values
This code assumes you’ve plugged the ADXL335’s XOUT
into A0
, the YOUT
into A1
, and the ZOUT
into A2
. When you run this code, the return values will be formatted like:
256 369 301 257 369 310
This sort of formatting can be read by the Arduino IDE’s “Serial plotter” to automatically plot the incoming data on a simple graph.