blog




  • Essay / Self-balancing robots

    Table of contentsIntroductionMethodologyKalman filterIntroductionThe use of self-balancing robots has become quite widespread in the modern world and they form the basis of many applications. The main reason why this robot became famous is that it is fundamentally based on the ideology of the popular inverted pendulum theory which, according to Wikipedia, "is widely used as a benchmark for testing control algorithms." The whole concept of our project revolves around the design and manufacturing of a robot capable of moving and balancing on two wheels. Say no to plagiarism. Get a tailor-made essay on “Why violent video games should not be banned”? Get the original essay The design includes a robot chassis with MPU6050 sensors, STM 32f401, speed encoders and optocouplers that operate in accordance with every order to help us achieve perfect balance. The tilt angle is taken into account and the robot moves either forward or backward to balance. The accelerometer and gyroscope sensors integrated into the MPU6050 are the main components of our design that are responsible for achieving vertical balance. Our goal is to: Help the robot achieve vertical balance and stabilize it for a significant period of time Incorporate a PID control loop that uses tilt information to control the rotation of the motors. Make sure that if the robot wobbles momentarily, it returns to its reference position. Our project includes a microcontroller, MPU6050 sensor, optocouplers and motor drivers. We used the stm 32f401 which reads the raw data from the sensors and optocouplers then, using PID control techniques, sends the data signals to the motor driver which in turn controls the torque of the motors. The MPU6050 sensor chip has a built-in accelerometer and gyroscope that helps us measure angular velocity and force. For a self-balancing robot, the tilt is the theta angle that we control. This theta is considered a feedback signal from the accelerometer for a theta reference equal to zero degrees. Theta reference corresponds to the moment when the robot is standing. The magnitude of theta difference controls the speed (torque) of the motor and theta feedback determines the direction. As the accelerometer output is very noisy, the gyroscope is used for precise measurement of theta feedback. The gyroscope measures angular velocity and the combination of the two outputs is essentially our raw data. Additionally, the main function of the optocoupler is to provide complete electrical isolation between the controller and the motor side. The significance of this project is that the self-balancing robot has become extremely popular and is used in a number of applications. either way. Whether we talk about it at the domestic, commercial or industrial level, this robot has been through it all. It can be used as a self-operated trolley in hospitals, restaurants, stores, etc. Designing and building this project from scratch gave us a clear idea of ​​how this robot works and explained the different components and the role they play in achieving the goals. balance.MethodologyComponent ListSTM32F401L298N Microcontroller Double H-BridgeGenerated DC MotorsBatteryJumper WiresOptocouplersBreadboardSwitchResistorsChassisGyroscope SensorSTM32F401 Microcontroller: The STM32F401 features a Core ARM 32-bit Cortex -M4 processor with FPU. These devices offer a dynamic power system for perfectly balanced devices. It has 81 I/O ports with capacityinterruption. All I/O ports are 5 V tolerant. The maximum current rating in STM is 25 mA. This Discovery card operates at a frequency of up to 84 MHz. Each GPIO pin can provide 3V or 5V. Additionally, it has 3xUART running up to 10.5 Mbit/s, 4xSPI running up to 42 Mbit/s, 3xIC, 12-bit ADC reaching 2.4 MSPS, 10 timers, 16 and 32 bit can run up to 84MHz. [2].Specifications: ST-Link 84 MHz USB Connectors System Clock 2 256 KB FlashMemoryOne ADCSeize 12-bitSixteen 32-bit general purpose timers81 I/O ports with interruptL298N Double H-bridge: This is a electronic circuit that allows a voltage to be applied across a load in the opposite direction. These circuits are often used in robotics and other applications to allow DC motors to run forward or reverse. The L298N H bridge is directly coupled to the DC motor and the input is given using an optocoupler. The L298N H-bridge component can be used with motors with a voltage between 5 and 35 V DC. There is also a 5V regulator built in, so if the applied voltage reaches 12V you can also supply 5V from the board. Gyroscope sensors: A gyroscope is a device used to calculate orientation and angular velocity. Gyroscopic sensors are used to measure the rate of angular change in radians per second, how fast is an object rotating? The measurement taken by the gyroscope present in the STM32F401 can be integrated to find the tilt angle of the body on which the gyroscope is mounted. The inclination is planned relative to the 90 degree vertical axis of the body. The MEMS gyroscope sensor is tiny (between 1 and 100 micrometers, the size of a human hair). As the gyroscope rotates, less resonant mass is lifted as the angular velocity fluctuates. This movement is transformed into very low current electrical signals that can be amplified and read by a host microcontroller. During rotation, the orientation of this axis is not affected by the inclination of the support, which allows the conservation of angular momentum. There are three forms of gyroscope: Rotating gyroscopes Vibrating gyroscope Optical gyroscope Rotating gyroscope: The classical gyroscope realizes the law of conservation of angular momentum which says that the total angular momentum of a system is constant in magnitude and direction if the resulting external spiral acting on the system is zero. A gyroscope sensor has the following specifications: Measuring range Number of sensing axes Nonlinearity Working temperature range PWM bandwidth: PWM is the modulation technique which is used to drive our motor. Duty cycle is an important factor described as the percentage available on time. A low duty cycle means a low power signal, but a high duty cycle means a high power signal. Different duty cycles are used, such as 100%, 75%, 50% and 25%, and control the speed of the DC motor. To generate PWM on the microcontroller, Timer 4 is configured and has four channels on pins PD12 to PD15 which can be used as PWM pins. The frequency of the PWM is chosen to be 100 Hz. Timer frequency = 84000000/ (8399+1) = 10000 Hz Angle measurement: In the feedback network, we have a gyroscope and an accelerometer which measure the angle and the rate of change of angle to which it returns. at the entrance. The following filters are used to measure the angle of a self-balancing robot.Kalman FilterThe Kalman filter is basically a set of mathematical equations that allow an interpreter-corrector to judge which is best in the sense that it decreases the estimated error covariance.