Skip to main content

Dozuki Update 8/24

Minor Versionm

by Alan

Introduction

The ADXL343 is a lightweight and low-cost accelerometer that can be used for a variety of projects. It sends data on its acceleration from three degrees of freedom. Read more about its capabilities on its Adafruit page.

Learning how accelerometers work will help you successfully complete this guide. Here are some useful links:

  1. To open links in a new tab, right-click on the link and select "Open link in new tab" to avoid losing your progress while following this tutorial. Before you complete this tutorial, make sure that you have completed the Feather M4 Express and I2C tutorials first. This tutorial utilizes the Trinket M0, which acts the same as a Feather.
    • To open links in a new tab, right-click on the link and select "Open link in new tab" to avoid losing your progress while following this tutorial.

    • Before you complete this tutorial, make sure that you have completed the Feather M4 Express and I2C tutorials first. This tutorial utilizes the Trinket M0, which acts the same as a Feather.

    • You will also need these extra components: The ADXL343, a USB cable, and female-to-female jumper cables. We will not be using a breadboard and instead directly linking the ADXL to the Trinket.

  2. The ADXL343 works by measuring its acceleration in all directions, then sending that information over I2C. For a refresher on the I2C protocol, visit the AM2320 tutorial.
    • The ADXL343 works by measuring its acceleration in all directions, then sending that information over I2C. For a refresher on the I2C protocol, visit the AM2320 tutorial.

    • To connect this component to the Feather, simply connect the power, ground, and I2C cables. The labels may be on the underside of either board. Remember that the ADXL is directional, so keep it face up to remember what perspective it's giving you readings from. You can also check its pinout on its Adafruit Learn page.

  3. To use CircuitPython for this tutorial, you will need these libraries from the adafruit bundle: adafruit_adxl34x.
    • To use CircuitPython for this tutorial, you will need these libraries from the adafruit bundle: adafruit_adxl34x.

    • Make sure the version matches your installed CircuitPython version.

  4. The ADXL syntax is very simple. It has two main commands, acceleration and events. adxl.acceleration is fairly eslf-explanatory, it returns the acceleration on all three axes as a tuple variable type. adxl.events checks to see if anything is happening to the ADXL, such as a tap or double tap. See how to enable these on the Adafruit page.
    • The ADXL syntax is very simple. It has two main commands, acceleration and events. adxl.acceleration is fairly eslf-explanatory, it returns the acceleration on all three axes as a tuple variable type. adxl.events checks to see if anything is happening to the ADXL, such as a tap or double tap. See how to enable these on the Adafruit page.

    • Find a couple more commands in the CircuitPython documentation for the ADXL.

    • Make sure your wiring is correct using the Adafruit example code in their bundle.

  5. To earn a badge for this component, use the included NeoPixel to flash colors when a the ADXL rotates over a certain limit. For example, when it rotates over 45 degrees in the X direction, turn the NeoPixel red. When it goes over 45 degrees in the Y direction, turn it green. You will likely need to have previously followed the NeoPixel tutorial.
    • To earn a badge for this component, use the included NeoPixel to flash colors when a the ADXL rotates over a certain limit. For example, when it rotates over 45 degrees in the X direction, turn the NeoPixel red. When it goes over 45 degrees in the Y direction, turn it green. You will likely need to have previously followed the NeoPixel tutorial.

    • Use the breadboard and male-to-male connectors in order to accomplish this. Multiple connections from one pin on the Trinket will need to be made. To test your program, tilt the entire breadboard.

Quiz:

ADXL343 Accelerometer: Quiz

Eli Foster

Member since: 05/15/2024

15 Guides authored

Team

Maker-E Techs Member of Maker-E Techs

7 Members

49 Guides authored

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 1

Past 7 Days: 1

Past 30 Days: 9

All Time: 42