# Detecting specific motion with a 3-axis accelerometer?

Hi folks,

So my son and I are planning a project for his fine Pinewood Derby car next year. The idea is to have it light up an 8x8 LED matrix in response to motion.

We have a 3-axis accelerometer (adxl335 gy-61), and what I'm trying to do is determine if it will provide specific enough information to do what we want.

Here are the states we'd like to have the car respond to:

State 1: Idle. The car is not moving. It is probably on the impound table with all of the other cars, doing nothing.

Stage 2: Staging. The car has been picked up and is carried to the track and placed in the starting location.

Stage 3: Racing. The starting gate has dropped and the car rolls down the incline and over the track to the finish line.

The part that has me rubbing my chin is what criteria would I used to distinguish between the car being picked up and carried to the track, and the car actually rolling down the track. The main difference that I can see is that the latter involves a definite sloped drop (as it rolls down the slope of the track) and will be moving much faster in a linear direction.

Can I reliably read enough data from the accelerometer to distinguish between these states?

Buff up on vector mechanics. A book on engineering statics should have enough in there to get a basic understanding.

The magnitude equation mag=sqrt(x^2+y^2+z^2) will give you the magnitude of gravity using the 3 axis triad.

Orientation is x/mag y/mag z/mag for the normal position vector.

If mag=1g the car is idle.

If mag>>1g car is being picked up.

If mag is oriented a certain direction and mag>1g the car is moving down the track.

If mag is oriented a certain direction and >>1g it has hit the end of track (high acceleration at impact)