|
| 1 | +.. _adxl372: |
| 2 | + |
| 3 | +ADXL372: Three Axis High-g I2C/SPI Accelerometer |
| 4 | +################################################ |
| 5 | + |
| 6 | +Description |
| 7 | +*********** |
| 8 | + |
| 9 | +This sample application produces slightly different outputs based on the chosen |
| 10 | +driver configuration mode: |
| 11 | + |
| 12 | +* In **Measuring Mode with trigger support**, |
| 13 | + the acceleration on all three axis is printed in m/s^2 at the sampling rate (ODR). |
| 14 | +* In **Polled Measuring Mode**, the instantaneous acceleration is polled every 2 seconds. |
| 15 | +* In **Max Peak Detect Mode**, the device returns only the over-threshold |
| 16 | + peak acceleration between two consecutive sample fetches or trigger events. |
| 17 | + (In most high-g applications, a single 3-axis acceleration sample at the peak |
| 18 | + of an impact event contains sufficient information about the event, and the |
| 19 | + full acceleration history is not required.) Instead of printing the acceleration |
| 20 | + on all three axis, the sample application calculates the vector magnitude |
| 21 | + (root sum squared) and displays the result in g's rather than in m/s^2, |
| 22 | + together with an bar graph. |
| 23 | + |
| 24 | + |
| 25 | +References |
| 26 | +********** |
| 27 | + |
| 28 | +- ADXL372: http://www.analog.com/adxl372 |
| 29 | + |
| 30 | +Wiring |
| 31 | +******* |
| 32 | + |
| 33 | +This sample uses the ADXL372 sensor controlled either using the I2C or SPI interface. |
| 34 | +Connect supply **VDD**, **VS** and **GND**. The supply voltage can be in |
| 35 | +the 1.6V to 3.5V range. |
| 36 | + |
| 37 | +I2C mode |
| 38 | +======== |
| 39 | + |
| 40 | +Connect Interface: **SDA**, **SCL** and optionally connect the **INT1** to a |
| 41 | +interrupt capable GPIO. It is a requirement that **SCLK** must be connected to |
| 42 | +**GND** in I2C mode. Depending on the baseboard used, the **SDA** and **SCL** |
| 43 | +lines require Pull-Up resistors. With the **MISO** pin low, the I2C address for |
| 44 | +the device is 0x1D, and an alternate I2C address of 0x53 can be chosen by |
| 45 | +pulling the **MISO** pin high. |
| 46 | + |
| 47 | +I2C Address: |
| 48 | + |
| 49 | +* **0x1D**: if MISO is pulled low |
| 50 | +* **0x53**: if MISO is pulled high |
| 51 | + |
| 52 | +.. Note:: |
| 53 | + When sharing an SDA bus, the ADXL372 Silicon Revision < 3 may prevent |
| 54 | + communication with other devices on that bus. |
| 55 | + |
| 56 | +SPI mode |
| 57 | +======== |
| 58 | + |
| 59 | +Connect Interface: **SCLK**, **MISO**, **MOSI** and **/CS** and optionally |
| 60 | +connect the **INT1** to a interrupt capable GPIO. |
| 61 | + |
| 62 | + |
| 63 | +Building and Running |
| 64 | +******************** |
| 65 | + |
| 66 | +This project outputs sensor data to the console. It requires an ADXL372 |
| 67 | +sensor. It should work with any platform featuring a I2C/SPI peripheral interface. |
| 68 | +It does not work on QEMU. |
| 69 | +In this example below the :ref:`nrf52_pca10040` board is used. |
| 70 | + |
| 71 | + |
| 72 | +.. zephyr-app-commands:: |
| 73 | + :zephyr-app: samples/sensors/adxl372 |
| 74 | + :board: nrf52_pca10040 |
| 75 | + :goals: build flash |
| 76 | + |
| 77 | + |
| 78 | +Sample Output: Max Peak Detect Mode |
| 79 | +=================================== |
| 80 | + |
| 81 | +.. code-block:: console |
| 82 | +
|
| 83 | + Waiting for a threshold event |
| 84 | + 23.94 g: ######################## |
| 85 | + Waiting for a threshold event |
| 86 | + 38.01 g: ####################################### |
| 87 | + Waiting for a threshold event |
| 88 | + 51.40 g: #################################################### |
| 89 | + Waiting for a threshold event |
| 90 | + 63.63 g: ################################################################ |
| 91 | +
|
| 92 | +Sample Output: Measurement Mode |
| 93 | +=============================== |
| 94 | + |
| 95 | +.. code-block:: console |
| 96 | +
|
| 97 | + AX= 2.94 AY= -5.88 AZ= 0.98 (m/s^2) |
| 98 | + AX= -4.90 AY= 6.86 AZ= -1.96 (m/s^2) |
| 99 | + AX= 2.94 AY= -2.94 AZ= 8.83 (m/s^2) |
| 100 | + AX= -0.98 AY= -6.86 AZ= -0.98 (m/s^2) |
| 101 | + AX= 6.86 AY= 2.94 AZ= 3.92 (m/s^2) |
| 102 | + AX= -0.98 AY= 4.90 AZ= -3.92 (m/s^2) |
| 103 | +
|
| 104 | + <repeats endlessly> |
0 commit comments