Home Code Arduino and ADXL362 Digital Output MEMS Accelerometer example

Arduino and ADXL362 Digital Output MEMS Accelerometer example

by shedboy71

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. The ADXL362 is available in a 3 mm × 3.25 mm × 1.06 mm package.

Connection

Arduino Pin Number ADXL362 Breakout
VCC VS and VIO
GND GND
10 CS
11 MOSI
12 MISO
13 SCLK

 

Code

This example requires the library from https://github.com/annem/ADXL362

[codesyntax lang=”cpp”]

#include <SPI.h>
#include <ADXL362.h>

ADXL362 xl;

int16_t temp;
int16_t XValue, YValue, ZValue, Temperature;

void setup(){
  
  Serial.begin(9600);
  xl.begin(10);                   // Setup SPI protocol, issue device soft reset
  xl.beginMeasure();              // Switch ADXL362 to measure mode  
	
  Serial.println("Start Demo: Simple Read");
}

void loop(){
    
  // read all three axis in burst to ensure all measurements correspond to same sample time
  xl.readXYZTData(XValue, YValue, ZValue, Temperature);  
  Serial.print("XVALUE=");
  Serial.print(XValue);	 
  Serial.print("\tYVALUE=");
  Serial.print(YValue);	 
  Serial.print("\tZVALUE=");
  Serial.print(ZValue);	 
  Serial.print("\tTEMPERATURE=");
  Serial.println(Temperature);	 
  delay(100);                // Arbitrary delay to make serial monitor easier to observe
}

[/codesyntax]

 

Links

http://www.analog.com/en/products/sensors-mems/accelerometers/adxl362.html

ADXL362 3-Axis Digital Accelerometer Accel Sensor Module SPI for Arduino

Share

You may also like

Leave a Comment