close
test_template

The Self-balancing Robots

Human-Written
download print

About this sample

About this sample

close
Human-Written

Words: 1834 |

Pages: 4|

10 min read

Published: Oct 31, 2018

Words: 1834|Pages: 4|10 min read

Published: Oct 31, 2018

Table of contents

  1. Introduction
  2. Methodology
  3. Kalman Filter

Introduction

The use of self-balancing robots has become quite extensive in the modern world and they form the basis of numerous applications. The main reason why this robot has gained fame 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 designing and making a robot that can move and balance itself on two wheels.

The design includes a robot chassis with MPU6050 sensors, STM 32f401, speed encoders, and optocouplers which work in accordance with each order to help us achieve perfect balance. The angle of inclination is taken into consideration and the robot moves either in the forward or backward direction to balance itself. The accelerometer and gyroscope sensors embedded in MPU6050 are the main components in our design which are responsible for achieving upright balance.

We aim to:

  • Help the robot achieve upright balance and stabilize it for a significant amount of time
  • Incorporate a PID control loop that uses the tilt information to control the rotation of the motors.
  • Ensure that if the robot oscillates momentarily, it comes back to its reference position.

Our project comprises a microcontroller, MPU6050 sensor, optocouplers, and motor drivers. We used the stm 32f401 which reads raw data from sensors and optocouplers and then, with the help of 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 an accelerometer and a gyroscope embedded in it which helps us in the measurement of angular velocity and force. For a self-balancing robot, the tilt is the angle theta which we control. This theta is considered as a feedback signal from the accelerometer for theta reference equal to zero degrees. The theta reference is when the robot is upright.

The magnitude of theta difference controls the speed (torque) of the motor and theta feedback determines the direction. As the accelerometer’s output is very noisy, Gyroscope is used for an accurate measurement of theta feedback. The gyroscope measures the angular velocity and the combination of the two outputs is basically our raw data. Moreover, the main function of the optocoupler is to provide complete electrical isolation between the controller and the motor side.

The significance of this project lies in the fact that self-balancing robot has become extremely popular and it is being used in a number of applications in one way or the other. Whether we talk about it at the domestic, commercial or industrial level, this robot has made its way through everything. It can be used as a self-controlled trolley in hospitals, restaurants, shops etc. Designing and making this project from scratch gave us a clear idea about the working of this robot and instructed us about various components and what role they play in achieving the balance.

Methodology

List of components

  • STM32F401 Microcontroller
  • L298N Dual H-bridge
  • Generated DC motors
  • Battery Pack
  • Jumper Wires
  • Optocouplers
  • Breadboard
  • Switch
  • Resistors
  • Chassis
  • Gyroscope Sensor

STM32F401 Microcontroller: The STM32F401 has Core ARM 32-bit Cortex -M4 CPU with FPU. These devices offer a dynamic power system for perfect balanced devices. It has 81 I/O ports with interrupt proficiency. All I/O ports have 5V tolerant. The maximum current rating in STM is 25mA. This Discovery board operates at a frequency of up to 84MHz. Each GPIO pin can provide 3V or 5V. Moreover, it has 3xUARTs running at up to 10.5 Mbit/s, 4xSPI running at up to 42Mbit/s, 3xIC, 12-bit ADC reaching 2.4 MSPS, 10 timers, 16- and 32-bit which can run at up to 84 MHz[2].

Specifications:

  • System Clock of 84MHz
  • 2 USB ST-Link Connectors
  • 256 Kbytes Flash Memory
  • One 12-bit ADC
  • Sixteen general purpose 32-bit timers
  • 81 I/O ports with interrupt

L298N Dual H-bridge: It is an electronic circuit that permits a voltage to be applied across a load in opposite direction. These circuits are often used in robotics and other applications to allow DC motors to run forwards or backwards.L298N H bridge is coupled directly with the DC motor and input is given to using an optocoupler. The L298N H-bridge component can be utilized with motors that have a voltage of between 5 and 35V DC. There is also an onboard 5V regulator, so if your applied voltage is up to 12V you can also source 5V from the board.

Gyroscope Sensors: A gyroscope is a device used for calculating or orientation and angular velocity. Gyroscope sensors are used to measure the rate of angular change in radians per second, how fast an object is rotating? The measurement taken by the gyroscope present at STM32F401 can be integrated to find the tilt angle of the body on which gyroscope is mounted. Tilt is intended with respect to the vertical 90-degree axis of the body.

The gyroscope sensor within the MEMS is minute (between 1 to 100 micrometers, the size of a human hair). When the gyro is rotated, a lesser resonating mass is lifted as the angular velocity fluctuations. This movement is transformed into very low-current electrical signals that can be amplified and read by a host microcontroller. When rotating, the orientation of this axis is unaffected by tilting of the mounting, bestowing to the conservation of angular momentum.

There are three forms of Gyroscope:

  • Rotary Gyroscopes
  • Vibrating Gyroscope
  • Optical Gyroscope

Rotatory Gyroscope: The classic gyroscope achievements the law of conservation of angular momentum which says that the total angular momentum of a system is constant in both magnitude and direction if the resulting external spiraling acting upon the system is zero.

A gyroscope sensor has the subsequent Specifications:

  • Measurement range
  • Number of sensing axes
  • Nonlinearity
  • Working temperature range
  • Bandwidth

PWM: PWM is the modulation technique which is used to drive our motor. Duty cycle is an important factor described as percentage available on time. Low duty cycle means signal with low power however high duty cycle means signal with high power. Different duty cycles are used such as 100 percent, 75 percent, 50 percent, and 25 percent and they control the speed of DC motor.

To generate PWM on Microcontroller, the Timer 4 is configured which has four channels on pins PD12 to PD15 which can be used as PWM pins. The frequency of PWM is chosen to be 100 Hz.

Timer frequency= 84000000/ (8399+1) =10000 Hz

Angle measurement: In the feedback network we have gyroscope and accelerometer which measures the angle and the rate of change of angle at which it returns to the input. The following filters are used to measure the angle of a self-balancing robot.

Kalman Filter

The Kalman filter is fundamentally a set of mathematical equations that contrivance an interpreter-corrector type Judge that is best in the sense that it lessens the estimated error covariance when some assumed conditions are encountered.

The discrete Kalman Filter: The Kalman filter guesses a process by using a form of feedback control: the filter estimates the process state at some time and then gains reaction in the practice of (noisy) amounts. As such, the equations for the Kalman filter drop into two groups: time modernize equations and measurement update equations. The time modernize equations are answerable for jutting forward (in time) the current state and error covariance guesses to attain the a priori estimates for the next time step. The basic relation of Kalman filter is written as:

KalAngleX = 0.8 * (KalAngleX + Gy * Dt) + 0.2 * Acc

Where we have taken 80 percent value of Gyroscope and 20 percent of Accelerometer. The basic Gy*Dt basically perform the operation of an integrator and addition of angle performs a function of high pass filter. The summer also adds the two readings of the accelerometer and the gyroscope. Following are the functions of Kalman filter:

Can help fix noise, drift, and dependency of Horizontal acceleration? Fast estimates the angle, much less lag than low pass filter.

PID implementation: PID controller is the closed-loop feedback mechanism commonly used in industrial systems. A PID controller continuously calculates an error as the difference between the desired setpoint and measured process variable and applies a correction based on proportional, integral and derivative.

PID is basically composed of three components P, I and D or PI ad PD which is combined as PID.

P= Proportional Controller

I= Integral Controller

D= Derivative Controller

Proportional Controller is used for shifting of the poles to make the system fast and slow. Proportional control is used to stabilize the system. The constant that is used for this process is Kp. This has relation with a steady-state error. As we know that: ess= 1/(1+Kp)

If Kp approaches to infinity the steady state error goes to zero. So we should have high gain to have small steady state error but gain should be in the certain limit for the system to be stable. Integral Controller is used for the introduction of poles. It can either be used to attract zeros or repel the poles. It is used for reducing the steady state error and for making the system stable and the constant used for it is Ki. As we know from the final value theorem that less= 0

We can use to stabilize the system or make the steady state error zero. But there is a disadvantage that the system can increase the oscillations which is undesirable. Derivative Controller is used for the introduction of zeros and can be used to attract poles and repel zeros. By using derivation control it means that we are a system more sensitive. It responds to the rate of change of actuating error and then introduces the significant correction before the actuating error becomes very large. This controller does not directly lessen the steady state error but by adding the large value of damping it allows us to introduce the large value of Kp which improves the steady state error. The constant used is Kd.

Get a custom paper now from our expert writers.

The self-balancing robot has much resemblance to the system of an inverted pendulum. To make it stable on two wheels, a technique used for the stability of inverted pendulum is applied on the self-balancing robot. Two sensors i.e. Accelerometer and Gyroscope have been used to measure the tilt angle of the robot. The reason for using two sensors is that if accelerometer alone is used, it increases the error to very high value while Gyroscope alone can disturb the instantaneous response of the system. Therefore, both sensors with the combination of Kalman Filter has been used in this project. In order to tune it to the right value, the PID controller is used.

Image of Alex Wood
This essay was reviewed by
Alex Wood

Cite this Essay

The self-balancing robots. (2018, October 26). GradesFixer. Retrieved December 8, 2024, from https://gradesfixer.com/free-essay-examples/the-self-balancing-robots/
“The self-balancing robots.” GradesFixer, 26 Oct. 2018, gradesfixer.com/free-essay-examples/the-self-balancing-robots/
The self-balancing robots. [online]. Available at: <https://gradesfixer.com/free-essay-examples/the-self-balancing-robots/> [Accessed 8 Dec. 2024].
The self-balancing robots [Internet]. GradesFixer. 2018 Oct 26 [cited 2024 Dec 8]. Available from: https://gradesfixer.com/free-essay-examples/the-self-balancing-robots/
copy
Keep in mind: This sample was shared by another student.
  • 450+ experts on 30 subjects ready to help
  • Custom essay delivered in as few as 3 hours
Write my essay

Still can’t find what you need?

Browse our vast selection of original essay samples, each expertly formatted and styled

close

Where do you want us to send this sample?

    By clicking “Continue”, you agree to our terms of service and privacy policy.

    close

    Be careful. This essay is not unique

    This essay was donated by a student and is likely to have been used and submitted before

    Download this Sample

    Free samples may contain mistakes and not unique parts

    close

    Sorry, we could not paraphrase this essay. Our professional writers can rewrite it and get you a unique paper.

    close

    Thanks!

    Please check your inbox.

    We can write you a custom essay that will follow your exact instructions and meet the deadlines. Let's fix your grades together!

    clock-banner-side

    Get Your
    Personalized Essay in 3 Hours or Less!

    exit-popup-close
    We can help you get a better grade and deliver your task on time!
    • Instructions Followed To The Letter
    • Deadlines Met At Every Stage
    • Unique And Plagiarism Free
    Order your paper now