Two Wheel Self Balancing Robot

Print   

02 Nov 2017

Disclaimer:
This essay has been written and submitted by students and is not an example of our work. Please click this link to view samples of our professional work witten by our professional essay writers. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of EssayCompany.

Self-Balancing Robot

CHAPTER 1

INTRODUCTION

1.1 Introduction

The field of robotics has dominated the minds of people around the world. It was actually the dream of humans to create such a machine that replicates them in every aspect of daily life. Such a machine that reflects their thoughts, gestures, postures and perform the daily life activities. Development in this field for a last couple of decades has transformed dreams into reality. With the use of efficient microcontrollers and sensitive sensors has helped a lot in achieving this milestone. Now robots can be seen in our daily life. Robots are employed on production lines in factories, appeared as intelligent machines to do a specific task or used as commercial products.

Two wheel self-balancing robot is also a development in the field of robotics. This two wheel self-balancing robot is actually based on the concept of Inverted pendulum theory. This type of robot has gained fame and interest among researchers and engineers because it utilizes such a control system that is used to stabilize an unstable system using efficient microcontrollers and sensors. Two-wheeled balancing robots can be used in several applications with different perspectives such as an intelligent gardener in agricultural fields, an autonomous trolley in hospitals, shopping malls, offices, airports, healthcare applications or an intelligent robot to guide blind or disable people. These types of robots can effectively work in non-uniform surfaces due to their balanced control system. Self-Balancing Robot

2

The aim of our project is to design and implement a two wheel self-balancing robot that would bring many attributes and aspects of robots in it. A suitable microcontroller for stabilizing the robot is implemented. Two type of sensors be used to provide tilt information and encoders with motors are used to measure wheel‟s rotation.

1.2 Inverted Pendulum

As stated earlier that a self-balancing robot is based on inverted pendulum theory. An Inverted Pendulum is an inherently unstable system. Force must be properly applied to keep the system intact. To achieve this, proper control theory is required. An inverted pendulum is a pendulum which has its mass above its pivot point. It is often implemented with the pivot point mounted on a cart that can move horizontally and may be called a cart and pole. Whereas a normal pendulum is stable when hanging downwards and must be actively balanced in order to remain upright either by applying a torque at the pivot point or by moving the pivot point horizontally as part of a feedback system. As it is a non-linear system, so an inverted pendulum is amongst the most difficult systems to control in the field of control engineering.

1.3 Balancing Process of Two wheel self-balancing Robot

Two-wheeled balancing robot is an unstable dynamic system. Unstable means that robot is free to fall forward or backward without any applied forces. The word balance means the robot is in equilibrium state, which its position is like standing upright 90 degrees. However, the system itself is not balance, which means it keeps falling off, away from the vertical axis. Therefore, a combination of gyroscope and accelerometer is needed to sense angle position of the robot and input into the microcontroller, which implements the balancing procedure to Self-Balancing Robot

3

stabilize the robot. The microcontroller will then provide a type of feedback signal to the H-bridge circuit to turn the motor clockwise or anticlockwise. If tilt is in forward direction, wheels are moved in forward direction and vice versa, thus balancing the robot. Encoded motors are used to measure the wheel‟s rotation. Frequency to voltage converter is used to transform frequency of motor into voltage. D flip-flop circuit is also used to measure the direction of wheels either clockwise or anti-clockwise. The outputs of both these circuits are fed to microcontroller for processing and computing. The block diagram depicting the working and balancing process of two wheel self-balancing robot is shown in figure below.

1.4 Block Diagram

Figure 1.1: Block Diagram Self-Balancing Robot

4

CHAPTER 2

LITERATURE REVIEW

2.1 Literature Review

The applications based on inverted pendulum theory are becoming very common with the passage of time. The uniqueness and wide applications of this unstable system has gained popularity among researchers and robotics enthusiasts around the world. This section provides an insight and literature review to the current technology available to construct a two-wheel self-balancing robot. It also highlights various advancements in this technology with time and also encompasses various methods used by researches on this topic.

Segway (Dean Kamen, 2001) is commercially available two wheel balancing robot which was produced by Segway Inc. of New Hampshire, USA [2]. It was invented by David Kamen in 2001. It is a very successful personal transporter most commonly used by security guards in mega shopping malls to cover a vast area. Its advertising suggests the robot is ideal for adventure, law enforcement and transportation in general. It has capability to achieve a speed of 20km/h.

Figure 2.1: SEGWAY Self-Balancing Robot

5

iBot is another application of two wheel robot developed by David Kamen [3]. In 2006, David Kamen introduced mobile wheelchair. It was capable of balancing on two wheels. It can climb stairs and it increases its height when it is balanced on two wheels. The purpose of increasing height is to establish line of sight between disable person and other people.

Figure 2.2: iBot

EMIEW is a humanoid balancing robot and it was the first robot ever made that has gained much popularity because of its human like appearance and postures. It was developed by Hitachi research group [4]. EMIEW stands for "Excellent Mobility and Interactive Existence as Workmate". This technology has two models i-e EMIEW and EMIEW2. Both these models are capable of avoiding obstacles and have maximum speed of 6km/h. EMIEW was introduced in March 2005. Its height is 1.3 meters and has a weight of 70kg. Emiew2 followed in November 2007 and is approximately half the size of EMIEW at 0.8 m and 13 Kg. Its design concept hoped Self-Balancing Robot

6

to reduce the safety risks that were associated with EMIEW larger size, incorporating reductions in height and weight.

To avoid obstacles and people within its path, the robot utilizes laser radar to derive a map of its surround area. The knees contain an additional set of wheels that can be utilized when stability becomes too difficult to maintain. In additional to these features, the robot has the ability to raise each wheel by approximately 30 mm allowing it to avoid small obstacles.

Figure 2.3: EMIEW (Left) and EMIEW2 (Right)

David Anderson has developed the robot named nBot (Anderson 2007) [1]. This robot utilizes a gyroscope and accelerometer whose outputs are fused together by a Kalman filter, thus providing an accurate input to control the stability. Anderson was chosen four essential measurements that define the motion and position of nBot. These measurements are: Self-Balancing Robot

7

• Position of robot

• Velocity of robot

• Angular position of wheels

• Angular velocity of wheels

These measurements were summed as a feedback to microcontroller. Then microcontroller generates the required signal as a motor voltage, which is proportional to motor‟s torque.

Figure 2.4: nBot

The Industrial Electronics Laboratory at the Swiss Federal Institute of Technology in Switzerland has built a truly mobile and autonomous two-wheeled balancing robot (JOE) [5]. Researchers have developed two state-space controllers. One controller controls rotation around lateral axis (pitch) and the second one control the dynamics around its vertical axis (yaw). Each controller produce required torque for right and left motors. Self-Balancing Robot

8

Figure 2.5: JOE

Bender (Larson 2008) is a robot made from aluminum and PVC plastics. It was suggested to put the weight in upper portion of chassis in order to balance the system. When testing was in process with gyroscope and accelerometer mounted on the robot, it was seen that system was much more stable when they were placed in lower portion of chassis.

Some robots use different mechanism of balancing robot. They utilize a reaction wheel on the top of robot to generate external force to balance the robot. This reaction wheel provides rotation inertia to the opposite direction of robot‟s fall and stabilizes the system.

2.2 Summary

Summarizing all the researches and developments in these fields, it is observed that two wheel balancing robots have wide range of applications in our surroundings depending on the environment where it is deployed. Understanding the inverted pendulum theory is the key to develop self-balancing robot. Suitable control system mechanism and appropriate tilt sensors are very important for acquiring high level of stability. The hardware design plays a vital role in stabilizing the robot. Self-Balancing Robot

9

CHAPTER 3

KALMAN FILTERING

3.1 Introduction

Since its introduction in the early 1960s, the Kalman filter has being widely used in the control engineering community. The Kalman is a recursive digital filter that provides a very effective means of estimating the state of any process. The Kalman filter can be consider as a state estimator. Kalman filtering can be used as a tool to provide a reliable state estimate of the process. Another important feature of the Kalman filter is its ability to minimize the mean of the square error and provide a solution for the least square method. The Kalman filter can be used on a control system that is exposed to noisy environments because it minimizes the error. The filter can reduce noisy measurements from sensors data before it is fed into any control system. Noisy measurements from the sensors will not allow the system to reach stability. Having such filter characteristic Kalman filter can be implemented on a microcontroller and in software.

3.2 Sensor Fusion Using the Kalman Filter

The reason for using sensor fusion is that we want to acquire the accuracy and reliability of information regarding its operating environment for our robot. These requirements call for highly accurate sensors which are very expensive. In Sensor fusion technology where signal from several sensors are combined to provide an accurate estimate. Hence it is the most widely used solution according to requirement.

This section on the sensor fusion using the Kalman filter details on the experiment conducted on the inertial sensors used as part of the project. So by using Kalman filtering Self-Balancing Robot

10

technique we fused two common sensors namely Gyroscope (IDG500 Dual 500 deg / sec) and Accelerometer (MMA7341L 3-axis).

Though gyroscope and accelerometer both linked to the tilt angle of a robot but the use of either one of the sensors is unable to provide sufficient and more importantly reliable information in order to balance the robot.

The gyroscope provides a measure of instantaneous angular change but it produces a significant drift when the gyroscope is operating. This may be due to the operating temperature or inherent characteristics of the gyroscope itself. On the other hand, the accelerometer provides an absolute measure of acceleration, but the output signal is often corrupted with noise.

To overcome these problems, a signal-level sensor fusion technique using the Kalman filter is proposed. Signal-level fusion refers to the combination of signals of a group of sensors with the objective of providing a signal that is usually of the same form as the original signals but of greater quality. In this case, the accelerometer is used to eliminate the drift from the gyroscope signal via the Kalman filter. As a result, an accurate estimate of the angle and its derivative term is obtained.

3.2.1 Sensor Processing

Before using these two sensors in our project we have tested gyroscope and accelerometer using the servo test platform. Under this set-up a test program is written to rotate the sensors through a number of set points. The actual angle of inclination can be obtained based upon the control signal sent to the servo. From there a comparison is done between the actual angle of the servo rotation and the angle recorded by the sensors. This test platform ensures that the sensors manipulation is as exact as possible. Self-Balancing Robot

11

The digital rate gyroscope installed could only provide a measure of the instantaneous angular change. It is found that the gyroscopes rest average value drifts with time. This will introduce significant errors in the velocity and angular measurements.

3.2.1.1 Accelerometer Testing

The MMA7341L 3-axis accelerometer is used in this project. The accelerometer measures acceleration in a predefined axis. The sensor can provide a handy reference point to determine which way is up versus down orientation. The MMA7341L 3-axis accelerometer mounted on the robot was chosen because of it can be used as a tilt sensor. When configured as a tilt sensor the accelerometer can measure static accelerations. The MMA7341L 3-axis accelerometer uses earth‟s downward gravity force as its reference. So the sensor has a range in degrees of +/- 90o. An advantage of using the MMA7341L 3-axis accelerometer as a tilt sensor is that it can hold on to its output angle value. It will remain at that angle until it gets disturbed by an external force. Since the MMA7341L 3-axis accelerometer can be used as a tilt sensor, it seems that only sensor that is needed. There are some issues that may arise if the accelerometer is only sensor used as the input sensor to the robot control system. One issue that most accelerometer sensors have is that the output angle tends to have a very slow reaction to change. Another problem is that the sensor is very sensitive to noisy environments and vibrations. The accelerometer output is usually corrupted with noise. Self-Balancing Robot

12

Figure 3.1: Result of non-filtered accelerometer at 0o

From figure it is observed that an accelerometer gives the following output graph when measured at 0o. On x-axis we have taken time and on y-axis we have taken angle. After performing testing process on accelerometer with the help of servo motor we get a value of 325 on y-axis when angle is zero degree. Self-Balancing Robot

13

Figure 3.2: Result of non-filtered accelerometer at 90o when servo motor moving counterclockwise.

From figure it is observed that an accelerometer gives the following output graph when measured at 90o when servo motor is moving in counterclockwise direction. On x-axis we have taken time and on y-axis we have taken angle. After performing testing process on accelerometer with the help of servo motor we get a value of 430 on y-axis. This shows that when we move the sensor in counterclockwise direction the value along y-axis increases approximately 105 from original value. Self-Balancing Robot

14

Figure 3.3: Result of non-filtered accelerometer at 90o when servo motor moving clockwise.

From figure it is observed that an accelerometer gives the following output graph when measured at 90o with servo motor moving in clockwise direction. On x-axis we have taken time and on y-axis we have taken angle. After performing testing process on accelerometer with the help of servo motor we get a value of 170. This shows that when we move the sensor in clockwise direction the value along y-axis decreases and this decrease in value with original value is same as the increase in value with original value during counterclockwise cycle testing. Self-Balancing Robot

15

3.2.1.2 Gyroscope Testing

The digital IDG500 Dual 500 deg / sec gyroscope can only provide a measure of angular change. Angular change or rate refers to how fast an object is rotating in radians per second. The output of the gyroscope can be considered the derivative of the measured output angle from the accelerometer. The gyroscope tends to have a faster reaction to change as compared to an accelerometer. A very unique feature of the gyroscope is that it has a rest average value also referred to as a bias. The average value is given when the gyroscope is motionless. The bias has to be corrected at every measurement to get accurate velocity data. Gyroscopes do not hold onto the angular rate output change. Since a gyroscope does not hold on to the output value it cannot be used as a tilt sensor. One of the major problems that most gyroscopes have is that output average value tends to drift with time when the gyroscope is motionless. The output drift can be cause by changes of device operating temperature or the internal physical properties of the gyroscope itself. This drift can introduce significant errors in the angular measurements as shown below, Self-Balancing Robot

16

Figure 3.4: Gyroscope Testing at Slow Speed

The above graph gives a sinusoidal wave of a gyroscope. When the robot moves slowly in to and fro motion then we encounter the sinusoidal wave. From time axis before 175 the sinusoidal are more compressed because we move the gyro in a very slow motion and after that the motion of servo motors increases a bit to give a clear form of sinusoidal. Self-Balancing Robot

17

Figure 3.5: Gyroscope Testing at high speed.

The above graph shows a rectangle waveform when gyroscope tends to move very fast in to and fro motion. So from above graphs we concluded that gyroscope tells us about the falling speed of the robot. The faster the robot falls the more sinusoidal wave becomes the rectangle one. Self-Balancing Robot

18

3.3 Space State Equation of Self-Balancing Robot

The pendulum and wheel changing aspects were read and analyzed separately before implementation and finally we got these state space models which completely describe the behavior of the balancing robot. Linearized state space model for a self-balancing robot is describe below

= ‟ ‟‟ ‟‟ x xØ Ø                 2 2 22 2 2 0 1 0 0 0 0 0 0 0 1 0 0 m e p p p p m e p p k k M lr I M l M gl Rr k k r M l M gl Rr                          

+ Va ‟‟ x xØØ                 2 2 2 0 0 m p p p m p K I M l M lr K M l r Rr Rr                       

β = (2Mw+ +Mp) 2 2 w I r

α = [Ipβ+2Mpl2(Mw + )] 2w Ir Self-Balancing Robot

19

Following are the important terms which are used in these matrices where:

g = 9.81 m/s2

r = radius of wheel = 0.0381 m

Mw = Mass of wheel = 0.145 kg

Mp = Mass of body = 2.47 kg

Iw = Inertia of wheel = 0.0001053 kg*m2

Ip = inertia of body = 0.051 kg*m2

l = length to body is at center of mass = 0.21 m

Km = Motor torque constant = 0.006123 Nm/A

Ke = Back emf constant = 0.006087 Vs/rad

R = Nominal terminal resistance = 3Ω

Va = Voltage applied to motor for controlling robot

By using these vales, we first find the open loop transfer function and then measure the impulse response of the system Self-Balancing Robot

20

CHAPTER 4

HARDWARE DESIGN

4.1 Introduction:

The literature review accompanied in the previous chapter provided a wealth of information on past development phases in robotic projects that had been completed by researchers and engineers. The design phase of a project is fundamental in evolving the ideas, requirements and objectives of the components that collectively will form the completed robot. Development and careful design considerations provide the engineer with the ability of ensuring that the concept remains practical as it progresses. An initial physical structure was designed and built. Then, robot‟s specifications were measured for developing the mathematical model of two wheel self-balancing robot.

4.2 Hardware Components

The hardware components include microcontroller, sensors including gyroscope and accelerometer, DC motor, D-flip flop, and robot structure.

4.2.1 Microcontroller (Arduino Uno)

4.2.1.1 Facts about Arduino Uno

The main unit of any project is a microcontroller. The microcontroller that we are using in our project is Arduino Uno microcontroller. There are several reasons behind selecting Arduino as it is very flexible, more sensitive easy to use hardware and software; it receives input from a variety of sensors and can affect its surroundings by controlling lights, motors and other Self-Balancing Robot

21

actuators. USB port has made it easier to connect it to computer and allow programming and serial communication. The most fascinating feature is the already hardware setup on the board. On the software side, Arduino provides a number of libraries to make programming the microcontroller easier. The simplest of these are functions to control and read the I/O pins rather than having to fiddle with the bus/bit masks normally used to interface with the Atmega I/O. More useful are things such as being able to set I/O pins to PWM at a certain duty cycle using a single command or doing Serial communication. The hardware platform of Arduino has kept us protected to prepare a separate PCB.

4.2.1.2 Overview

The Arduino Uno is a microcontroller board based on the ATmega328 [6]. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.

The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial converter.

Revision 2 of the Uno board has a resistor pulling the 8U2 HWB line to ground, making it easier to put into DFU mode.

Revision 3 of the board has the following new features:

ï‚· Pinout: added SDA and SCL pins that are near to the AREF pin and two other new pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage

Self-Balancing Robot

22

provided from the board. In future, shields will be compatible both with the board that uses the AVR, which operate with 5V and with the Arduino due that operate with 3.3V. The second one is a not connected pin that is reserved for future purposes.

ï‚· Stronger RESET circuit.

ï‚· Atmega 16U2 replace the 8U2.

Figure 4.1: Arduino Uno

4.2.1.3 Power

The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a Self-Balancing Robot

23

2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

ï‚· Vin. The input voltage to the Arduino board when it is using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). We can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

ï‚· 5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage the board

ï‚· 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.

ï‚· GND. Ground pins.

4.2.1.4 Memory

The ATmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has 2 KB of SRAM and 1 KB of EEPROM. Self-Balancing Robot

24

4.2.1.5 Input / Output

Each of the 14 digital pins on the Uno can be used as an input or output. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor of 20-50 kΩ. In addition, some pins have specialized functions:

ï‚· Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

ï‚· External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value.

ï‚· PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output.

ï‚· SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.

ï‚· LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.

The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin. Additionally, some pins have specialized functionality:

ï‚· TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library. There are a couple of other pins on the board:

ï‚· AREF. Reference voltage for the analog inputs.

Self-Balancing Robot

25

ï‚· Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

Figure 4.2: Arduino Uno pin description

4.2.1.6 Communication

The Arduino Uno has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). The RX and TX LEDs on the board will flash when data is being transmitted via the USB-to-serial chip and USB connection to the computer. Self-Balancing Robot

26

4.2.1.7 USB over current Protection

The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.

4.2.1.8 Physical Characteristics

The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively, with the USB connector and power jack extending beyond the former dimension. Four screw holes allow the board to be attached to a surface or case. Note that the distance between digital pins 7 and 8 is 160 mm (0.16") not an even multiple of the 100 mil spacing of the other pins.

4.2.1.9 ATmega328-Arduino Pin Mapping

Figure 4.3: ATmega328-Arduino Pin Mapping Self-Balancing Robot

27

4.2.1.10 Summary Microcontroller

ATmega328

Operating Voltage

5V

Input Voltage (recommended)

7-12V

Input Voltage (limits)

6-20V

Digital I/O Pins

14 (of which 6 provide PWM output)

Analog Input Pins

6

DC Current per I/O Pin

40 mA

DC Current for 3.3V Pin

50 mA

Flash Memory

32 KB (ATmega328) of which 0.5 KB used by bootloader

SRAM

2 KB (ATmega328)

EEPROM

1 KB (ATmega328)

Clock Speed

16 MHz



rev

Our Service Portfolio

jb

Want To Place An Order Quickly?

Then shoot us a message on Whatsapp, WeChat or Gmail. We are available 24/7 to assist you.

whatsapp

Do not panic, you are at the right place

jb

Visit Our essay writting help page to get all the details and guidence on availing our assiatance service.

Get 20% Discount, Now
£19 £14/ Per Page
14 days delivery time

Our writting assistance service is undoubtedly one of the most affordable writting assistance services and we have highly qualified professionls to help you with your work. So what are you waiting for, click below to order now.

Get An Instant Quote

ORDER TODAY!

Our experts are ready to assist you, call us to get a free quote or order now to get succeed in your academics writing.

Get a Free Quote Order Now