program for Arduino Nano and MPU for tilt reading

Thread Starter

mikemiller5855

Joined Nov 15, 2015
1
I am trying to teach my grandson programming with the Arduino Nano, and a project we came up with is for a walking robot unit.
We are going to slowly build thru the needed steps to gain knowledge as we go.
We are now at wanting to measure tilt angle while the robot moves forward.
We are using an Arduino Nano.
We have a stock MPU 6050 accelerometer/gyro chip and a flat LED stick that has 12 RGB LED's...
We only want 1 dimension ( a single axis) for the walking robot.
We want the LED strip to show the Robot tilt angle as he walks forward to know if he is straight up and down or if he is tilted forward or backward as he walks. The LED strip will be green when he is straight, or as he leans forward more the strip turns yellow, or as he leans backward the strip turns more red.
We were told that we would have to use a Kalman or Community Filter to work best.
Any help in writing the sketch would be appreciated. We have not worked with an MPU device or accelerometer before.
The Arduino Nano to MPU is hooked up the standard way... VCC to 5 volts, Grd to Grd, SCL to A5, SDA to A4, INT to D2
Thanks,
Mike & Jim
 
Top