LilyPad Accelerometer Hookup Guide

Pages
Contributors: Gella

Introduction

The LilyPad Accelerometer is a three axis accelerometer made for sewable applications. Based on the ADXL335 MEMS accelerometer from Analog Devices, the LilyPad Accelerometer can detect joint movement as well as inclination and vibration.

The ADXL335 outputs a 0V to 3V analog signal on each of the X, Y, and Z axis. You will need to convert this analog voltage to a gravity amount and use trigonometry to calculate a true ‘angle’. If you are not looking for tilt, it is very easy to use this sensor for basic motion sensing.

LilyPad Accelerometer - ADXL335

DEV-09267
$18.50
For this tutorial, we'll be using CodeBender - you can follow along with the coding enviroment in the tutorial or copy and paste the code into your Arduino IDE.

Suggested Reading

We won't be covering the basics of accelerometer technology in this tutorial, just adding this sensor to a project. For more detailed information on accelerometers check out these tutorials:

Attaching to a LilyPad Arduino

The LilyPad Accelerometer has five pins: Power (+), Ground (-), X, Y, and Z. Connect + to the + pin on a LilyPad Arduino and - to the - pin. To read the values from the X, Y, and Z pins, they need to be connected to an analog pin on the LilyPad. In this example, we're using the A2, A3, and A5 tabs on the LilyPad. The A4 tab is difficult to clip an alligator to while the FTDI board is connected.

To follow along with the code examples in this tutorial, connect the accelerometer to a LilyPad Arduino as shown below.

alt text

Project Examples

Dungeons and Dragons Dice Gauntlet

The Dungeons and Dragons Dice Gauntlet incorporates a display that will randomly generate numbers between 1 and 4, 6, 8, 10, 12, 20, or 100 in response to arm movement.

alt text

Das Blinken Top Hat

The Das Blinken uses the SparkFun Triple Axis Accelerometer Breakout - ADXL335 Breakout Board to control lighting effects on the hat. While not a sewable project, this is a great example of wearable electronics.

Spinng LED Top Hat

Fitness Tracker with SparkFun Photon Wearable Shield

In this video, Creative Technologist Nick Poole uses LilyPad sensors (accelerometer, temperature, and light) with a Particle Photon and Photon Wearable Shield to create a fitness tracker bracer.

Audience Jacket by OCAD's Social Body Lab

The Audience Jacket combines a LilyPad Accelerometer with XBee modules to wirelessly communicate movement data to a computer. When the wearer claps, the movement triggers a cheering sound effect.

Resources and Going Further

Here are some resources for e-textiles and planning a project with the light sensor:

Or, you can check out these other great light-based tutorials:

Accelerometer Basics

A quick introduction to accelerometers, how they work, and why they're used.

Are You Okay? Widget

Use an Electric Imp and accelerometer to create an "Are You OK" widget. A cozy piece of technology your friend or loved one can nudge to let you know they're OK from half-a-world away.

Motion Controlled Wearable LED Dance Harness

Control LEDs based on your movement using an accelerometer! Make your LEDs breathe by fading in and out when laying on the floor, turn off the LEDs when moving to your side, or make the LEDs blink in a headstand!

Wireless Gesture Controlled Robot

Control the RedBot wirelessly based on the movement of your hand using an accelerometer, Arduino, and XBees!