ADXL362 Arduino How-To

Document created by AnneM Employee on May 29, 2012Last modified by AnneM Employee on Jul 16, 2014
Version 6Show Document
  • View in full screen mode


What you'll need:



If you chose to use a 5V Arduino (such as an Arduino Uno or Leonardo), you'll need to shift the logic levels to ensure that the ADXL362 receives 3.3V logic, as well as power from a 3.3V supply (available on the Uno as the "3.3V" power pin) - I cannot be held responsible if you fry your ADXL362 using a 5V Arduino!


Notice - Arduino ( is an open source prototyping platform - there are many, many "Arduino-compatible" boards out there.  And, chances are good that you could get any one of them to work for this example.  But, to keep things simple, I am going show how connect the ADXL362 to the Arduino Pro Mini.  If you deviate from this example, you are on your own.  But, don't worry!  There are loads of examples on the web, books in the bookstore/library, etc, that will very quickly help you to become an Arduino expert.


Getting Started with Arduino


If you're new to Arduino, then it's best if you work on getting the software downloaded and installed, and make sure that you're able to get your Arduino to "say hello" before you connect the ADXL362.



Download and install the software, connect your Arduino to your PC, and work through the "Getting Started" guide.


Did you get your Arduino to blink its LED?  Hooray! 


No luck?  Try getting the Arduino Cookbook, by Michael Margolis - an excellent and thorough guide for getting started.


Do not continue until you are able to get your Arduino to blink its LED using the "Blink" example, which is covered in the SparkFun "Getting Started" guide.




Connecting ADXL362 to Arduino


Connect the power and ground pins of the ADXL326 Breakout to the VCC and GND pins of the Arduino, and connect the SPI pins of the ADXL362 to the SPI pins of the Arduino.  (And, double check to make sure you're not connecting your ADXL362 to any supply or signal pins over 3.3V!)  For the Arduino Pro Mini, the pin names/numbers are listed below:


Check out for more information on using Arduino to program SPI devices


Arduino Pro Mini

Pin Number/Name

ADXL362 Breakout

Board Name


















     A closer look at Arduino Pro Mini and ADXL362 hook-up:

ADXL362 and Pro Mini.jpg



Example 1:  ADXL362_SimpleRead



Step 1: Install the ADXL362 Arduino library:



Download the ADXL362 Arduino library from the GitHub repository and unzip it.  It's likely going to have a long "github" assigned folder name - you can rename the top level folder to "ADXL362."  Place that folder (which contains .h file, .cpp file, and "examples" folder)  in the "libraries" folder of your Arduino sketchbook folder.  If this the the first library you've ever installed, you'll need to create the "libraries" folder in the Arduino sketchbook folder.


Hint: The location of your Sketchbook folder is specified in the Arduino IDE under File --> Preferences (or by typing CTRL+Comma):


Arduino sketchbook.JPG



The file structure MUST look like this (Sketchbook location -> libraries -> ADXL362 -> folder contents):

Arduino File Structure.JPG

The ADXL362 folder can be renamed, but no additional levels of hierarchy may be added. This is just where Arduino knows to look for stuff.



Step 2: Open and load ADXL362_SimpleRead example sketch:


If you have the ADXL362 library folder in the correct location, you should be able to open the ADXL362_SimpleRead example sketch by clicking File -> Examples -> ADXL362 -> ADXL362_SimpleRead, as illustrated in picture below:




Once you have the sketch open, you should be able to click the "Upload" button.  Make sure you have the correct board and COM port selected.  (Please take a step back and review the SparkFun "Getting Started" Guide if you are having trouble uploading your sketch.)


Once you have uploaded your sketch, you should see a "Done Uploading" message in the window, as illustrated below:

Done Uploading.jpg



Step 3: Observe data on Serial Monitor


Once you have successfully uploaded the sketch, open the Serial Monitor (Ctrl+Shift+M, or click magnifier icon on upper right corner)


Your serial monitor data should look like this (of course, X, Y, Z values depend on your circuit orientation):

SimpleRead Serial Monitor.jpg


It's Alive!



Didn't work? Go back to square one and get the "Blink" example working.  A few tips:

  • Check VS, VIO, and GND on your ADXL362 Breakout.  Make sure you have 3.3V and GND connected correctly.
  • Check, and double check, your SPI connections.  Use a logic analyzer to check the SPI signals coming out of the Arduino. 
  • Check your selected board and COM port.  For this example, the board used was a Pro Mini 3.3V 8MHz w/ATMega328.
  • Try some of the other examples that are included with the Arduino software... these are great basic sketches that can help you get started and troubleshoot your Arduino.
    • I really like the "DigitalPotControl" example (File -> Examples -> SPI -> DigitalPotControl).  It uses an Analog Devices AD5206 digital potentiometer, which is available in a DIP package for easy breadboarding.  And, you can get free samples at!  This is a great example for learning how SPI works, and how to use Arduino to program SPI.



Coming soon: Using the ADXL362 Interrupts to put the Arduino to sleep


This is my favorite part!  What makes the ADXL362 so great is it's super-low power, especially in sleep mode.  Check back later!

1 person found this helpful