This was a university project aimed at applying PID control and its graphical behavior. The project focuses on balancing a two-wheeled robot using the MPU 6050 sensor. With this sensor, we can determine the inclination, and through Arduino code, control the motors to counteract the fall error. Ideally, the angle should be 90 degrees, but it is slightly less due to the battery, taking the x-axis of the sensor as a reference. Thanks to the PID control implemented in the code, the robot achieves balance
The following graph shows the response to the impulse that the system is undergoing, it is desired to maintain the system response in steady state, but in this case, the system begins to generate oscillations because the constants kp, ki and kd are not correct so the robot will take longer and longer corrections, also increasing its speed generating this oscilation.
Octve code for the graph you can change your constants and see the behaviour
clear all, close all, clc;
pkg load control
Kp = 0.7;
Ki = 100;
Kd = 17;
C = pid(Kp, Ki, Kd);
numerator = 1;
denominator = [1, 1, 1, 0]; % Añade un polo adicional en s^3
P_pend = tf(numerator, denominator);
T = feedback(P_pend * C, 1);
t = 0:0.01:100;
impulse(T, t);
title({'Response of Pendulum Position to an Impulse Disturbance'; 'under PID Control: Kp = 0.7, Ki = 100, Kd = 17'});
Always in each project, I recommend conducting tests where you can save time and analyze errors before creating the robot on a PCB. This is the first design, but of course, before this, I followed my electrical schematic
To position the battery at the back, I recommend securing it with a flexible cable of an appropriate gauge, which can be molded to hold the battery. This is the final design after ensuring that it works well on a breadboard
Comments
Please log in or sign up to comment.