A Tutorial on Modelling and Control of Two-Wheeled Self-Balancing Robot with Stepper Motor

Fabian Kung


In this paper we describe an approximate mathematical model for a stepper motor based two-wheeled self-balancing (TWSB) robot. We show the usage of this model in computer aided design of a digital controller to balance and to steer the robot. TWSB robots can be implemented using geared DC motors and stepper motors. The latter version is popular in recent years after the appearance of open-hardware design for stepper motor driver module, which was originally created for desktop 3D printers and CNC machines, and the ease with which stepper motors can be controlled with pulsed electrical signals. Even though many individuals had shared the design and computer codes for TWSB robots with stepper motors, to date there is still a lack of mathematical model for such machines being reported, even in academic publications. Almost all reported works on stepper motor based TWSB robots rely on empirical or trial-and-error approach to obtain a suitable feedback controller for balancing the machine. This paper intends to fill the gap, and the model and techniques described will be useful for engineers, researchers, educators and others who are building their own machines.


Digital control; Modelling; Robot; Self-balancing; Scilab; Stepper motor.

Article Metrics

Abstract view : 1551 times
PDF - 563 times

Full Text:



F. Grasser, A. D’Arrigo, S. Colombi and A. C. Rufer, JOE: A mobile, inverted pendulum, IEEE Transactions on Industrial Electronics, 49(1), 107-113, 2002.

R. C. Ooi, Balancing a two-wheeled autonomous robot, Final Year Thesis, University of Western Australia, 2003.

D. P. Anderson, nBot balancing robot, http://www.geology.smu.edu/dpa-www/robo/nbot,_ 2013 (accessed 06.03.2019)

R. Chan, K. A. Stol and R. C. Halkyard, Review of modelling and control of two-wheeled robots, Annual Reviews in Control, 37, 89-103, 2013.

H. A. Kadir, Modelling and control of a balancing robot using digital state space approach, Master Thesis, Universiti Teknologi Malaysia, 2005.

R. L. Glinski, Eddie-Plus self-balancing robot, http://makezine.com/projects/self-balancing-eddie-robot,_2017 (accessed 06.03.2019)

Wowwee Group, MiP robot toy, product description, http://www.wowwee.com/mip,_2014 (accessed 22.05.2019)

JJRobot, The B-Robot Evo self-balancing robot, project webpage, http://www.jjrobots.com/projects-2/b-robot,_2016 (accessed 06.03.2019)

J. Brokking, Your own Arduino balancing robot, personal project webpage, http://www.brokking.net/yabr_main.html,_ 2017 (accessed 30.10.2017)

Pololu Robotics, Balboa robot and accessories, product description, https://www.pololu.com/product/3575,_ 2017 (accessed 30.10.2017)

Microchip Technology, Digital signal controller (DSC) with 70 MIPS core, product description, https://www.microchip.com/wwwproducts/en/dsPIC33EP256MU806,_ 2012 (accessed 06.03.19)

Oriental Motors, Stepper motor – an overview, application note, http://orientalmotor.com/stepper-motors/technology/stepper-motor-overview.html (accessed 06.03.2019).

W. Yeadon and A. Yeadon, Handbook of Small Electric Motors. New York, NY: McGraw-Hill, 2001.

Texas Instruments, 2.5A Bipolar stepper motor driver with on-chip 1/32 micro-stepping indexer, product description, http://www.ti.com/product/DRV8825,_ 2014 (accessed 06.03.2019)

Allegro MicroSystems, DMOS micro stepping driver with overcurrent protection, product description, http://www.allegromicro.com/en/Products/Motor-Driver-And-Interface-ICs (accessed 06.03.2019)

Homepage of Mathworks, www.mathworks.com.

Homepage of Scilab, www.scilab.org.

K. Ogata, Modern Control Engineering. Upper Saddle River, NJ: Prentice-Hall, 2002.

N. Nise, Control Systems Engineering (6th edition). Hoboken, NJ: John Wiley & Sons, 2011.

G. F. Franklin, J. D. Powell and M. Workman, Digital Control of Dynamic Systems. Boston, MA: Addison-Wesley, 1997.


  • There are currently no refbacks.