\documentclass[11pt,twoside]{article}\makeatletter

\IfFileExists{xcolor.sty}%
  {\RequirePackage{xcolor}}%
  {\RequirePackage{color}}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{ifxetex}
\ifxetex
  \usepackage{fontspec}
  \usepackage{xunicode}
  \catcode`⃥=\active \def⃥{\textbackslash}
  \catcode`❴=\active \def❴{\{}
  \catcode`❵=\active \def❵{\}}
  \def\textJapanese{\fontspec{Noto Sans CJK JP}}
  \def\textChinese{\fontspec{Noto Sans CJK SC}}
  \def\textKorean{\fontspec{Noto Sans CJK KR}}
  \setmonofont{DejaVu Sans Mono}
  
\else
  \IfFileExists{utf8x.def}%
   {\usepackage[utf8x]{inputenc}
      \PrerenderUnicode{–}
    }%
   {\usepackage[utf8]{inputenc}}
  \usepackage[english]{babel}
  \usepackage[T1]{fontenc}
  \usepackage{float}
  \usepackage[]{ucs}
  \uc@dclc{8421}{default}{\textbackslash }
  \uc@dclc{10100}{default}{\{}
  \uc@dclc{10101}{default}{\}}
  \uc@dclc{8491}{default}{\AA{}}
  \uc@dclc{8239}{default}{\,}
  \uc@dclc{20154}{default}{ }
  \uc@dclc{10148}{default}{>}
  \def\textschwa{\rotatebox{-90}{e}}
  \def\textJapanese{}
  \def\textChinese{}
  \IfFileExists{tipa.sty}{\usepackage{tipa}}{}
\fi
\def\exampleFont{\ttfamily\small}
\DeclareTextSymbol{\textpi}{OML}{25}
\usepackage{relsize}
\RequirePackage{array}
\def\@testpach{\@chclass
 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
  \ifnum \@lastchclass=7 5 \else
   \ifnum \@lastchclass=8 \tw@ \else
    \ifnum \@lastchclass=9 \thr@@
   \else \z@
   \ifnum \@lastchclass = 10 \else
   \edef\@nextchar{\expandafter\string\@nextchar}%
   \@chnum
   \if \@nextchar c\z@ \else
    \if \@nextchar l\@ne \else
     \if \@nextchar r\tw@ \else
   \z@ \@chclass
   \if\@nextchar |\@ne \else
    \if \@nextchar !6 \else
     \if \@nextchar @7 \else
      \if \@nextchar (8 \else
       \if \@nextchar )9 \else
  10
  \@chnum
  \if \@nextchar m\thr@@\else
   \if \@nextchar p4 \else
    \if \@nextchar b5 \else
   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
   \fi \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi}
\gdef\arraybackslash{\let\\=\@arraycr}
\def\@textsubscript#1{{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\def\abbr{}
\def\corr{}
\def\expan{}
\def\gap{}
\def\orig{}
\def\reg{}
\def\ref{}
\def\sic{}
\def\persName{}\def\name{}
\def\placeName{}
\def\orgName{}
\def\textcal#1{{\fontspec{Lucida Calligraphy}#1}}
\def\textgothic#1{{\fontspec{Lucida Blackletter}#1}}
\def\textlarge#1{{\large #1}}
\def\textoverbar#1{\ensuremath{\overline{#1}}}
\def\textquoted#1{‘#1’}
\def\textsmall#1{{\small #1}}
\def\textsubscript#1{\@textsubscript{\selectfont#1}}
\def\textxi{\ensuremath{\xi}}
\def\titlem{\itshape}
\newenvironment{biblfree}{}{\ifvmode\par\fi }
\newenvironment{bibl}{}{}
\newenvironment{byline}{\vskip6pt\itshape\fontsize{16pt}{18pt}\selectfont}{\par }
\newenvironment{citbibl}{}{\ifvmode\par\fi }
\newenvironment{docAuthor}{\ifvmode\vskip4pt\fontsize{16pt}{18pt}\selectfont\fi\itshape}{\ifvmode\par\fi }
\newenvironment{docDate}{}{\ifvmode\par\fi }
\newenvironment{docImprint}{\vskip 6pt}{\ifvmode\par\fi }
\newenvironment{docTitle}{\vskip6pt\bfseries\fontsize{22pt}{25pt}\selectfont}{\par }
\newenvironment{msHead}{\vskip 6pt}{\par}
\newenvironment{msItem}{\vskip 6pt}{\par}
\newenvironment{rubric}{}{}
\newenvironment{titlePart}{}{\par }

\newcolumntype{L}[1]{){\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{){\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{){\raggedleft\arraybackslash}p{#1}}
\newcolumntype{P}[1]{){\arraybackslash}p{#1}}
\newcolumntype{B}[1]{){\arraybackslash}b{#1}}
\newcolumntype{M}[1]{){\arraybackslash}m{#1}}
\definecolor{label}{gray}{0.75}
\def\unusedattribute#1{\sout{\textcolor{label}{#1}}}
\DeclareRobustCommand*{\xref}{\hyper@normalise\xref@}
\def\xref@#1#2{\hyper@linkurl{#2}{#1}}
\begingroup
\catcode`\_=\active
\gdef_#1{\ensuremath{\sb{\mathrm{#1}}}}
\endgroup
\mathcode`\_=\string"8000
\catcode`\_=12\relax

\usepackage[a4paper,twoside,lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in,marginparwidth=0.75in]{geometry}
\usepackage{framed}

\definecolor{shadecolor}{gray}{0.95}
\usepackage{longtable}
\usepackage[normalem]{ulem}
\usepackage{fancyvrb}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{marginnote}

\renewcommand{\@cite}[1]{#1}


\renewcommand*{\marginfont}{\itshape\footnotesize}

\def\Gin@extensions{.pdf,.png,.jpg,.mps,.tif}

  \pagestyle{fancy}

\usepackage[pdftitle={Control Unit for a Two-Wheel Self-Balancing Robot},
 pdfauthor={}]{hyperref}
\hyperbaseurl{}

	 \paperwidth210mm
	 \paperheight297mm
              
\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{3}
\clubpenalty=8000
\emergencystretch 3em
\hbadness=4000
\hyphenpenalty=400
\pretolerance=750
\tolerance=2000
\vbadness=4000
\widowpenalty=10000

\renewcommand\section{\@startsection {section}{1}{\z@}%
     {-1.75ex \@plus -0.5ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
     {-1.75ex\@plus -0.5ex \@minus- .2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
     {-1.5ex\@plus -0.35ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\large}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
     {-1ex \@plus-0.35ex \@minus -0.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\normalsize}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
     {1.5ex \@plus1ex \@minus .2ex}%
     {-1em}%
     {\reset@font\normalsize\bfseries}}


\def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt}
 \@tempdima 1.5em \begingroup
 \parindent \z@ \rightskip \@pnumwidth 
 \parfillskip -\@pnumwidth 
 \bfseries \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par
 \endgroup}
\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
\@ifundefined{c@section}{\newcounter{section}}{}
\@ifundefined{c@chapter}{\newcounter{chapter}}{}
\newif\if@mainmatter 
\@mainmattertrue
\def\chaptername{Chapter}
\def\frontmatter{%
  \pagenumbering{roman}
  \def\thechapter{\@roman\c@chapter}
  \def\theHchapter{\roman{chapter}}
  \def\thesection{\@roman\c@section}
  \def\theHsection{\roman{section}}
  \def\@chapapp{}%
}
\def\mainmatter{%
  \cleardoublepage
  \def\thechapter{\@arabic\c@chapter}
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \pagenumbering{arabic}
  \setcounter{secnumdepth}{6}
  \def\@chapapp{\chaptername}%
  \def\theHchapter{\arabic{chapter}}
  \def\thesection{\@arabic\c@section}
  \def\theHsection{\arabic{section}}
}
\def\backmatter{%
  \cleardoublepage
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \setcounter{secnumdepth}{2}
  \def\@chapapp{\appendixname}%
  \def\thechapter{\@Alph\c@chapter}
  \def\theHchapter{\Alph{chapter}}
  \appendix
}
\newenvironment{bibitemlist}[1]{%
   \list{\@biblabel{\@arabic\c@enumiv}}%
       {\settowidth\labelwidth{\@biblabel{#1}}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
        \@openbib@code
        \usecounter{enumiv}%
        \let\p@enumiv\@empty
        \renewcommand\theenumiv{\@arabic\c@enumiv}%
	}%
  \sloppy
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000%
  \sfcode`\.\@m}%
  {\def\@noitemerr
    {\@latex@warning{Empty `bibitemlist' environment}}%
    \endlist}

\def\tableofcontents{\section*{\contentsname}\@starttoc{toc}}
\parskip0pt
\parindent1em
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\newenvironment{reflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemsep}{0pt}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\itshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{sansreflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\itemsep}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\upshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{specHead}[2]%
 {\vspace{20pt}\hrule\vspace{10pt}%
  \phantomsection\label{#1}\markright{#2}%

  \pdfbookmark[2]{#2}{#1}%
  \hspace{-0.75in}{\bfseries\fontsize{16pt}{18pt}\selectfont#2}%
  }{}
      \def\TheFullDate{2019-01-15 (revised: 15 January 2019)}
\def\TheID{\makeatother }
\def\TheDate{2019-01-15}
\title{Control Unit for a Two-Wheel Self-Balancing Robot}
\author{}\makeatletter 
\makeatletter
\newcommand*{\cleartoleftpage}{%
  \clearpage
    \if@twoside
    \ifodd\c@page
      \hbox{}\newpage
      \if@twocolumn
        \hbox{}\newpage
      \fi
    \fi
  \fi
}
\makeatother
\makeatletter
\thispagestyle{empty}
\markright{\@title}\markboth{\@title}{\@author}
\renewcommand\small{\@setfontsize\small{9pt}{11pt}\abovedisplayskip 8.5\p@ plus3\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus2\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini
               \topsep 2\p@ plus1\p@ minus1\p@
               \parsep 2\p@ plus\p@ minus\p@
               \itemsep 1pt}
}
\makeatother
\fvset{frame=single,numberblanklines=false,xleftmargin=5mm,xrightmargin=5mm}
\fancyhf{} 
\setlength{\headheight}{14pt}
\fancyhead[LE]{\bfseries\leftmark} 
\fancyhead[RO]{\bfseries\rightmark} 
\fancyfoot[RO]{}
\fancyfoot[CO]{\thepage}
\fancyfoot[LO]{\TheID}
\fancyfoot[LE]{}
\fancyfoot[CE]{\thepage}
\fancyfoot[RE]{\TheID}
\hypersetup{citebordercolor=0.75 0.75 0.75,linkbordercolor=0.75 0.75 0.75,urlbordercolor=0.75 0.75 0.75,bookmarksnumbered=true}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}

\date{}
\usepackage{authblk}

\providecommand{\keywords}[1]
{
\footnotesize
  \textbf{\textit{Index terms---}} #1
}

\usepackage{graphicx,xcolor}
\definecolor{GJBlue}{HTML}{273B81}
\definecolor{GJLightBlue}{HTML}{0A9DD9}
\definecolor{GJMediumGrey}{HTML}{6D6E70}
\definecolor{GJLightGrey}{HTML}{929497} 

\renewenvironment{abstract}{%
   \setlength{\parindent}{0pt}\raggedright
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
   \textcolor{GJBlue}{\large\bfseries\abstractname\space}
}{%   
   \vskip8pt
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
}

\usepackage[absolute,overlay]{textpos}

\makeatother 
      \usepackage{lineno}
      \linenumbers
      
\begin{document}

             \author[1]{D.P.V.J.  Jayakody}

             \author[2]{K.P.G.C.  Sucharitharathna}

\renewcommand\Authands{ and }

\date{\small \em Received: 13 December 2018 Accepted: 5 January 2019 Published: 15 January 2019}

\maketitle


\begin{abstract}
        


A self-balancing personal transporter which is based on the inverted pendulum concept has sufficient potential to provide solutions for the upcoming global issues in the transportation industry. However due to the expensive price range which the self-balancing scooters are introduced at and few safety issues, this concept has failed in reaching the hands and becoming popular among the majority of the society. Therefore this research paper consists of a comprehensive literature review on the existing models of the self-balancing transporter scooters, possible ways to reduce the initial cost of implementing a control unit for self-balancing transporter vehicles and methods to address the issues which generate along with the proposed cost-reduction methods. Real-time comparison of Kalman and Complementary filtering processes are performed to sort out the optimum algorithm to estimate the true angle of the inclination of the self-balancing prototype. Similarly several forms of control system implementation are compared through simulations and real-time experiments to obtain the ideal motor response for variations in the position of the prototype.

\end{abstract}


\keywords{inverted-pendulum, PID control, self-balancing robot, complementary filter, kalman filter, MPU6050.}

\begin{textblock*}{18cm}(1cm,1cm) % {block width} (coords) 
\textcolor{GJBlue}{\LARGE Global Journals \LaTeX\ JournalKaleidoscope\texttrademark}
\end{textblock*}

\begin{textblock*}{18cm}(1.4cm,1.5cm) % {block width} (coords) 
\textcolor{GJBlue}{\footnotesize \\ Artificial Intelligence formulated this projection for compatibility purposes from the original article published at Global Journals. However, this technology is currently in beta. \emph{Therefore, kindly ignore odd layouts, missed formulae, text, tables, or figures.}}
\end{textblock*}


\let\tabcellsep& 	 	 		 \par
Introduction n today's society transportation is undoubtedly a fast-growing industry. Due to the rapid growth in the demand for personal transporter vehicles, self-balancing personal transporter scooters were introduced by the Segway Company. For the intention of increasing the efficiency of humans and to reduce the cost, the self-balancing personal transporter which is also a great representation of the personal mobility device concept is now widely used in many industries and institutions such as police departments, tourism industry, factories, and airports. The benefits which are offered by this personal transporter vehicle such as higher accessibility and zero fuel consumption can be considered as the ultimate solutions for the upcoming global issues caused by the growth of traffic and the environmental pollution happening all around the world. Even though the self-balancing transporter represents a better version of the personal transporter type vehicles that are being used nowadays, it simply failed in reaching the hands of the majority of society due to the expensive price range and the safety issues pointed out by the existing users of these self-balancing transporter models. The self-balancing personal transporter models (mainly Segway models) are comprised of multiple gyroscope and accelerometer sensors (few as additional) to obtain the angular rate and acceleration readings along different axes. \hyperref[b0]{[1]} The drawback which comes along using multiple sensors is the additional cost and the extra computational power required by the control unit. In addition to being expensive, the fact of having none of the common safety system features available in the modern vehicles to increase the passenger's safety can also be considered as a cause of the failure of self-balancing personal transporter concept.\par
The working principle of a self-balancing personal transporter is involved in continuously obtaining the feedback of the tilt (angle of inclination) of the platform, compensating the error with respect to the reference angle and maintaining the entire platform in an upright position. Further the ability of responding to any unexpected external force being applied in order to recover back to the stable position has been included in the control unit of the self-balancing transporter platform as it improves the overall safety assurance of the passenger For the self-balancing transporter prototype presented by this research paper, an IMU unit (MPU6050) which is comprised of built-in accelerometer and a gyroscope is used to measure the acceleration and angular velocity readings along multiple axes and the angle of inclination of the platform can be simply estimated from both of these measurements separately.  {\ref [7]} However a single IMU unit which performs the task of multiple gyroscope and accelerometer sensors typically offer output signals combined with serious noise and therefore these signals are required to pass through a noise filtering process to achieve true angle of inclination estimation values. The main considerable noise components generated by the IMU unit can be listed as the gyroscopic drift and the horizontal acceleration dependency. Therefore a nose filtering process such as Complementary filtering or Kalman filtering can be applied to the IMU unit's output to obtain a better estimation of the angle of inclination of the self-balancing platform. The filtering process to be implemented highly depends on the performance of the microcontroller unit of the self-balancing transporter and it could also end up in indirectly affecting to the total I implementation cost. Finally a control system is required to control the motors of the self-balancing transporter with respect to the estimated angle of inclination and therefore the speed of the motors has to vary in order to maintain the platform in the upright position. A PID system is implemented as the control system of the selfbalancing prototype and further designing phases with circuitry work are carried out to add a more professional touch to the implementation of the control unit of the self-balancing platform. 
\section[{II.}]{II.} 
\section[{Literature Review}]{Literature Review}\par
Comprehensive research was carried out to find out the information about the existing self-balancing transporter products and to reveal out design architectural information in order to implement a lowcost control unit for a self-balancing transporter vehicle. 
\section[{a) Segway Self-Balancing Scooter Models}]{a) Segway Self-Balancing Scooter Models}\par
'Segway' company led by the inventor Dean Kamen was the very first to introduce a two wheeled self-balancing personal transporter type scooter in 2001. Even though the Segway was appeared to be a completely new form of transportation in the early stages, the concept completely failed in building a considerable customer base due to its' extremely high introductory price. Therefore in 2006, the company came up with a couple of new designed two-wheeled self-balancing personal transporters to suit different types of terrains. Segway I2 was introduced as the onroad general purpose personal transporter model while the Segway X2 model was designed with more advanced features for rough terrains and introduced as the off-road model. \hyperref[b1]{[2]} Figure  {\ref 1}: Segway I2 Model \hyperref[b1]{[2]} Figure  {\ref 2}: Segway X2 Model \hyperref[b1]{[2]} Both of these models consist of the working principle which requires the rider to lean forward to travel forward and do the opposite to move backward. Once the rider leans to the forward or reverse directions; the self-balancing scooter will start to move in the desired direction by maintaining the tile angle of the entire platform. The rider on the self-balancing scooter gets the opportunity to tilt the handlebar to drive the scooter in different directions. The tilt of the scooter platform is measured by a sensor unit consists of five gyroscope sensors and two accelerometer sensors. \hyperref[b1]{[2]} Accelerometers and gyroscope sensors work separately to process the multiple accelerations and angular rate readings along multiple axes precisely in an extremely fast rate, the controller units of these personal transporter models are equipped with a highly powerful, expensive unit comprising of ten on-board microprocessors. \hyperref[b1]{[2]} These facts can be considered as the major reasons for the Segway products to be tagged at an expensive price range. (Above \$5000) However, these Segway models do not consist of any passenger safety features such as obstacle detection and braking system methods and as a result in most countries these models are banned from using in the public roads. \hyperref[b3]{[3]}  
\section[{b) Hover Boards}]{b) Hover Boards}\par
Hover boards can also be introduced as a representation of the self-balancing transporter concept. The steering operation is entirely different compared to self-balancing scooter models as the pressure sensor plates are placed on the pedal surface of hover boards to calculate the pressure difference and determine the turning direction. However the similar feature of both of the products can be highlighted as the self-balancing driving method which requires the rider to lean forward or reverse in order to move in the desired direction. The speed control unit of the hover board consists of two separate gyroscope sensors and two tilt sensors to obtain the angular rate and the accelerations along different axes to determine the tilt angle of the platform. (Figure \hyperref[fig_0]{3}) Even though there is a noticeable reduction in the number of accelerometer and gyroscope sensors compared to the control unit of the Segway models, the multiple gyroscope and accelerometer units in a hover board would still demand higher processing power. The angle of inclination of the self-balancing prototype platform was obtained through the accelerometer readings of the IMU unit. Acceleration readings had to be converted into the degrees by considering the inverse tangent angle calculated from the acceleration readings alone y and z-axes. Changes in the angle of inclination concerning time had to be calculated by multiplying the angular velocity reading of the gyroscope of IMU with the time difference.  
\section[{Implementation of the Noise Filtering Algorithms a) Estimation of the true angle of inclination}]{Implementation of the Noise Filtering Algorithms a) Estimation of the true angle of inclination}\par
The position and the stability of a self-balancing robot are simply affected by accelerations acting on it and the changing angular velocity of the robot platform. Therefore it was clear that both angle of inclination values and the angular change derived from accelerometer and gyroscope readings are required for a better estimation of the true angle of inclination of the self-balancing platform. Therefore the 'Sensor fusion' technique which is an input combination of multiple sensor readings to derive a single output was applied for the estimation process. 
\section[{b) Noise observations}]{b) Noise observations}\par
To obtain the true angle of inclination, it is obvious that the noises generated by the IMU unit must be cancelled out from a noise filtering process. Generally, the accelerometer is sensitive to the horizontal (x-axis) accelerations, and therefore it considers a horizontal acceleration as a change in the derived angle which causes huge noise in the derived angle output. On the other hand, the gyroscopic angle is sensitive to gyroscopic drift. Gyroscopic drift can be mainly introduced as the non-zero value that the gyroscope outputs when it is stationary even though it is supposed to output zero. 
\section[{c) Complementary Filter Algorithm Implementation}]{c) Complementary Filter Algorithm Implementation}\par
Complementary filter algorithm which is a combination of high pass, low pass filtering stages and mathematical processes such as integration was selected as the first method to obtain true angle estimation of the platform. The true estimation of a sensor reading using the current and previously obtained sensor measurements can be considered as an intuitive approach for a sensor fusion application. The complementary filtering process inside the self-balancing platform can be represented as, The value for the filter coefficient was selected as 0.0066 to obtain the most suitable filtered angle output from the complementary filtering process from a range of test data values for the specific prototype dimensions. Complementary filtered angle output was compared with the unfiltered angle values derived from IMU readings to ensure the elimination of horizontal acceleration noise and the gyroscope drift noise components respectively in accelerometer angle and gyroscopic angle. As the estimation provided by the complementary filtering process consisted of both the effects of accelerations acting on the prototype's frame and the changes in the angle of inclination (position), it was quite accurately providing the true angle of estimation of the prototype which depends on the entire stability maintaining. 
\section[{d) Kalman Filter Algorithm Implementation}]{d) Kalman Filter Algorithm Implementation}\par
For a self-balancing platform application, Kalman filtering process can be defined as an iterative mathematical process that uses a set of equations made out of multi-dimensional matrices and data inputs to track objects by estimating the true values of velocity and position. Basically, it is focused on minimizing the variation or uncertainty in the continuous estimates with respect to the velocity and position data measurements. A state matrix (multi-dimensional) is formed to store the velocity and position data of the object which is being tracked. Process covariance (error) matrix contains the error in the estimation process. In the above process, U K is used to combine a variable (acceleration) that affects both position and velocity to the predicted state. The intention of adaptation matrices is simply to ensure a common format between matrices. New estimate is processed for each data input by modifying the initial predicted state value with a portion multiplied by the Kalman gain (K) which determines the additional weight of sensor measurement and the predicted state value to be added. Kalman gain (K) can be explained with the sensor noise covariance matrix (R) which represents the measurement errors of relevant parameters of the IMU unit as, K = P Kp. H / (H.P Kp. H T + R)\par
The Kalman filtered angle of inclination was compared with the complementary filtered angle to observe the difference of true angle estimation to sort out the optimum filtering method. From the comparison result (Figure \hyperref[fig_5]{8}), it was clear that the predicted angle by the Kalman filter contains less variation from the true angle and more accurate response towards changes in velocity and position than the Complementary filter. V. 
\section[{Implementation of the Control System a) Structure of the PID Control System}]{Implementation of the Control System a) Structure of the PID Control System}\par
The intention of the PID control system is simply to control the motors of the self-balancing prototype according to rapid changes in the position. The basic algorithm to represent a PID control system can be given as [6],\par
The most important component of a PID control system can be considered as the feedback error value as it's combined with all of the constant values and used to generate the control signal output of the system. In the self-balancing platform, target or the reference angle can be calculated by positioning the robot in the upright position and therefore the feedback error value can be calculated as e(t) = Current (Filtered) Angle-Target (Reference) Angle Year 2019 J Control Unit for a Two-Wheel Self-Balancing Robot As shown in Figure \hyperref[fig_5]{8}, the output signal of the PID control system is simply fed as the motor power to control the motors of the prototype according to the calculated error (difference) between the reference and the current (filtered) angle. Reference angle of the PID system is found out by measuring the angle of inclination of the platform when the robot frame is placed in an upright position. 
\section[{b) PID Simulations}]{b) PID Simulations}\par
Matlab software-based simulations were carried out to find out the optimal values for the control terms (K P , K I and K D ) of a P, PD, and a PID controller. Unit step input (error value) for the simulation was generated by inputting a set of random angle value data. The system performance characteristics such as settling time, overshoot and rising time were observed by plotting the step response of the forms of the PID system with different sets of control term values. Depending on the characteristics of the response curve (Unit step response) of the PID, PD and P control systems, some value sets for the control terms were tested to sort out the best possible value range to shorten the settling time and to reduce oscillations in the control signal.  Step response of the control systems corresponding to optimal constant value sets, a). PID control system (Kp=60, Ki=4, Kd=0.3), b). PD control system (Kp=80, Kd=1.2), c). P control system (Kp=80)  
\section[{c) PID Tuning}]{c) PID Tuning}\par
However throughout practical experiments where manual PID tuning method was used to lock down the optimum control term values, the PID controller's performance with the minimum 'rise time' was not as stable as expected through the above simulation result. On the other hand, the PD controller provided a better stability for the prototype with a minimized steady state error which produced a negligible real-time effect to the overall balancing performance. Even though the performance of both P and PD control systems contain major similarities, the simulation result highlighted the slight increase in the 'rise time' in the P controller compared to the PD controller. As a result, the P controller presented a considerable stable balancing performs with slight oscillations and by assigning a suitable value for the K D , the controller type was converted into a PD system and the overall performance was improved in to a better standard at the end. 
\section[{VI.}]{VI.} 
\section[{CAD Design and Hardware Implementation}]{CAD Design and Hardware Implementation}\par
CAD design of the self-balancing prototype was modeled through the 'Sketchup' software to secure the best possible weight distribution of the frame which directly affects to the balancing performance before the hardware implementation of the prototype.  
\section[{Conclusion and Future Work}]{Conclusion and Future Work}\par
The overall performance of the PD controller was ideal for the prototype to reach stability (upright position) with minimized oscillations and the shortest settling period. Further, the prototype was comfortable in responding rapidly to compensate the angle differences (errors) that occurred by various external forces. The control unit built through this research can be reused with relevant PID tuning parameters for differently scaled prototypes or Segway clones.\par
For similar experiments with self-balancing transporter prototypes, the safety system which was initially implemented through this research can be further improved. The sampling rate used to obtain the IMU readings and for the filtering process was 0.005 milliseconds and it was produced by internal interrupts of the Atmega128 chip. However the requirement of this rapid sampling rate prevented the flexibility of the microcontroller usage to carry out safety system experiments along with the balancing and filtering processes. Therefore as an improvement which is required for further experiments to implement a solid safety system for self-balancing transporter platforms, a separate microprocessor chip can be reserved to avoid conflicts between the priorities of each task. Further to preserve the compatibility of the circuit, both of the chips can be located in the same PCB with proper power distributions.\begin{figure}[htbp]
\noindent\textbf{3}\includegraphics[]{image-2.png}
\caption{\label{fig_0}Figure 3 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{4}\includegraphics[]{image-3.png}
\caption{\label{fig_1}Figure 4 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{5}\includegraphics[]{image-4.png}
\caption{\label{fig_2}Figure 5 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{6}\includegraphics[]{image-5.png}
\caption{\label{fig_3}Figure 6 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{7}\includegraphics[]{image-6.png}
\caption{\label{fig_4}Figure 7 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{8}\includegraphics[]{image-7.png}
\caption{\label{fig_5}Figure 8 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{9}\includegraphics[]{image-8.png}
\caption{\label{fig_6}Figure 9 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{10}\includegraphics[]{image-9.png}
\caption{\label{fig_8}Figure 10 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{11}\includegraphics[]{image-10.png}
\caption{\label{fig_9}Figure 11 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{1} \par 
\begin{longtable}{P{0.175\textwidth}P{0.15833333333333333\textwidth}P{0.23333333333333334\textwidth}P{0.2833333333333333\textwidth}}
Controller Type\tabcellsep Overshoot\tabcellsep Settling Time\tabcellsep Steady state error\\
PID\tabcellsep High\tabcellsep Very High\tabcellsep Very Low\\
PD\tabcellsep Low\tabcellsep Low\tabcellsep High\\
P\tabcellsep Low\tabcellsep Low\tabcellsep High\end{longtable} \par
 
\caption{\label{tab_0}Table 1 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{2} \par 
\begin{longtable}{P{0.25427350427350426\textwidth}P{0.5957264957264957\textwidth}}
Increased Control Variable\tabcellsep Improved Performance\\
K P\tabcellsep Stability, Rise time\\
K D\tabcellsep Overshoot, Settling time\\
K I\tabcellsep Steady state error\end{longtable} \par
 
\caption{\label{tab_1}Table 2 :}\end{figure}
 			\footnote{Control Unit for a Two-Wheel Self-Balancing Robot} 		 		\backmatter  			  				\begin{bibitemlist}{1}
\bibitem[Walter and Higgins ()]{b5}\label{b5} 	 		‘A Comparison of Complementary and Kalman Filtering’.  		 			T Walter 		,  		 			J Higgins 		.  	 	 		\textit{IEEE Transactions on Aerospace and Electronic Systems}  		1975.  (3) .  	 
\bibitem[Fang ()]{b0}\label{b0} 	 		‘A Posture Control System Design for a Two-wheeled and Self-balancing Robot’.  		 			J Fang 		.  	 	 		\textit{Journal of IJ3C}  		2015. 4  (3)  p. .  	 
\bibitem[Available (2018)]{b2}\label{b2} 	 		 \url{http://www.segway.com/}  		\textit{Available},  				Apr-2018. p. 19.  	 
\bibitem[Heong Ang and Chong ()]{b4}\label{b4} 	 		‘PID Control System Analysis, Design, and Technology’.  		 			K Heong Ang 		,  		 			G Chong 		.  	 	 		\textit{IEEE Transactions on Control Systems Technology}  		2005. 13  (4)  p. .  	 
\bibitem[Segway -Simply Moving -Welcome to the Official Website of Segway Europe Segway.com ()]{b1}\label{b1} 	 		‘Segway -Simply Moving -Welcome to the Official Website of Segway Europe’.  	 	 		\textit{Segway.com}  		2018.  	 
\bibitem[Visioli ()]{b6}\label{b6} 	 		‘Tuning of PID controllers’.  		 			A Visioli 		.  		 MPU-6050 | TDK.  		 \url{https://www.invensense.com/products/motiontracking/6-axis/mpu-6050/}  	 	 		\textit{Control Theory and Applications},  				2001. 2018. Jul-2018. 148 p. 11.  	 	 (Invensense.com) 
\bibitem[Golson et al. ()]{b3}\label{b3} 	 		\textit{Well, That Didn't Work: The Segway Is a Technological Marvel. Too Bad It Doesn't Make Any Sense},  		 			J Golson 		,  		 			J Golson 		,  		 			A Powell 		,  		 			W Staff 		,  		 			A Pardes 		.  		2018.  	 
\end{bibitemlist}
 			 		 	 
\end{document}
