# Trouble Selecting Proper Sensor

The project goal:
-Activate motor 1 when object with sensor mounted moves in one direction(linear)
-Activate motor 2 when object with sensor mounted moves in opposite direction(linear)
*But the object may switch positions causing this linear motion to vary in terms of x and y axis.
I was leaning towards an accelerometer but with the axis possibly changing that may not work.

• I need the motor to run as long as the object keeps moving.
I am new to this but think it's my best option to achieve my goal.

You just use Sensor 1 and Sensor 2.

Seriously, we need more information. How far, how fast, how quickly to detect change in direction. Speed is relative to what? The object, the platform, the Earth?

Movement:4-12" in one direction and then back.
Plan on containing sensor in project box.
Looking for motor activation when the whole project box moves. Movement will be relative to earth. Speed less than 1-2 m/s. But would like to have activation whether it moves slow or fast but always less than 1-2 m/s.
If that is not specific enough I'll have to do some calculations and get back to you.
Thank you for trying to help,

Relative to the Earth is a difficult one. If you are outdoors then you can use GPS. Indoors is significantly more difficult.

An accelerometer will tell you when your velocity changes. That might be because you dropped the box. This is probably most useful to you. I like the ADXL345 3-axis accelerometer. That's useful because you don't need to be too careful about mounting it in a specific orientation. It can pick up all accelerations.

If I went about with the accelerometer? Would I just tie both of my motors to all 3 axis in case of different direction of motion or is there a simpler way to yield same result?

Let's say you mount the ADXL345 in a position where the X axis of the sensor is aligned with the motions you want to sense.

Positive accelerations in X could activate motor 1 and negative accelerations could activate motor 2.

Why would you need all 3 axes "tied to the motors"?