The Flow of Working Controlled Self Balancing Robot

Since I know Arduino, I spend some of my time. I'm about 2 months about arduino. Here, like my previous problem (some solved in this awesome forum), Let me ask you in relation to the flow of working controlled self balancing robot.

Before I do something, 3rd question is "How do they work together?"

Here, understanding the circuit diagram and codes, I want to know exactly HOW bluetooth hc-05 controls the motor while the mpu6050 balances the motor.

I assume:

If the power is ON then
The mpu6050 starts to balancing the robot by Kp, Ki and Kd to force motor to stable the body - can go forward or backward, even stop.
If bluetooth commands to go forward or backward .... What will mpu6050 do???

I assume that there must be new MPU6050 configuration, such as Kp2, Kd2 and Ki2, for bluetooth. What do you think?

When I want to write the codes, is this following flow correct?

If bluetooth commands then
    mpu2 willl
    motors will ...

I get stuck on this, really.

what does bluetooth have to do with this?

there should be a closed loop routine that adjusts the motors depending on acceleration measurements.

as I said - to give a command to turn right, forward, etc (for speed adjustment).

the very significant code implementing the closed-loop control of the motors based on accelerometer measurements controls the velocity and direction based on the accelerometer targets. presumably those targets are zero for both the x and y directions.

command from bluetooth (or any other source) simply set the target values. if the velocity in not zero in the x direction, the motors are moved to provide that velocity.

hopefully you recognize that the bluetooth aspect of this project is trivial compared to the motion sensing and control

1 Like

hehehe .. thanks, I understand now.

After this, I will study hard to learn about motion sensing and control. Thanks again. done! yes!