I am working on a project where I need the Arduino to 'sense' at what direction its moving. For example, I want the Arduino to 'sense' that it is moving towards 'forward' direction, 'backwards' direction etc.

Is that possible using an Arduino? Can I use a motion sensor to do this (probably not)?

Can any one please help me to find the right 'direction'?


For this you need a acceleration/gyro sensor, like the MPU6050.

By tracking x/y/z movements, you can define what is forward/backards etc. Also you can track angles/tilts (in 3 directions).

See an example how to use it here: MPU-6050

  • Thank you, I don't wanna go deep here, but is there a library present which I could use to make my work easier? Aug 7 '18 at 14:07
  • You can change the example as library, or maybe this link helps: maker.pro/arduino/tutorial/… I never tried the MPU6050 myself. Aug 7 '18 at 14:10
  • 1
    Well I tried by borrowing one from a friend, it worked 😮 thanks Aug 7 '18 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.