adding a mpu 6050 to current code

Hey guys could some one help me add a MPU6050 to this code which is radio controlled. just looking to have it stabilize when i let off the sticks. Basically like a balance bot but with rc controls.

FF761ALII7PDOCE.ino (9.61 KB)

You say it's "like a balance bot". IS it a balance bot? If so, you should get it to balance first and then add speed and direction controls. I would start with a google search for: 'self balancing robot mpu6050 arduino' and follow one of the many tutorials.

finding the correct rc controls and steering for a 2 wheeled car was hard. I finally have the RC controls perfect (hooby style RC and receiver) it is going to have support casters but it is inside a ball. i just wanna let go of the sticks and it trys to go back to level
think of it as a balnce bot inside a ball lol

OK, so something like a BB8 model. Don't you just give it a low center of gravity and when the motors stop the ball stops? The weight should make it self-leveling.

YES AND YES lol it is bb8 but everyones wobbles for a bit before it settles. i wanna try something new

Hi,
Is it related to this thread?

https://forum.arduino.cc/index.php?topic=644008.0

Tom... :slight_smile:

Hey Tom, It is related. However this is the code i want to use and the drive is finished now so i can test. also the last thread took a wierd turn with someoet basically telling me i dont know what im doing and blah blah. you seemed to be asking normal questions and offering advice so ty

I just want to add the MPU with the code i posted in this tread to help NOT fix but help keep him stable. he wont really be on two wheels there is helper casters as well.

dannyc9923:
YES AND YES lol it is bb8 but everyones wobbles for a bit before it settles. i wanna try something new

OK. I think the way to do it is to have the 'throttle' set the desired pitch (like in a quadcopter) rather than setting the speed directly (like in a ground vehicle). I would use the MPU6050 to measure pitch and use a PID control loop to adjust the PWM signal to the motors to get the desired pitch.
Look for an example of using the MPU6050 accelerometers to measure pitch.