

Take samples and return the average int ReadAxis( int axisPin) re-scale to fractional Gs float xAccel = xScaled / 1000.0 Long zScaled = map(zRaw, RawMin, RawMax, - 3000, 3000) Long yScaled = map(yRaw, RawMin, RawMax, - 3000, 3000) Convert raw values to 'milli-Gs" long xScaled = map(xRaw, RawMin, RawMax, - 3000, 3000) Read raw values int xRaw = ReadAxis(xInput) Take multiple samples to reduce noise const int sampleSize = 10 initialize minimum and maximum Raw Ranges for each axis int RawMin = 0 This is accomplished by connecting the Arduino’s 3.3V pin to the AREF pin. To get accurate results, we need to change the analog reference (AREF) voltage on the Arduino. Connect the X, Y, and Z outputs to Arduino’s analog pins A0, A1, and A2. Connect the VCC pin to the Arduino’s 5V pin and the GND pin to the Arduino’s Ground pin. Begin by mounting the accelerometer on the breadboard. Now that we know how the ADX元35 accelerometer works, we can move on to hooking it up to our Arduino.Ĭonnections are pretty simple. Wiring an ADX元35 Accelerometer to an Arduino This feature is discussed in depth at the end of the tutorial. ST(Self-Test) pin controls the self-test feature that allows you to test the sensor’s functionality in the final application. Z-Out outputs analog voltage proportional to acceleration along the Z axis. Y-Out outputs an analog voltage proportional to acceleration along the Y axis. X-Out outputs an analog voltage proportional to acceleration along the X axis. Connect it to the 5V output of your Arduino. This means that the 0g measurement output is always at half of the 3.3V supply voltage (1.65V), -3g is at 0v, and +3g is at 3.3V, with full scaling in between. The ADX元35 output is ratiometric, therefore, the output voltage increases linearly with acceleration over the range. When subjected to accelerations greater than 10,000g, the ADX元35 may fail. The absolute maximum acceleration of the ADX元35 is 10,000g.

If it is accelerated at 4g, for example, the accelerometer will not break, but the output may rail. Meaning the maximum amount of acceleration that the ADX元35 can accurately measure and represent as an output is ☓g.

The ADX元35 has a full sensing range of ☓g. The sensor consumes only 350μA of current during normal operation. However, the on-board 3.3V regulator makes it ideal for interfacing with 5V microcontrollers like the Arduino. The ADX元35 operates on 1.8V to 3.6VDC (typically 3.3V).

This breadboard-friendly module breaks out every pin of the ADX元35 to a 6-pin, 0.1′′ pitch header, including 3 analog outputs for X, Y, and Z axis measurements, 2 supply pins, and a self-test pin.
