In this article we will connect a ADXL362 3-axis accelerometer to an Raspberry Pi
The ADXL362 always provides 12-bit output resolution; 8-bit formatted data is also provided for more efficient single-byte transfers when a lower resolution is sufficient. Measurement ranges of ±2 g, ±4 g, and ±8 g are available, with a resolution of 1 mg/LSB on the ±2 g range. For applications where a noise level lower than the normal 550 µg/√Hz of the ADXL362 is desired, either of two lower noise modes (down to 175 µg/√Hz typical) can be selected at minimal increase in supply current.
In addition to its ultralow power consumption, the ADXL362 has many features to enable true system level power reduction. It includes a deep multimode output FIFO, a built-in micropower temperature sensor, and several activity detection modes including adjustable threshold sleep and wake-up operation that can run as low as 270 nA at a 6 Hz (approximate) measurement rate. A pin output is provided to directly control an external switch when activity is detected, if desired. In addition, the ADXL362 has provisions for external control of sampling time and/or an external clock.
The ADXL362 operates on a wide 1.6 V to 3.5 V supply range, and can interface, if necessary, to a host operating on a separate, lower supply voltage.
Parts List
Schematic
We chose a Pi Zero, any Raspberry Pi should work just fine.
Pi Zero | ADXL362 |
3v3 | Vin |
Gnd | Gnd |
SCL | SCL |
SDA | SDA |
Code
The example library and code examples come from https://github.com/zeckendorf/ADXL362-RPi
I used the example_read_raw.py example
[python]
import ADXL362
import time
accel = ADXL362.ADXL362()
accel.begin_measure()
while True:
print accel.read_x()
print accel.read_y()
print accel.read_z()
print accel.read_temp()
print accel.read_xyz()
time.sleep(.01)
[/python]
you can run this by typing the following in the terminal
sudo python example_read_raw.py
Output
In the terminal you should see something like this
Links
https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL362.pdf