anyone could help me please?
I’m making a self balancing robot with mpu6050 and servo with PID control but I’m facing few issues ti control it.
I mean…the problem is that the robot can not stay in balance because it is not reactive in the response.
I don’t understand why but in my opinion a cause could be the slow servos (continuos servo) or…something related to the code…I don’t know rightly …unlucky.
Please could you help me?
where is the problem?
I’m using the DMP capability to extract the angle and it seems good, stable, but…the reactivity is too little and the result is…crash!
please…any suggestion on it? I tryed to increase the value from PID control mapping it in a range but it doesn’t work well.
Many thanks to all.
Please see the code in attachment.
Balancing_RobotLoarri_LCD_2_0.ino (11 KB)
static int pot1Pin = A1;
static int pot2Pin = A2;
static int pot3Pin = A3;
Why are these global variables static?
I got lost wading through all the #ifdef statements, trying to remember what you have #defined, and what you haven't. When adapting code for YOUR robot, delete the stuff that is not relevant. the only #define/#ifdef statements should be for debugging.
It is not clear what your problem is. Is it taking to long to determine a correction factor? Or, are the drive motors not strong enough to keep the robot from tipping over?
thank you very much for your help.
Onestly I'm not so expert with Arduino...I'm a beginner !.
anyway...I declared static int pot123Pin for pins to connect potentiometers for kp,kd and ki: is it wrong?
then unfortunately I don't know which is the cause of the non-equilibrium but I have the suspect that continuos servo rotation is not enough strong to keep the robot standing or maybe the problem is from PID control?
Maybe the factor from PID is too little to give an acceleration to the servo: what do you think on it?
I see on web many projects similar to the one I'm doing, with servo ..and they seem work fine so maybe the problem is not related to servo itself.
unfortunately I could not find on web a code of self balancing robot with servos to be analyzed as an example
so It's difficoult for me to understand where is the problem.
I hope you can help me!!
Many thanks again.
Maybe the factor from PID is too little to give an acceleration to the servo:
May be. But since only you know what your robot looks like, and only you can see your serial output, only you can determine if this is a problem, or not.
and they seem work fine so maybe the problem is not related to servo itself.
A self-balancing robot should require little external force to get it to balance. It the batteries and motors are too high, a great deal of external force will be required. But, since only you can see your robot, only you can tell.
Yes you're right!!thanks! I have two questions again for you: is it wrong to declare static int pins for potentiometers?
Then... I understood that batteries and orters should be placed the most as high as possible but.....sometimes it seems that
The robot works better with batteries close as possible to the floor. What do you think on it????
Thanks again and regards
I understood that batteries and orters should be placed the most as high as possible but.....sometimes it seems that
The robot works better with batteries close as possible to the floor. What do you think on it?
I've never understood that concept. Motorcycle designers know better. Keep the weight as low and centered as possible.
Moving the weight up requires more torque to move it. Your servos may not have the torque needed, or may not be able to deliver the torque quickly enough.
That sounds good!!!many thnaks…I’lltry in this way and I’ll give you news asap!thanks again