You are on page 1of 38

DEVELOPMENT AND CONTROL OF A BALLBOT DRIVEN BY FOUR

OMNI-DIRECTIONAL WHEELS

By

Thilina Induranga Lankathilake

A thesis submitted in partial fulfillment of the requirements for the


degree of Bachelor of Science in Engineering in
Mechatronics Engineering

Examination Committee: Dr. Manukid Parnichkun


Dr. Mongkol Ekpanyapong
Dr. Somrak Petchartee

Nationality : Sri Lankan

Asian Institute of Technology


School of Engineering and Technology
Thailand
April 2014
ACKNOWLEDGEMENT

I am thankful and, want to extend my gratitude towards to the person who stood behind all
the time, giving me advices, my advisor and the chairperson of capstone project examination
committee Dr Manukid Parnichkun Associate professor Mechatronics; Robotics; Control
Theory; Sensing & Measurements, Asian Institute of Technology, for the timely advice,
guidance and encouragement provided through the project.

Also I would like to extend my gratefulness towards other committee members of the
capstone project examination, Dr. Mongkol Ekpanyapong and Dr. Somrak Petchartee, for
the advice and the provided guidance.

Last but not least I would like to extend my warm thanks to all the faculty members, staff
members, friend and my family for all the support given.

Induranga Lankathilake

ii
ABSTRACT

A Ballbot is a dynamically stable mobile robot, which is balancing on a single spherical


wheel. This topic has been a research topic in many universities because of the large scope
of usage it has. Since the robot will have only one contact point with the ground, it is
omnidirectional and highly dynamic in moving around.

This project have demonstrated the development of a ballbot with four omni directional
wheels. The concept of a ballbot can be depicted as an inverted pendulum. The dynamical
stability needed to be gain through continuous data acquisition of its orientation in 3D space.
This project intend to achieve the static balancing through these techniques. As a further
development the capabilities of the ballbot will be extended to planer motion as it drive to
desired locations.

This project will require intimately interconnected and explicable knowledge of


mechatronics engineering. The concept of ballbot is simple, yet it requires knowledge in
mechanical, electrical, control theory, programming and general physics.

iii
TABLE OF CONTENTS

CHAPTER TITLE PAGE

Title Page i
Acknowledgement ii
Abstract iii
Table of contents iv
List of figures v
List of tables vi

1 Introduction 1
1.1 Background 1
1.2 Problem Statement 2
1.3 Objectives 3
1.4 Limitations and Scope 3

2 Literature Review 4
2.1 Drive mechanism 6
2.2 Equations of motion and controllability 7

3 Methodology 11
3.1 Parts and components 12
3.2 Project flow chart 13
3.3 Hardware design construction 14
3.4 Circuit design construction 17
3.5 Reading IMU data 18
3.6 Control algorithm 20

4 Results and Discussion 21


4.1 IMU testing 21
4.2 Ballbot testing 24

5 Conclusion and Recommendations 26


5.1 Conclusion 26
5.2 Recommendations 27

6 References 28

iv
LIST OF FIGURES

FIGURE TITLE PAGE

1.1 The ballbot developed by Prof. Masaaki Kumagai at Tohoku 1


Gakuin University, Japan in 2008. (TGU)
2.1 CMU Ballbot 4
2.2 Rezero Ballbot 5
2.3 CMU Ballbot inverse mouse-ball drive mechanism 6
( Lauwers, Kantor & Hollis,2006)
2.4 TGU Drive (Justin Fong,2009) 7
2.5 CMU Ballbot model for equations and controller 7
( Lauwers, Kantor & Hollis,2006)
2.6 CMU Ballbot model for equations and controller 9
(T.B. Lauwers, 2006)
2.7 TGU Ballbot model for equations and controller 10
(Kumagai & Ochiai, 2009)
3.0 Elements of Ballbot 11
3.1 Arduino MEGA 2560 12
3.2 GY-85 IMU 12
3.3 Omni wheels 12
3.4 Faulhaber 12V DC motor 12
3.5 SLA Battery 12
3.6 Small size basketball 12
3.7 Motor driver (L298 based) 13
3.8 Acrylic sheets 13
3.9 studs and nuts 13
3.10 Project flow chart 13
3.11 SolidWorks design for the ballbot 14
3.12 Dimensions of the platforms (bottom platform) 14
3.13 Motor mount 15
3.14 Motor mount side panel 15
3.15 Motor mount bottom panel 15
3.16 Orientation and contacts of the ball and the motors 15
3.17 Different stages of development of the ballbot structure 16
3.18 Final structure of the ballbot with all components installed 16
3.19 Schematic of the circuitry 17
3.20 Actual image of the circuitry 17
3.21 X, Y and Z axis zero g offset at 25oC, Vs = 3.3V 18
3.22 Complementary filter 19
3.23 Concept of Kalman filter 19
3.24 PID loop for the Ballbot 20
4.1 Simulated orientation of the IMU 21
4.2 X and Y data obtain for FreeIMU 22
4.3 X and Y data obtain for FreeIMU 23
4.4 X and Y data obtain for Kalman filter 24
4.5 Potentiometers for change P, I and D values 25

v
LIST OF TABLES

TABLE TITLE PAGE

3.1 Parts for the Ballbot 12

vi
CHAPTER 1
INTRODUCTION

1.1 Background

A Ballbot is a dynamically stable mobile robot, which is balancing on a single spherical


wheel. This topic has been a research topic in many universities because of the large scope
of usage it has. Since the robot will have only one contact point with the ground, it is
omnidirectional and highly dynamic in moving around.

The most challenging part in the robot building is to build a robot that can operate in human
populated environments. One most important challenges are the propulsion system and
navigation. Usually wheeled robots have stable platforms, but lately researches have gone in
to developing dynamically stable and agile wheeled structures. They have enough stability
to easily maneuver through obstacles and regain its stability even when pushed. This project
intend to present one of the popular methods of dynamically stable structures, which is based
on single spherical wheel controlled by four omnidirectional wheels. (Which is referred as a
ballbot in most of the contexts)

1
The project ballbot was developed and tested as a test platform to study the motion, agility
and other characteristics of dynamically stable mobile robots to be deployed in human
environments.

It is important to understand and find out why dynamically stable platforms are different
form traditional statically stable platforms. In order to maintain stability the robot or the
platform should have it center of mass acting within the perimeter of its wheels or whatever
supports. When it moves, if its a tall structure, there is more chance of tipping over and
loosing stability. However with the ball bot the single wheel allows the robot to move at any
direction and since its dynamical stability it will gain stability without tipping over. This
make these kind of structures ideal for the human environments and to interact with human
more in a humanoid way.

This project will focus on developing a small ballbot platform, which is going to be
stabilized dynamically. This project probably will have two main stages on the way to its
success. The first goal will be to make the ballbot balance on itself and the secondly to make
it move while balancing.

1.2 Problem Statement

The ballbot is a dynamically stable, mono wheel robot. Because of the dynamic stability, it
has to keep track of the acceleration and gravity vectors, all the time. To make the ballbot
balance and move, it will have to provide motive power to the driving ball through four
omnidirectional wheels accordingly to the feedback of the acceleration and gyro sensors.
Therefore, this project will finally produce a ballbot which is capable of balancing on its
own and moving.

2
1.3 Objectives

Design and develop a ballbot balancing on a single ball.


o Designing and developing the hardware.

o Designing the circuits and needed components.

o Reading the IMU data and converting them to angles.

Developing a PID algorithm as the control system of the ballbot.

The main objective in this project is to make the ballbot balance on a single ball. For the
task of balancing, a PID control algorithm will be needed. The controller has to be optimized
to ensure a highly dynamic and maneuverable motion of the ballbot. The next stage will be
to make the ballbot move while keeping the balance. This stage will be done after achieving
the first objective and only if the given time period is sufficient.

1.4 Limitations and Scope

This ballbot will be made so that it can balance by itself at first. If possible, the maximum
effort will be put to make the ballbot move with given commands. For the balancing part,
the body of the ballbot is not needed to be tall. However, when it has to move efficiently and
smoothly, the body should lean accordingly to the direction of movement. In this scenario,
it will give much more stability to the ballbot if it has little taller body. In addition, we have
to do certain assumptions as we go along with the mathematical models, such as no slip, no
friction in moving parts, no deformation on the ball, fast motor dynamics and that the ball
moves only horizontally.

3
CHAPTER 2
LITERATURE REVIEW

The ballbot was developed for the first time, in Carnegie Mellon University (CMU) in 2006.
T.B. Lauwers, G. A. Kantor, and R. L. Hollis were the ones who developed this structure.
The drive mechanism of the ballbot was much similar to an inversed mouse-ball.
Furthermore it was designed to be as tall as an average human. The second robot was
developed in 2008 at the Tohoku Gakuin University (TGU). Dr. Masaaki Kumagai was the
person who was in charge of this project. With around 7.5 kg of weight and around 0.5 meters
of height, it was more compacted and smaller (figure 1.1). The drive mechanism, which is
different form the first ballbot, had wheels to drive the ball by placing them in 120 degrees
apart. This uses the minimum number of wheels needed it to move around. But the
orientation of its wheel position makes it harder to define movement for the functionality.

Figure 2.1 shows the CMU ballbot that designed by Tom Lauwers. This had an inverted
mouse ball type mechanism as its drive system. This made the ball move in x and y directions
by turning the ball using motor. An inertial measurement unit (IMU) has been used to obtain
the position of the ballbot. This ballbot has the ability to identify the rotated angle. Which
allowed it to stop uncontrollable yaw. The ballbot was controlled using a joystick.

4
The Rezero Ballbot (figure 2.2) is a project developed quite recently and with lot of success.
It is a combination ballbots from Carnegie Mellon University (CMU), Tohoku Gakuin
University (TGU) and University of Adelaide (UA).

The controllers that has been used in these ballbots are different form each other. The CMU
ballbot had used a LQR (linear quadratic regulator) and an inner PI controller. A PD
(proportional-derivative) controller was used by the TGU ballbot. The UA ballbot had used
a LQR controller and also with use of an additional integrating part.

These ballbots are optimized using controller to ensure an extremely dynamic and flexible
motion for the ballbot. Unique input modes for velocity, position, acceleration set points
were used by the Rezero ballbot. It has maximum speed of 2m/s and maximum tilt angles up
to 20. The dynamic robustness allow it to handle external forces without losing the balance.
In winding up, this ballbot has consumed lot of money for the development process.

5
2.1 Drive mechanism

The CMU ballbot (Figure 4) has two orthogonal rollers, which has contact with the sphere
equator and perpendicular to each other. Both of these rollers are driven with powerful DC
servomotors, transferring power via timing belts. Apart from the main two driving rollers, it
has two additional idle rollers to keep the pressure balanced and to keep the ball within the
desired position. Ball transfers are used to distribute the weight of the whole structure.

The design procedure used in the TGU is built on three stepper motors making 120 degrees
among each other. This has several outcomes in contrast to the CMU prototype. The
foremost the ability to yaw, which is not possible in Lauwers et al prototype without adding
few more motors. Since TGU model uses the motors directly connected to Omni wheels it
gain the ability to support the robots weight without the transferring the ball, which minimize
the friction in the ball and also allows a smother drive. Disadvantages are that it needs more
the computational needs do calibrate how to drive the ball.

6
2.2 Equations of motion and controllability

Both TGU and CMU models have similarities when it comes to equations of motions. Like
most of the other ballbots they have the inverted pendulum concept and balancing technique.
In addition, they have used several assumptions, such as static friction, non-linear friction,
and ball deformity and body flexibility. These assumptions have made the leaner approach
of the controllability simper

7
Equations of motion are presumed equal in both planes permitting the model of a single
controller as well as the ability to include it to the two planes. So the dynamics of the system
is obtained using Lagranges equation method.

T: sum of the kinetic energy.


U: potential energy.

In figure 2.5 indicates the co-ordinates system in the CMU.


Kb; The kinetic energy of the ball
lb; inertia of the ball
mb; radius of the ball
rb; mass of the ball

The potential energy is equal to zero since it is presumed that the ball will not hop or bounce.
Calculate the kinetic and potential energy of the body is the next step.

L: distance from body center of mass and ball


mB: body mass
lB : inertia
g: gravity acceleration

8
Lauwers et al ended up with the Euler-Lagrange equation model summing of all potential
and kinetic forces demonstrated in the velocity and coordinates with controllable variables
for ball and body angle by re-arranging the results indicated in equation 5.

In CMU, viscous component based on a model of the torque is also added in the end with
matrix of equations.

This creates the problem into Coriolis, Mass matrix and centrifugal matrix, damping l matrix
and Gravitation matrix in respect to velocity (dq/dt) and position q in two planar systems.

In figure 2.6 CMU model controller is consist of an inner loop in order to provide a feedback
of the velocity of the ball to a Proportional Integrator controller. It also consists of outer
loop to provide a full stake feedback for the linear quadratic regulator. PI gains, kp and ki
are chosen experimentally to make the desired ball velocity track.

9
Dr. Masaaki Kumagai opted for a proportional derivative controller in the TGU model for
the balancing. The proportional and derivative outcomes were achieved through
experimentation. The desired gain is after passed on to two effective wheels, which imitate
the ball drive allowing a simple PI controller derivation. The prototype based, shown in
Figure 2.7, utilizes a familiar derivation method which relates to the wheel acceleration.

Masaaki et al also calculated and simulated the model based on a load condition and
reduced that with the top load of the ballbot in the TGU, inertia and pendulum moment
decreased to raise the center of the mass. In conclusion, acceleration of the robot decreases
closely to inversely proportional to the increase of inertia.

10
CHAPTER 3
METHODOLOGY

Figure 3.1 Elements of Ballbot

The ballbot will mainly consist above components. The figure 3.1 is a design with only three
omni-wheels, but for this project four omni-wheels has been used. There exist few ways to
get the position of the ballbot. The main method is to get the position data form the IMU
unit. Inertial measurement unit (IMU) consist of gyroscope and an accelerometer. With the
use of a filter we can get the tilted angle of the ballbot. For this project encoders will not be
used, but it can be used to find the motion of the ballbot. This can be implemented in future
developments. The omni-wheels will be driven using four 12V DC gear motors. As the
processing unit for this project, Arduino Mega 2560 board has been used. All the control
loops and filters has been implanted inside this board. All the motors and the processor has
been powered using a SLA battery. By using the compass, which comes with the IMU, the
yaw of the ballbot can be obtained. This data will be needed when trying to add motion to
the ballbot more than for the balancing part. The body structure that holds all these
components together has been made out of acrylic. Further details of each of these
components has been discussed lately.

11
3.1 Parts and components
Part/Item Description
Micro controller Arduino Mega 2560
IMU GY-85 nine axis IMU (Gyro+Accelerometer+compass)
Motors Three brushless DC motors (with encoder)
Battery 12V,0.2A SLA battery
Ball Rubber surfaced basketball
Motor driver L298 based motor driver circuit
Omni wheels
Acrylic sheets, studs, nuts, spacers

Table 3.1 - Parts for the Ballbot

Figure 3.1- Arduino MEGA 2560 Figure 3.2- GY-85 IMU

Figure 3.3 Omni wheels Figure 3.4 Faulhaber 12V DC motor


(Torque 1.72Nm, Speed 120rpm)

Figure 3.5 SLA Battery Figure 3.6 Small size basketball

12
Figure 3.7 Motor driver (L298 based) Figure 3.8 Acrylic sheets Figure 3.9 studs and nuts

3.2 Project flow chart

Figure 3.10 - Project flow chart

The process of developing any robot will have a similar flow chart. Firstly the needed
knowledge and data was found through literature review. Then electrical parts and hardware
parts were completed. Then the integration part was carried out. Finally, the firmware part
and testing. This part goes in a loop with modifications to both hardware and firmware, until
the desired outcome has been achieved. Different approaches are needed to be perform in
order to overcome the obstacles face during the project.

13
3.3 Hardware design construction

Figure 3.11- SolidWorks design for the ballbot

Above figure is the initial design that was created for the ballbot project via SolidWorks.
The model consist of three main platforms and motor mounts. As in the design as well as in
the actual model, all the platforms and motor mounts are made out of acrylic sheets. To keep
the platforms in its position four threaded bars (studs) have been used with nuts and
tightening washers. The height difference of the bottom and top platform is around 24cm.
Basic dimensions of the parts are shown bellow

- All the diagrams have use cm as the unit size.

Figure 3.12- Dimensions of the platforms (bottom platform)

14
Figure 3.13- Figure 3.14- Figure 3.15-
Motor mount Motor mount side panel Motor mount bottom panel

The motor mounts are made as a separate unit for the ease of removing and reassembling the
motors. By doing this, it allowed to adjust the ballbot to fit different size of balls. However,
the initial design was designed to fit for a volleyball, with a diameter around 21cm. The
ballbot structure was designed, so that the motors will fit exactly with the minimum distances
apart. This has been done to optimize the contact angle and position of the omni-wheels with
the ball.

Figure 3.16- Orientation and contacts of the ball and the motors

15
Figure 3.17- Different stages of development of the ballbot structure

Figure 3.18- Final structure of the ballbot with all components installed

16
3.4 Circuit design construction

The following is the schematic of the basic circuitry that has been used in the ballbot project.
The IMU unit is communicating with the Arduino via I2C protocol. Furthermore, IMU
require 3.3V from the arduino (5V will damage the IMU). The data from the IMU is
processed from the processor and necessary output data including motor speed and direction
are send to the motor drivers. Then the motor driver will make the motor rotate accordingly
in order to balance the ballbot.

Figure 3.19- Schematic of the circuitry

Figure 3.20- Actual image of the circuitry

17
3.5 Reading IMU data

GY-85 IMU consist of an accelerometer (ADXL345) and a gyroscope (ITG3205). The


accelerometer gives the acceleration acting on each axes. When its still it returns the
gravitational acceleration acting on each axis. With these data the angle of tilt can be
calculated. These data are accessible via I2C communication. For the ADXL345 the
maximum bandwidth for the X and Y output pins will be around 1650 Hz and 550 Hz for
the Z pin. Though this is the maximum resolution, it is possible to set lower resolutions if
wanted just by updating some registers. The following figure shows the sensitivity of the
data with the supply voltage of 3.3V.

Figure 3.21- X, Y and Z axis zero g offset at 25oC, Vs = 3.3V

The accelerometer data will be accurate most of the time when the platform is in still
position. However, the accuracy decreases with the presence of vibrations or movements.
For this project, accelerometer along will not fulfill the requirements. In other had the
gyroscope will provide the angular velocity or the rate of change of the angle. These data
also can be used to calculate to tilt angle of the ballbot. When the ballbot is not moving these
values will be zero, but when moving it will give accurate data with a higher accuracy than
the accelerometer.

Furthermore, to increase the accuracy, a filter can be introduced. This will consider both
accelerometer data and gyroscope data and will give tilt angles with a higher accuracy than
the two acting along. There are few filters that we can use for this purpose. Following are
the ones that were used in this project, and more details can be found as the results section.

1. Complementary filter
2. Kalman filter

18
Complementary filter is a very simple and light filter which gives the output with a decent
accuracy. Most of the times this will be enough for most of the applications where inertial
measurements are needed. The principal behind it is simple.

Figure 3.22- Complementary filter


(Source: http://www.instructables.com/)

The following equation can be derived using the above method. And can use it in the
program as it is with minor modifications.

The Kalman filter also known as linear quadratic estimation (LQE), is more advanced and
hard to interpret in the arduino code. However, luckily there are open source libraries which
will provide the calculation for the angles using kalman filter. The following figure shows
some basics about the filter.

Figure 3.23- Concept of Kalman filter


(Source: http://en.wikipedia.org/wiki/Kalman_filter)

19
3.6 Control algorithm

For this project a PID control system has been used. Though there are many other complex
and more reliable controllers available, for better performance, with the scale of this project
and the scope, PID control system was satisfactory. The key points which will affect the
output is the accuracy of the IMU data. In this project both mentioned filters have tested with
the PID loop and have obtained results. The P value will determine how aggressive the output
will be with the error, while I will adjust the output accordingly to the past events and D will
predict future events. In most of the control applications, PI controllers are widely used. It
keep the loop simple and effective. With the addition of the D term, the system could become
bit unstable. Most of the times the reason is the noise in the system. This make the system
unstable. In the ballbot project, the stability is gained via rapid oscillations. So there exist
noise in the system. While considering this situation, it is recommended to use a lower value
or just ignore the D term. The following is a diagram which explains the functionality of the
PID loop.

Figure 3.24- PID loop for the Ballbot

For the ballbot project PID output will be the motor control signal. Since the ballbot has to
balance through both X and Y axis, it needs two PID loops. With the IMU on the ballbot, it
will send the position data to the controller. Then the controller will compare it with the
balanced state. Which is both X and Y tilt angles are zero position. Then this error will be
treated with the P, I and D functions. Then the required output for balancing the ballbot will
be provided to the motor controller. These are the basic steps which will be carried out in
order to balance the ballbot.

20
CHAPTER 4

RESULTS AND DISCUSSION

4.1 IMU testing

Before installing the IMU unit in on the ballbot it was tested using an open source software
written using processing tool (FreeIMU). The test arduino code will send the position
data to the software and it will depict the orientation of the IMU with a rectangular disk. The
results are shown below. The test code for the arduino uses a library that will use filter and
PI loop to give accurate data. These data obtained by this is much more accurate than just
using the kalman filter. This library will produce the position data with quaternion and then
will convert them into Euler angles. Which gives the pitch, roll and yaw. Because the use
quaternion these functions are able to get yaw with using only the gyro and the
accelerometer.

Figure 4.1- Simulated orientation of the IMU

21
The following graphs will show the accuracy of the data. These data was obtain with the
sensor mounted on the ballbot and while trying to balance it. Though the ballbot was at the
balanced position it produces some oscillations which caused the data offsets. However,
since the ballbot is gaining its balanced state, the values of X and Y angles only fluctuate
with a range of 4 degrees. There are some areas in the graph which has larger errors. These
are caused by the ballbot hitting objects and losing its balance.

Figure 4.2- X and Y data obtain for FreeIMU

22
Figure 4.3- X and Y data obtain for FreeIMU

The following figures shows the data obtained for the Kalman filter only. As it shows the
accuracy of the data is very poor. The reason for this can be the noise coming from the IMU.
Since it has no filter or control loop the values keep fluctuating. These data was recorded
while giving external support for the ballbot to keep its balance. However the ballbot was
oscillating at a high frequency due to incorrectness of the IMU data.

23
Figure 4.4- X and Y data obtain for Kalman filter

4.2 Ballbot testing

In the figure 4.2 the changes in the P, I and D values have made some progress on the
oscillations. However, it is very difficult to completely remove the oscillations from the
balancing ballbot. Here only P and I values have changed. The increase of the D value will
result unwanted and rapid oscillations which will off balance the ballbot. In order to keep
the balance D has to be neglected. At this moment the system is acting as a PI system rather
than a PID system. Tuning the PID values is a difficult task when you have to edit the code
every time. As a solution for this three potentiometers have been used. The analog values of
them are then mapped accordingly to give required PID values to the ballbot.

24
Figure 4.4- Potentiometers for change P, I and D values

For this project different open source libraries was tried. One is the PID library which comes
with the adaptive PID capabilities. And the others are libraries for the Kalman filter and
FreeIMU library. And also traditional PID loops and traditional methods of reading the
sensor data was tested for the project. Different configurations have different effects on the
ballbot. The adaptive PID technique was not that successful, because the system will decide
its own PID values with our given PID values. In this case small vibrations builds up and the
ballbot will lose its balance. As experienced conventional method of defining the PID loop
works better. When it comes to reading data form the IMU the conventional method failed
for some reason. It could be the noise that comes with the IMU unit. As a solution the
FreeIMU library had much help to the system. It will take the initial position as the reference
position and will give tilt angles from there. And any noise was not present with this filter.
But at sometimes the output values drifts. The reason for this can be the method it uses to
generate the data. It gets the Euler angles from the quaternions. Since the gyro and
accelerometer only cannot give exact values for the yaw, this could be interfering the actual
position data of x axis and y axis.

With the combination of the FreeIMU and conventional PID loop, the ballbot could balance
on itself. However, for large amounts of deviations the system tend to lose the stability. This
has be due to few reasons. The IMU nose can be effecting for this results. The IMU initialized
itself at the startup, so before initializing the ballbot, it need to be balanced on the ball or
should be kept on a flat surface. Furthermore, the ball seems to be too heavy for the system.
Since the ballbot structure is not much heavy the inertia of the ball makes the motors to react
slowly. This causes the omni-wheels to slip, in some occasions. Designing the ballbot to
balance on a small ball or upgrading motors could have some positive effect on the
performance.

25
CHAPTER 5
CONCLUSION AND RECOMMENDATIONS

5.1 Conclusion

The development and control of a ballbot was a challenge completed for the final year
capstone project. Though the objectives of the project was achieved, there are lot to done to
improve the system. The lack of time and the amount of knowledge needed, did pause
implementing those modifications. However, from this project many theories that were
learnt were tested. The knowledge gathered throughout all the four year has certainly helped
to complete this project.

After going through all the literature, basic concepts needed for the project was accrued.
Knowing the obstacles coming ahead, steps were taken to overcome them. At the process of
making the hardware section, it is not the first attempt that was successful. Before getting to
the final stage, the mechanical structure had to go through many modifications and
replacements. However, at the end valuable set of skills were accrued by doing all of that.
And for sure they will be much useful in the future as an engineer.

The hardest part is to make the ballbot balance. For that many theories and techniques had
to be used in terms of software. When one methods doesnt work, have to find other solution.
Browsing through the web, looking for examples and implementing them gave a great insight
of all the components and their functionality. All these hard work and researches gave the
strength and courage for the future project as an engineer.

26
5.2 Recommendations

Better control algorithms can be implemented for smoother actions.


Different IMU units can be tested for better results.
Different motors can be tested for faster reactions and greater torques.
As for the next step, ballbot can be programmed to move and manure through
obstacles.
The structure of the ballbot can be made large, to increase its functionality as robot
which can be suited for human environments.

27
REFERENCES

Lauwers T.B., Kantor G. A., and Hollis R. L. (May 2006). A dynamically stable single
wheeled mobile robot with inverse mouse ball drive

Masaaki K. and Takaya O. (September 2009). Development of a Robot Balanced on a Ball

Lauwers T., Kantor G. and Hollis R. (October 2005).

Nagarajan U., Kantor G. and Hollis R. (2013). The Ballbot: An Omnidirectional


Balancing Mobile Robot

Hertig L., Schindler D., Bloesch M., Remy C.D., and Siegwart R. (May 2013). Unified state
Estimation for a Ballbot

Miranda J. L. C. (August 2009) Application of Kalman Filtering and PID Control for direct
Inverted Pendulum Control

Vamfun. (2007, August 20). Modeling a Two Wheeled Inverted Pendulum Robot.

Watzman, A. (2006, August 9). Carnegie Mellon Researchers Develop New Type of
Mobile

Lauwers, T. B., Kantor, G. A., & Hollis, R. L. (2006). A Dynamically Stable Single-
Wheeled. Proc. IEEE Intl. Conf. on Robotics and Automation.

Masaaki (2008) Kumagai BallIP.

Battlestar Galactica (2009). Comic Con Exclusives.

Anderson, D. P. (2002, December 12). nBot Balancing Robot. Retrieved

EPFL. (2000, January 25). EPFL - Joe the pendulum.

Hollis, R. (2011, January 4). Microdynamic Systems Laboratory.

Justin Fong, S. U. (2009, May 22). TGU Drive. Adelaide.

Steve. (2004, April 6). Steve's LegWay.

28
APPENDIX

Arduino code

#include <FreeSixIMU.h>
#include <FIMU_ADXL345.h>
#include <FIMU_ITG3200.h>

#include <Wire.h>

float angles[3];

double xAngle;
double yAngle;

int gainA,gainB,gainC,gainD,gain1 ,gain2 ;

FreeSixIMU sixDOF = FreeSixIMU();

int K = 1;
int Kp = 0;
int Ki = 0;
int Kd = 0;
int mmIE=80;
int mmDE=0;
int break_x,break_y;
double Lst_error_x = 0;
double int_error_x = 0;
double pTerm_x = 0, iTerm_x = 0, dTerm_x = 0;
double Lst_error_y = 0;
double int_error_y = 0;
double pTerm_y = 0, iTerm_y= 0, dTerm_y = 0;

void setup()
{
Serial.begin(9600);
Wire.begin();

delay(5);
sixDOF.init(); //begin the IMU
delay(5);

//Motor A&C
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);

//Motor B&D
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);

29
pinMode(30, OUTPUT);
pinMode(32, OUTPUT);
pinMode(34, OUTPUT);
pinMode(36, OUTPUT);

pinMode(40, OUTPUT);
pinMode(42, OUTPUT);
pinMode(44, OUTPUT);
pinMode(46, OUTPUT);

void loop()
{
sixDOF.getEuler(angles);

yAngle = angles[2];
xAngle = -angles[1];

Kp = analogRead(A0);
Kd = analogRead(A1);
Ki = analogRead(A2);

Kp = map(Kp,0,1023,0,1000);
Kd = map(Kd,0,1023,0,1000);
Ki = map(Ki,0,1023,0,100);

motorsRun();
output();

double updateGainX(double targetPosition, double


currentPosition)
{
float error = targetPosition - currentPosition;

pTerm_x = Kp * error;
int_error_x += error;
iTerm_x = Ki * constrain(integrated_error_x, -mmIE, mmIE);
dTerm_x = Kd * (error - Lst_error_x);
Lst_error_x = error;

return constrain(K*(pTerm_x + iTerm_x + dTerm_x), -255,


255);
}

int updateGainY(int targetPosition, int currentPosition)


{
float error = targetPosition - currentPosition;

30
pTerm_y = Kp * error;
int_error_y += error;
iTerm_y = Ki * constrain(integrated_error_y, -mmIE, mmIE);
dTerm_y = Kd * (error - last_error_y);
Lst_error_y = error;
return constrain(K*(pTerm_y + iTerm_y + dTerm_y), -255,
255);
}

float xtravel,ytravel;
float Krome = .0006;

void motorsRun()
{
gain1 = updateGainX(0,xAngle);
gain2 = updateGainY(0,yAngle);

if (gain1> 0)//for y+
{
gainA = abs(gain1);
digitalWrite(30,HIGH);
digitalWrite(32,LOW);

gainC = abs(gain1);
digitalWrite(34,LOW);
digitalWrite(36,HIGH);
}
else// for y-
{
gainA = abs(gain1);
digitalWrite(30,LOW);
digitalWrite(32,HIGH);

gainC = abs(gain1);
digitalWrite(34,HIGH);
digitalWrite(36,LOW);
}
if (gain2 > 0)//for x+
{
gainB = abs(gain2);
digitalWrite(40,HIGH);
digitalWrite(42,LOW);

gainD = abs(gain2);
digitalWrite(44,LOW);
digitalWrite(46,HIGH);
}
else//for x-
{
gainB = abs(gain2);
digitalWrite(40,LOW);

31
digitalWrite(42,HIGH);

gainD = abs(gain2);
digitalWrite(44,HIGH);
digitalWrite(46,LOW);
}

analogWrite(2, gainA);
analogWrite(3, gainB);
analogWrite(4, gainC);
analogWrite(5, gainD);

void output ()
{
Serial.print(xAngle);
Serial.print('\t');
Serial.print(gain1);
Serial.print('\t');
Serial.print(yAngle);
Serial.print('\t');
Serial.print(gain2);

Serial.print("|");
Serial.print('\t');
Serial.print('\t');
Serial.print(Kp);
Serial.print('\t');
Serial.print(Kd);
Serial.print('\t');
Serial.print(Ki);
Serial.print('\t');
Serial.print("\n");
}

32

You might also like