Design and Control of Two-Wheeled Self-Balancing Robot Using Arduino
Design and Control of Two-Wheeled Self-Balancing Robot Using Arduino
Design and Control of Two-Wheeled Self-Balancing Robot Using Arduino
net/publication/344586377
CITATIONS READS
3 1,104
2 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Yogesh Rohilla on 18 May 2021.
Abstract—This paper discusses the design, construction, and designed to reach a specific target and to do so; they must
control of a two-wheel study level, small self-balancing robot. maintain a certain angle which is like a self-balancing
Two-wheel robots are compact and require less number of robot [3].
motors and other equipment in comparison to conventional
four-wheel robots. Consequently, they offer a complex control 3. Hoverboard: Hoverboards are almost the same as
system problem of balancing on two-wheel. The system Segway, but they don't have a handle and have small
architecture comprises of Arduino Nano microcontroller board, wheels. They are getting quite popular in recent years [4].
DC stepper motor, gyroscope, and accelerometer sensor. PID
controller controls it through the program written in Arduino
4. Toys: Many semi-autonomous toys are available in the
IDE. A detailed description of constituting materials in making market, which can react to gestures, voice commands,
the robot has been provided. Flow chart and closed loop control remote controller and even smartphone. These have many
diagrams have been given for understanding the controlling of inbuilt playing modes which are safe and exciting to play
the robot. A step-by-step process of connecting the hardware [5].
components has been listed, and finally, hardware assembly is This paper provides the design, construction, and control
shown. of a study-level, two-wheeled, small self-balancing robot.
Keywords—MPU-6050, stepper motor, PID controller,
Many papers have provided the design and procedure to make
Arduino Nano, self-balancing robot the self-balancing robot. Some of them used MATLAB for
simulation [6, 7]; some used fuzzy algorithm for controlling it
I. INTRODUCTION [8, 9]; some used complex mathematical modelling approach
[10]; and some used control system concepts for controlling
In today's world, we get to see Segway or Hoverboard in
the robot [11-13]. Fig. 1 shows the block diagram of the
movies, TV shows, YouTube videos and in similar video
proposed self-balancing robot. Here Arduino Nano
platforms. These devices work on the same principle that of a
microcontroller board with MPU-6050 (gyroscope +
self-balancing robot. A self-balancing robot is a robot,
accelerometer), stepper motors, and proportional-integral-
balances itself on two wheels, by constantly correcting its
derivative (PID) controller has been used to make the self-
position.
balancing robot.
In the '80s, a Japanese Professor, Kazuo Yamafuji, built
The things which make this work unique than the existing
the first model to simulate the behaviour of an inverted
literature are the detailed description of components and step
pendulum [1]. Since then, many different prototypes have
by step explanation of connections. A detailed description of
been built by many researchers. The widespread accessibility
components with the technical specification has been
of economical electronic components has made it a fascinating
provided which help any other interested person in making the
project for makers and students.
robot. Similarly, working and construction are given in a step
A self-balancing robot is an inverted pendulum. In the case by step manner for easy understanding.
of an ordinary pendulum, it just swings around a point (centre)
The paper arrangement is as follows: after the introduction
as it has a centre of gravity (COG) below the centre point
section, the paper provides detailed descriptions of the
which is the centre of the circle. When it comes to a self-
components in section II. Sections III discusses the robot's
balancing robot, it has COG above the centre point, which
makes it unstable. By balancing this unstable inverted
pendulum, a self-balancing robot is made. By minimising the
amplitude of this inverted pendulum, a very stable self-
balancing robot can be made which can stand still.
Inverted pendulum based devices can be used in many
applications, such as automated transportation. Following are
the applications of a self-balancing robot:
1. Segway: Segway is a two-wheeled, personalised and
simple self-balancing robot. It can handle the weight of
single person suitably and used for short distance outdoor
transportation, indoor transportation, in tourism, and
medical purposes [2].
2. Rockets and missiles: Rocket and missiles are also lifted
on the principle of an inverted pendulum. They are Fig. 1. Block diagram of the self-balancing robot.
Authorized licensed use limited to: Middlesex University. Downloaded on October 20,2020 at 08:52:41 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Smart Electronics and Communication (ICOSEC 2020)
IEEE Xplore Part Number: CFP20V90-ART; ISBN: 978-1-7281-5461-9
Authorized licensed use limited to: Middlesex University. Downloaded on October 20,2020 at 08:52:41 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Smart Electronics and Communication (ICOSEC 2020)
IEEE Xplore Part Number: CFP20V90-ART; ISBN: 978-1-7281-5461-9
TABLE IV. TECHNICAL SPECIFICATIONS OF STEPPER MOTOR TABLE V. ROTATION SEQUENCE INPUT IN STEPPER MOTOR
DRIVE
Specifications Value
Step Angle 1.8 deg. (full step) Resolution MS1 MS2 MS3
Full Step 0 0 0
Current 4 A (max)
Half Step 1 0 0
Resistance 2.4 ȳ
Quarter step 0 1 0
Inductance 6.5 mH
Eight step 1 1 0
Holding Torque 4.2 kg-cm
Sixteenth step 1 1 1
Fig. 5. Pin Voltage 2-18 V, 12 V (with driver)
arrangement of MPU-6050.
Authorized licensed use limited to: Middlesex University. Downloaded on October 20,2020 at 08:52:41 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Smart Electronics and Communication (ICOSEC 2020)
IEEE Xplore Part Number: CFP20V90-ART; ISBN: 978-1-7281-5461-9
Microcontroller
Differential
unit (Kd)
Sensor
(gyro + accelerometer)
Authorized licensed use limited to: Middlesex University. Downloaded on October 20,2020 at 08:52:41 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Smart Electronics and Communication (ICOSEC 2020)
IEEE Xplore Part Number: CFP20V90-ART; ISBN: 978-1-7281-5461-9
Stepper motors
HC-05
USB cable
Battery
Authorized licensed use limited to: Middlesex University. Downloaded on October 20,2020 at 08:52:41 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Smart Electronics and Communication (ICOSEC 2020)
IEEE Xplore Part Number: CFP20V90-ART; ISBN: 978-1-7281-5461-9
Step 6. Connect first motor driver ܴܫܦto Arduino ʹܦ, its would make the learning process more exciting and mainly a
ܦܰܩto bus ܦܰܩ, ܵܶ ܲܧto Arduino ͵ܦ, and ܸ to differentiating factor from those custom robots which uses
bus ݁ݒ. four wheels in these tasks.
Step 7. Connect second motor driver ܱܷܶʹܣ, ܱܷܶʹܤ,
REFERENCES
ܱܷܶͳܣ, and ܱܷܶͳ ܤto second stepper motor ܦ, ܤ,
ܥ, and ܣrespectively. Connect its ܴܫܦto Arduino [1] K. Yamafuji and A. Koshiyama, "Postural and Driving Control of a
ܦͶ, its ܦܰܩto bus ܦܰܩ, ܵܶ ܲܧto Arduino ͵ܦ, and Variable-Configuration-Type Parallel Bicycle," J. Robotics
Mechatronics, vol. 3, no. 5, pp. 365-372, 1991.
ܸ to bus ݁ݒ. [2] D. L. Kamen et al., "Personal mobility vehicles and methods," 2001.
Step 8. Connect HC-05 ܦܰܩto bus ܦܰܩ, ܶܺ to Arduino [3] N. J. Mathew, K. K. Rao, and N. Sivakumaran, "Swing up and
Ͳͳܦ, and ܴܺ to Arduino ͳͳܦ. stabilization control of a rotary inverted pendulum," IFAC Proceedings
Step 9. Connect voltage regulator ܸ to Arduino ͷܸ, HC- Volumes, vol. 46, no. 32, pp. 654-659, 2013.
05 ܸܥܥ, and 100 ݊Ͳ݊ܿ ܨ. Connect it's Ͳ to bus [4] A. Mehrvarz, M. J. Khodaei, W. Clark, and N. Jalili, "Modeling and
dynamics analysis of a beam-hoverboard self-transportation system,"
ܦܰܩ. in Dynamic Systems and Control Conference, 2018, vol. 51913, p.
Step 10. Connect 100 ݊ ͳ݊ܿ ܨand ͳͲߤ ݃݁݊ ܨto bus ܦܰܩ. V003T32A008: American Society of Mechanical Engineers.
Step 11. Connect Arduino Nano to the computer using a USB [5] (2020). WowWee®- MiP. Available: https://wowwee.com/mip
cable. [6] W. An and Y. Li, "Simulation and Control of a Two-wheeled Self-
Step 12. Connect battery ݁ݒto bus ݁ݒand battery Ȃ ݁ݒto balancing Robot," in 2013 IEEE International Conference on Robotics
and Biomimetics (ROBIO), 2013, pp. 456-461: IEEE.
bus ܦܰܩ. [7] V. Kongratana, S. Gulphanich, V. Tipsuwanporn, and P. Huantham,
Step 13. Upload code in Arduino Nano using the USB power "Servo state feedback control of the self balancing robot using matlab,"
mini. It will test all the wiring. in 2012 12th International Conference on Control, Automation and
Step 14. Test the MPU-6050, stepper motors, and HC-05. Systems, 2012, pp. 414-417: IEEE.
Send PID values through the mobile application and [8] Q. Yong, L. Yanlong, Z. Xizhe, and L. Ji, "Balance control of two-
wheeled self-balancing mobile robot based on TS fuzzy model," in
test again. Proceedings of 2011 6th International Forum on Strategic Technology,
2011, vol. 1, pp. 406-409: IEEE.
Hardware assembly of all the components is shown in Fig. [9] J. Wu and W. Zhang, "Design of fuzzy logic controller for two-wheeled
12. It contains a two-level partition. The lower one contains self-balancing robot," in Proceedings of 2011 6th international forum
the motor driver, Arduino Nano, and motors attached at the on strategic technology, 2011, vol. 2, pp. 1266-1270: IEEE.
lower side. The top one contains the battery, HC-05 [10] N. Razmjooy and M. Ramezani, "Optimal control of two-wheeled self-
Bluetooth module, and the MPU-6050 gyro sensor. The balancing robot with interval uncertainties using Chebyshev inclusion
method," Majlesi Journal of Electrical Engineering, vol. 12, no. 1, pp.
reason to place the battery at the top of the arrangement is to 13-21, 2018.
keep the center of gravity above the horizon of motors. [11] R. S. Martins and F. Nunes, "Control system for a self-balancing
robot," in 2017 4th Experiment@ International Conference (exp.
The partitions are made out of the laser cut acrylic sheets. at'17), 2017, pp. 297-302: IEEE.
These sheets are held together by the long M5 screws, nuts, [12] S. Yuan, G. Lei, and X. Bin, "Dynamic modeling and sliding mode
and bolts. All the modules are attached using double-sided controller design of a two-wheeled self-balancing robot," in 2016 IEEE
glue tapes. International Conference on Mechatronics and Automation, 2016, pp.
2437-2442: IEEE.
V. RESULT AND CONCLUSION [13] J. Qiu et al., "Two-wheeled self-balancing robot modeling and
nonlinear control," in 2017 14th International Conference on
After some testing and calibrating, the two-wheeled robot Ubiquitous Robots and Ambient Intelligence (URAI), 2017, pp. 734-
balanced itself independently. It required appropriate PID 739: IEEE.
values fed to the microcontroller and accurate measurement [14] (2020). Arduino - Software. Available:
from the gyro sensor. Using a CAD designed, laser-cut and https://www.arduino.cc/en/Main/Software
[15] J. G. Ziegler and N. B. Nichols, "Optimum settings for automatic
3D printed structure, the bot stood straight with good controllers," trans. ASME, vol. 64, no. 11, 1942.
stability. [16] Mahowik. (2020). BalancingWii. Available:
https://github.com/mahowik/BalancingWii
There are many possibilities to extend this work. In place
of a breadboard, a printed PCB can be used, which would
make it look more aesthetic. By adding more sensor and
features, this bot can be used in many places and can be a
great learning tool. For instance, standard line following
robot, obstacle avoiding robot, and maze solving robot can be
made using this self-balancing robot. These applications
Authorized licensed use limited to: Middlesex University. Downloaded on October 20,2020 at 08:52:41 UTC from IEEE Xplore. Restrictions apply.
View publication stats