Analog.com Analog Dialogue Wiki 简体中文
EngineerZone
EngineerZone
  • Log In
  • Site
  • Search
  • User
  • Support

    Popular Forums

    • RF and Microwave
    • Power Management
    • Video
    • FPGA Reference Designs
    • Precision ADCs
    • Linux Software Drivers
    • SigmaDSP Processors & SigmaStudio Dev. Tool

    Product Forums

    • A2B
    • Amplifiers
    • Analog Microcontrollers
    • Clock and Timing
    • Data Converters
    • Direct Digital Synthesis (DDS)
    • Energy Monitoring and Metering
    • Interface and Isolation
    • MEMS Inertial Sensors
    • Processors and DSP
    • Switches/Multiplexers
    • Temperature Sensors
    • Voltage References
    View All

    Application Forums

    • Audio
    • Automated Test Equipment (ATE)
    • Condition-Based Monitoring
    • Depth, Perception & Ranging Technologies
    • Embedded Vision Sensing Library
    • Motor Control Hardware Platforms
    • Optical Sensing
    • Precision Technology Signal Chains Library
    • Video
    • Wireless Sensor Networks Reference Library

    Design Center Forums

    • ACE Evaluation Software
    • ADEF System Platforms
    • Design Tools and Calculators
    • FPGA Reference Designs
    • Linux Software Drivers
    • Microcontroller no-OS Drivers
    • Reference Designs
    • Signal Chain Power (SCP)
    • Software Interface Tools
    • System Demonstration Platform (SDP) Support
  • Learn

    Highlighted Webinar

    Audio Design Solutions for Augmented and Virtual Reality (AR/VR) Glasses

    Recent Discussions

    • Standalone Data logging using ADALM2000
    • About sdr.tx(). Can I change the transmitter frequency after call this function?
    • About the values of CurV1,2 displayed in the cursors frame of scopy.
    • Purpose of "Load" in Scopy signal generator configuration GUI
    • about the transient response experiment example of RL Circuit using adalm2000

    Places

    • ADI Education Home
    • ADI Education China
    • ADI Education India
    • ADI Education Philippines
    • StudentZone (Analog Dialogue)
    • Virtual Classroom

    Latest Webinars

    • Audio Design Solutions for Augmented and Virtual Reality (AR/VR) Glasses
    • Robust Industrial Motor Encoder Signal Chain Solutions
    • Precision Low Power Measurement Solutions for Intelligent Edge
    • Advantages of Integrating Digital Power System Management (DPSM) into your Design
    • Optimizing GaN and GaAs RF Amplifier Performance Using Novel Biasing Techniques
    View All Webinars
  • Community Hub

    Challenge Yourself!

      KCC's Quizzes AQQ231 about Birthdays and Cake Candles
    View All

    Places

    • Community Help
    • Logic Lounge

    Resources

    • EZ Code of Conduct
    • Getting Started Guide
    • ADI: Words Matter
    • Community Help Videos
    View All
  • Blogs

    Highlighted Blogs

    Understanding Public Key Infrastructures

     

    Share Your Insights! How Can We Improve Your Engineering Design Needs?

    Latest Blogs

    • 10BASE-T1L Makes Powering Intelligent Field Instruments Painless
    • Using Python To Control The Pluto Radio And Plot Data
    • Resistance is NOT Futile
    • What is The Continuity of Engineering?
    • Move Over Sensors: Actuators Are Entering The Smart Factory Stage
    Read All Blogs

    ADI Blogs

    • EZ Spotlight
    • The Engineering Mind
  • Partners

    Electronic Design Services - PartnerZone

    • Boston Engineering
    • Calian, Advanced Technologies
    • Colorado Engineering Inc. (DBA CAES AT&E)
    • Clockworks Signal Processing
    • Epiq Solutions
    • Fidus
    • PalmSens
    • Richardson RFPD
    • Tri-Star Design, Inc.
    • VadaTech
    • Vanteon
    • X-Microwave
    View All
MEMS Inertial Sensors
MEMS Inertial Sensors
Documents ADXL362 + Arduino: Using Interrupts to Implement Motion-Activated Sleep
  • Forums
  • Files
  • FAQs/ Docs
  • Members
  • Tags
  • More
  • Cancel
  • +Documents
  • +3-D Model/STEP: FAQ
  • +AD22282-A-R2: FAQ
  • +ADIS16000: FAQ
  • +ADIS16003 MTBF: FAQ
  • +ADIS16006: FAQ
  • +ADIS16201: FAQ
  • +ADIS16203: FAQ
  • +ADIS16204: FAQ
  • +ADIS16209: FAQ
  • +ADIS16210: FAQ
  • +ADIS16223: FAQ
  • +ADIS16227: FAQ
  • +ADIS16228: FAQ
  • +ADIS16229: FAQ
  • +ADIS16240: FAQ
  • +ADIS16255: FAQ
  • +ADIS16355: FAQ
  • +ADIS16364: FAQ
  • +ADIS16365: FAQ
  • +ADIS16375: FAQ
  • +ADIS16385: FAQ
  • +ADIS16400: FAQ
  • +ADIS16405: FAQ
  • +ADIS16407: FAQ
  • +ADIS16445: FAQ
  • +ADIS16448: FAQ
  • +ADIS16460: FAQ
  • +ADIS16475: FAQ
  • +ADIS16477: FAQ
  • +ADIS1647x: FAQ
  • +ADIS16480: FAQ
  • +ADISUSB: FAQ
  • +ADXL001: FAQ
  • +ADXL203: FAQ
  • +ADIS16300: FAQ
  • +ADIS16485: FAQ
  • +ADIS16488: FAQ
  • +ADIS16488A: FAQ
  • +ADIS16490: FAQ
  • +ADIS16495: FAQ
  • +ADIS16497: FAQ
  • +ADXL103: FAQ
  • +ADXL150: FAQ
  • +ADxL193: FAQ
  • +ADXL202: FAQ
  • +ADXL206: FAQ
  • +ADXL210: FAQ
  • +ADXL210E: FAQ
  • +ADXL213: FAQ
  • +ADxL230: FAQ
  • +ADXL278: FAQ
  • +ADXL312: FAQ
  • +ADXL313: FAQ
  • +ADXL320: FAQ
  • +ADXL321: FAQ
  • +ADXL322: FAQ
  • +ADXL327: FAQ
  • +ADXL335: FAQ
  • +ADXL337: FAQ
  • +ADXL345: FAQ
  • +AD22290: FAQ
  • +ADIS16003: FAQ
  • +ADIS16133: FAQ
  • +ADIS16135: FAQ
  • +ADIS16265: FAQ
  • +ADIS16305: FAQ
  • +ADXL326: FAQ
  • +ADXL350: FAQ
  • -ADXL362: FAQ
    • ADXL362 + Arduino: Using Interrupts to Implement Motion-Activated Sleep
    • ADXL362 200Hz Bandwidth
    • ADXL362 Arduino How-To
    • ADXL362 as a Motion Switch
    • ADXL362 Clock Accuracy
    • ADXL362 Current Usage versus Competitors
    • ADXL362 Evaluation Boards
    • ADXL362 External Sync Pin
    • ADXL362 FIFO
    • ADXL362 FIFO Advantages
    • ADXL362 footprint error in datasheet (Rev C)
    • ADXL362 Motion Status Indicator Pin
    • ADXL362 register configuration
    • ADXL362 Self Test Procedure
    • ADXL362 Target Applications
    • ADXL362 Wakeup Mode vs. Full Power Mode
    • ADXL362  advantages as a motion switch
    • ADXL362: Acceleration beyond measurement range
    • ADXL362: Accessing real-time data in Wakeup Mode
    • ADXL362: autosleep mode
    • ADXL362: Bare minimum to acquire data
    • ADXL362: Output Data Rates (ODR)
    • ADXL362: Wakeup Mode and Autosleep
    • ADXL362: Wider bandwitdh than 200Hz
    • Are customers parts close to the ADXL362
    • EVAL-ADXL362Z-MLP threshold setting
    • Evaluating the ADXL362
    • Is ADXL362 data AC coupled?
    • Is ultrasonic welding a suitable assembly process for ADXL362 ?
    • Logging Data Prior to an Event
  • +ADXL375: FAQ
  • +ADXL377: FAQ
  • +ADXL78: FAQ
  • +ADXRS150: FAQ
  • +ADXRS290: FAQ
  • +ADXRS300: FAQ
  • +ADXRS401: FAQ
  • +ADXRS453: FAQ
  • +ADXRS610: FAQ
  • +ADxRS614: FAQ
  • +ADXRS623: FAQ
  • +ADXRS646: FAQ
  • +ADXRS652: FAQ
  • +ADXRS800: FAQ
  • +ADIS16136: FAQ
  • +ADIS16137: FAQ
  • +ADIS16266: FAQ
  • +ADIS16334: FAQ
  • +ADIS16362 Evaluation Tool: FAQ
  • +ADIS16364 Evaluation Tool: FAQ
  • +ADIS16367: FAQ
  • +ADIS163xx: FAQ
  • +ADIS16489: FAQ
  • +ADIS1648x: FAQ
  • +ADXL346: FAQ
  • +ADXL363: FAQ
  • +EVAL-ADIS: FAQ
  • +EVAL-ADIS2: FAQ
  • +Filtering Functions: FAQ
  • +General: FAQ
  • +Gyroscope: FAQ
  • +Hard & Soft Iron Correction: FAQ
  • +ISEB USB: FAQ
  • +IMU: FAQ
  • +MEMS: FAQ
  • +Slip Ring Interface: FAQ
  • +SPI Troubleshooting: FAQ
  • +TEMP_OUT Variation: FAQ
  • +Test Procedures: FAQ

ADXL362 + Arduino: Using Interrupts to Implement Motion-Activated Sleep

This tutorial details, step-by-step, how to use an ADXL362 to put an Arduino in a low-power state when the circuit is not moving, and then power it back up when motion is detected.

Before you get started:

If you haven't already, make sure you are able to successfully complete the ADXL362 Arduino How-To tutorial, which will guide you through hookup, ADXL362 Arduino library installation, and uploading/executing the "ADXL362_SimpleRead" example.  Any unresolved issues you have while working through the first tutorial will cause you trouble in this one.

Download the Rocket Scream Low Power Arduino Library:

I'm sure there are many good examples/libraries for putting your Arduino to sleep, but I have had good luck with Rocket Scream's Low Power Arduino library - download zip file here.

In my examples, I renamed the "Low-Power" top level library directory to "LowPower".  (My environment doesn't like the hyphen... I'm not sure if it's an OS issue, or perhaps the hyphen worked fine on an older version of the Arduino software?  Either way... please remove the hyphen to make the library work with my example code.)

Remember lessons learned while installing the ADXL362 Arduino library in previous tutorial.  "LowPower" library folder should be placed in your <sketchbook>/libraries folder.

You libraries directory structure should look like the picture below.  Go to ADXL362 Arduino How-To for a more detailed description of how to install Arduino libraries.

If you have it installed successfully, The Rocket Scream LowPower library will show up under Sketch -> Import Library -> LowPower (See image below):

Add interrupt connection between ADXL362 and Arduino:

This sleep example utilizes the INT1 pin of the ADXL362, and the Interrupt 0 (digital pin 2) on the Arduino.  So, adding to the connections that were made on the previous tutorial, add a wire to connect INT1 pin on the ADXL362 to DP2 pin on the Arduino.  See image below for an illustration of required connections:

More information about Arduino interrupts can be found at http://arduino.cc/en/Reference/AttachInterrupt

Upload ADXL362_MotionActivatedSleep sketch to Arduino:

Once you have completed steps above, uploading the ADXL362_MotionActivatedSleep example to your Arduino should be simple and straightforward.  The Motion activated sleep example requires the LowPower library to be properly installed.

Open the example by clicking File -> Examples -> ADXL362 -> ADXL362_MotionActivatedSleep, as shown in image below:

Make sure you have the correct board and serial port selected (see previous tutorial) and click the Upload button, as illustrated below:

Observe awake/asleep activity on Serial Monitor:

Open the serial monitor,  and watch as your circuit goes to sleep and wakes up, depending on if it's being shaken or moved.

In the example code, the circuit stays "on" for two seconds after it's been motionless, then shuts off.  The on/off timing, as well as the motion threshold, can be changed by tweaking the activity/inactivity interrupt settings, which I've set with the setupDCActivityInterrupt and setupDCInactivityInterrupt functions.

Or, Observe awake/Asleep activity with a multimeter:

To measure overall current, I disconnected the Pro Mini Arduino from my PC and FTDI Basic, and connected a multimeter in series with a 4.5V battery supply - I connected the battery supply to the RAW pin of my Pro Mini Arduino.  My quick observation was that the overall circuit consumes a little over 4mA while awake, and roughly 270uA while asleep.

  This tutorial does not include a thorough investigation of what portions of the circuit are consuming what portion of the overall power dissipation.  But in this example, the ADXL362 consumes less than 3uA while on, and 300nA while the circuit is "sleeping." (The ADXL362 current consumption varies slightly with output data rate, input voltage, and mode)  Therefore, most of the overall current, awake or asleep, is being consumed by the Pro Mini Arduino.  I'll leave it to the reader to conduct their own experiments regarding power consumption.

Images below - Current consumption while Pro Mini Arduino + ADXL362 circuit is "awake," and "asleep."

And, for even lower sleep power, use a Rocket Scream Ultra Mini Arduino-compatible

So, as much as I love, love, love the Pro Mini, I wasn't completely satisfied with the sleep current of my overall circuit.  And, I probably could have hacked my Pro Mini to make a few improvements (removing the 10K resistor across VCC comes to mind), I instead decided to purchase a Rocket Scream Mini Ultra Arduino-compatible board, especially since I'm using their handy Arduino library for sleep modes.

http://www.rocketscream.com/blog/wp-content/uploads/2011/07/miniUltra8Mhz.jpg

   Using the Mini Ultra, I was able to get my sleep current down to roughly 2uA! That's more like it!

Image below - Current consumption while Mini Ultra + ADXL362 circuit is  "asleep."

What am I going to do with my motion-activated Arduino?

I have a few ideas... stay tuned!

 

  • lowest_power
  • motion
  • arduino
  • ADXl362
  • motion_detection
  • low_power
  • lowpower
  • Share
  • History
  • More
  • Cancel
Related
Recommended
Social
Quick Links
  • About ADI
  • ADI Signals+
  • Analog Dialogue
  • Careers
  • Contact us
  • Investor Relations
  • News Room
  • Quality & Reliability
  • Sales & Distribution
  • Incubators
Languages
  • English
  • 简体中文
  • 日本語
Newsletter

Interested in the latest news and articles about ADI products, design tools, training and events? Subscribe today!

Sign Up
Analog Logo
©1995 - 2023 Analog Devices, Inc. All Rights Reserved
沪ICP备09046653号-1
  • Sitemap
  • Legal
  • Privacy & Security
  • Privacy Settings
EngineerZone Uses cookies to ensure you get the best experience in our community. For more information on cookies, please read our Privacy & Security Statement.