Arduino Micro Controller and MPU 6050 Gyroscope based Automatic Speed Control System for Electric Bike at Tight Turns

DOI : 10.17577/IJERTV12IS060101

Download Full-Text PDF Cite this Publication

Text Only Version

Arduino Micro Controller and MPU 6050 Gyroscope based Automatic Speed Control System for Electric Bike at Tight Turns

Vandana Sayila 1, Soumya Kundeti 1 , Venkata Srinivasa Rao Nimmagadda 1, Usha Oleti 1 , Mahesh Babu Basam1 , Srinivasa Rao Gampa1

1Department of Electrical and Electronics Engineering, Seshadri Rao Gudlavalleru Engineering College, Gudlavalleru, Andhra Pradesh, India-521356

Abstract This paper presents a design methodology for automatic speed control of electric bikes at tight turning points using an Arduino microcontroller, a MPU 6050 gyroscope, a BLDC motor and an LCD display. The BLDC motor is chosen as an electric bike motor because of its low power requirements compared to traditional DC motors. The speed of the electric bike needs to be controlled automatically at sudden turning points to protect the rider from accidents. The speed control system is designed to utilize the real time data from the MPU 6050 gyroscope, which measures the bike's angle and orientation, and adjust the BLDC motor's speed accordingly. An LCD display is integrated to provide the rider with real-time feedback on the bike's speed and any error messages that may occur. The system is designed to be compact and easy to install on any electric bike, with the Arduino and MPU 6050 mounted on the handlebars and the BLDC motor on the rear wheel. Experimental results demonstrated the system's ability to control the speed of the electric bike accurately under the tight turning points.

Keywords Electric bike, speed control, Arduino, MPU 6050, gyroscope, BLDC motor


    Electric bikes have become increasingly popular due to their environmentally friendly nature and cost-effective operation. The Electric bikes offer many advantages over traditional bikes reducing required riders effort. However, the key safety concerns with electric bikes is to design an efficient speed control system ensuring riders safety. Many researchers have proposed several methods based on their design, features, and performance for electric bike speed control. Matsui and Shigyo [1] proposed a methodology based on voltage deviation between the actual and hypothetical values for the speed control of brushless DC motors using only current sensors and without the need of position and speed sensors. Muetze and Tan [2] analyzed the modeling and design aspects of the electric bicycles considering various technical factors such as road test data, rider weight and different torque speed combinations. Lukic et al. [3] proposed an off grid power system based on solar , wind and propane generator for supplying charging power to solar and battery based auto rickshaws. Mulhall et al. [4] developed a prototype for solar-assisted electric auto rickshaw three-wheeler and provided experimental results for different

    driving conditions. Sarath Mohan et al. [5] developed a methodology for converting a pedal-powered bicycle into an economically viable electric bike that utilizes a D.C. series motor as motor drive and a micro controller to control the speed of the drive. Kandasamy et al. [6] designed a solar tricycle runs with low speed and longer distances for handicapped persons. Ho et al. [7] developed an microcontroller based PI control technique for speed control of a BLDC motor of an electric bicycle. Azad [8] proposed design methodology for a solar-assisted rickshaw van as a complete off-grid solution and also discussed the performance analysis in detail. Ebrahim [9] has designed ant colony optimization based PID controllers for controlling speed and current of a brushless dc motor in a hybrid electric bike. Azarudeen and Mary [10] analyzed and compared the performance of conventional and digital PWM control schemes for a brushless DC Motor and identified that digital PWM is more effective if the impacts of speed and torque ripples are not significant. Kolgaonkar et al. [11] developed an arduino based battery charging control circuit for efficient operation of hybrid electric bicycle. Gromba [12] presented a digital electric torque control algorithm for BLDC motor of a electric bicycle. Metz and Moore [13] designed an arduino- microcontroller based robust PID controller for speed control of electric bicycle. Ganapathy et al. [14] designed an arduino based speed control circuit for controlling the speed of a hybrid electric motor bike. Canto and Bianchi [15] have discussed different types of system , mechanical and electrical design level configurations and capabilities of e- bike system. In [16] an Aurduino and MPU 6050 gyroscope based speed controller is developed for electric vehicles for controlling speed of the motor during normal running conditions. Each of these systems has its own advantages and disadvantages, and the choice of system will depend on the specific requirements and preferences of the rider. Traditional speed control systems for electric bikes based on simple throttle mechanisms, may lead to abrupt changes in speed and problematic in situations such as steep descents and tight corners. Intelligent control mechanisms based on fuzzy logic require complex technology and economically not viable. Hence in the present work an Arduino microcontroller and a gyroscope MPU 6050 based speed control approach at tight turns is proposed for the seed control of electric bikes runs

    with BLDC motors. The proposed system utilizes real-time data from the MPU 6050 gyroscope to adjust the speed of the BLDC motor, providing more precise and efficient speed control. The system is designed to be compact and easy to install on any electric bike, with the Arduino and MPU 6050 mounted on the handlebars and the BLDC motor on the rear wheel.


    A Brushless DC (BLDC) motor is type of synchronous motor and also know as Permanent Magnet Synchronous Motor (PMSM) that uses a permanent magnets on rotor and a stator windings controlled electronically for creating rotating magnetic field. Brushless DC (BLDC) motors are widely used in electric vehicles because of their high performance, durability, high power to weight ratio and mainly less power consumption from batteries. The working principle of the BLDC motor based on the repulsion between the similar magnetic poles and requires interaction between the magnetic poles of the rotor and the stator. When a voltage is applied to the stator windings similar magnetic poles will be created and interacts with the rotor poles causing it to rotate. The magnetic field of the stator windings will be synchronized with the position of the rotor with the help of hall sensors for obtaining the maximum torque and efficiency. The following Fig.1 shows the constructional features of the BLDC motor[17].

    Fig.1 Constructional features of BLDC motor[17].

    Fig.2 Operation of the BLDC motor[17].

    The position of the rotor can be detected using Hall-effect sensors based on the magnetic field the rotor and energies respective stator coils to produce required the torque which causes the rotor to rotate. The speed of a BLDC motor can be controlled by adjusting the amplitude and frequency of the voltage supplied to the stator windings. The operating principle of the BLDC motor is shown in Fig.2 [17]. The power supply is given to the stator coils alternatively based on Hall sensors to generate the rotating magnetic field, which interacts with rotor poles and causes rotation.


    In this work an Aurduino micro controller and MPU 6050 gyroscope based automatic speed control system is proposed for speed control of electric bikes at ight turning points. The MPU 6050 gyroscope is mounted on the throttle of the bike to sense the angle turned of the bike handle bar. Throttle is a device mounted on the handle bar to manage the power output from the bikes motor. The Arduino microcontroller receives the real time angular position of the handle bar from the MPU 6050 gyroscope and adjusts the speed of the BLDC motor of the electric bike through the motor driver circuit. The L298N motor driver circuit is used in the hardware circuit design in this work. The BLDC motor will be mounted on the rear wheel of the electric bike.

    Fig.3. Block diagram of Arduino based speed control system

    The basic block diagram representing the proposed methodology is shown in the above Fig.3. The proposed speed control methodology for BLDC motor based electric bike consists an Ardunio Uno board , MPU 6050 Gyroscope, keypad, LCD display, L298N Motor driver circuit, a BLDC motor , an IR tacho sensor and a regulated power supply.

    1. Arduino Uno board

      Arduino UNO board consists of a single chip ATmega328P micro controller and an integrated development environment to write and upload the computer code to the circuit board.

      The Arduino Uno circuit board has 14 digital input and output pins out of which 6 can be used as PWM outputs and another

      6 as analog inputs. It also consists a 16 MHz ceramic resonator, a power jack and USB connection on the circuit board. The layout diagram of the Arduino Uno circuit board is shown in the following Fig.4 [18].

      Fig.4. Arduino Uno board layout diagram [18].

      The speed control algorithm is developed using Arduino integrated development environment and the computer code is dumped into the single chip micro controller to process the required outputs to the motor driver circuit.

    2. MPU (Memory Protection Unit) 6050 Gyroscope

      The MPU6050 gyroscope module consists of an MPU6050 chip manufactured by TDK InvenSense company, USA. The MPU6050 module will have a total of 8 pins out of which four pins will be used for interfacing with other modules. The module diagram of MPU 6050 is shown in Fig.5[19].

      Fig.5. MPU 6050 Gyroscope Module diagram [19].

      The MPU6050 consists of a 3-axis Accelerometer and 3- axis Gyroscope inside the chip which helps to measure many motion related parameters such as displacement, orientation, velocity, and acceleration of an object or system. The MPU

      6050 Gyroscope works based on the Coriolis force Effect, which states that when an angular momentum is applied to a mass moving in a particular direction with some velocity, a force is generated and causes a perpendicular displacement of the mass. The angular motion will be directly proportional to the perpendicular displacement of the mass. The MPU 6050 Gyroscope contains a set of four mass elements will be kept in an oscillating environment. When an angular motion is applied to the gyroscope the Coriolis effect causes displacement of the masses and the capacitance between the masses will be altered. The change in capacitance between the masses is sensed and is converted into reading.

    3. L298N Motor driver circuit

      A motor driver is an electronic circuit module that is used to control the speed and direction of an electric motor. The motor driver typically consists of a power stage, control circuitry, and interfaces to connect to a microcontroller The power stage circuitry of the motor driver is responsible for supplying the necessary power to the motor and the control circuitry is responsible for interpreting signals from the control system and providing appropriate signals to the power stage to control the motor's speed. The L298N motor driver Module is considered for the present circuit design and it is a high power motor driver module generally used for driving DC motors and also in robotics.

      Fig.6. L298N Motor driver module [20].

      The L298N motor driver module is shown in Fig.6 [20] and it is considered for the present BLDC motor speed control system design. The L298N is a dual H-bridge motor driver module and consists of a 78M05 5V regulator and L298 motor driver IC. It can be used to control the speed and direction of two DC motors simultaneously. A 5V input power supply is given to the module. The average output modified by the PWM signal by the module will be given as output to the Motor. The duty cycle of the PWM signal is modified by the Arduino Microcontroller from minimum to maximum and the average output voltage is given to the BLDC motor to control the speed of the motor as per the requirements.

    4. Brushless DC Motor (Cooling Fan Motor)

      For the present speed control system design for the electric bike a two wire cooling fan motor is considered. The two wire PC fan motor is basically BLDC type motor. The electrical circuit for the operation of BLDC type fan motor is shown in Fig.7 [21].

      Fig.7. Two wire Cooling Fan Motor Circuit [21]

    5. Automatic Speed control algorithm.

    The electric bike speed at tight turns should controlled automatically in the view of riders safety and also to avoid accidents . The MPU 6050 gyroscope mounted on the handle bar of the electric bike continuously monitors the angular position of the bike. If the angular position exceeds a predefined maximum value at turning points it sends signals to Arduino Uno board. The algorithm fed to the Arduino Uno board reduces the duty cycle by controlling the PWM signal input to the BLDC motor. Hence the average voltage supplied to the BLDC motor by the L298N motor driver circuit will be reduced. Since the input voltage to the electric bike BLDC motor reduces, the speed of the motor will be decreased automatically. This process continues until the bike speed reduced to the minimum safety level.

    The flow chart representing the automatic speed control algorithm is shown in Fig.8.

    Fig.8. Flow chart of the speed control algorithm


    In the present work a hard ware prototype model is developed for automatic speed control of electric bike at tight turns using Arduino uno micro controller and MPU 6050 gyroscope. A 12 V BLDC type cooling fan motor is considered as an electric bike motor. The MPU 6050 gyroscope is connected to Arduino uno board. The BLDC Motor is supplied from L298N motor driver circuit. The control logic software is developed using Arduino integrated development environment and the code is uploaded to Arduino Uno board. The power supply is given to BLDC motor through L298N motor driver circuit and the motor runs with maximum speed of 600 rpm when the PWM signal operates with 100 % duty cycle. It is considered that the electric bike tilt angle is zero when the MPU Gyroscope is completely in vertical position and the motor runs with 600 rpm. When the gyroscope sensor is turned through some angle the angular position is sensed by the gyroscope and input is given to Aurduino Uno board. The Arduino micro controller process the control logic and reduces the duty PWM signal duty cycle step by step till it reaches the minimum speed specified at tight turns. In the present case the maximum handle bar tilt angle (max ) at tight turns is considered as 45 degrees and the minimum speed ( max ) is considered fifty percent of the maximum speed i.e. 300 rpm. The hardware prototype developed is shown in the following Fig.9. and from Fig.9 the integration of all the hardware components can be observed.

    Fig.9. Electric bike speed control system Hardware model

    Initially the motor is supplied with full voltage with the help of motor driver circuit and the motor reached maximum speed of 600 rpm with the gyroscope completely in vertical position. Once the motor reached the maximum speed the MPU 6050 Gyroscope is manually tilted 45 degrees towards left side as shown in the Fig.9.

    The motor speed is reduced to nearer to 300 rpm, once Arduino microcontroller processes the inputs from MPU 6050 Gyroscope which is almost close to the minimum value. The reduced speed outcome valuecan be observed by the rider in the LCD display and is shown in Fig.10.

    Fig.10 LCD display of the electric bike speed

    From the Fig.10 the reduced duty cycle value also can be observed. Hence it can be said that the motor speed can be controlled automatically at tight turns with proposed hardware methodology.


In the present work an automatic speed control system is developed for an electric bike to control the speed at tight turns automatically using Arduino Uno micro controller and MPU 6050 gyroscope. The system incorporates an infrared tachometer and a keypad for speed limit setting, providing a closed loop feedback control algorithm for efficient and reliable motor speed control. The system offers precise speed control of the BLDC motor based on the angle of steering measured by the MPU6050 gyroscope sensor, ensuring stable operation during tight turns. In addition to that LCD display and the keypad buttons will allow the rider to easily set and adjust the speed limits. The hardware prototype developed demonstrated the potential of the design methodology for the speed control of the electric vehicles and the safety of the bike riders.


[1]. N. Matsui and M. Shigyo, "Brushless DC motor control without position and speed sensors," IEEE Transactions on Industry Applications, 1992, vol. 28, no. 1, pp. 120-127.

[2]. A. Muetze and Y. C. Tan, "Modeling and Analysis of the Technical Performance of DC-Motor Electric Bicycle Drives Based on Bicycle Road Test Data," 2007 IEEE International Electric Machines & Drives Conference, Antalya, Turkey, 2007, pp. 1574-1581.

[3]. S. Lukic , P. Mulhall and A. Emadi, "Energy autonomous solar battery auto rickshaw," Journal of Asian Electric Vehicles, 2008, 6(2), 1135-1143.

[4]. P. Mulhall, S. M. Lukic, S. G. Wirasingha, Y. -J. Lee and A. Emadi, "Solar-Assisted Electric Auto Rickshaw Three-Wheeler," in IEEE Transactions on Vehicular Technology, 2010,vol. 59, no. 5, pp. 2298-2307.

[5]. S. Mohan, P. R. Jayasree, S. Ravi, R. Prasad and V. Vijayakumar, "Economically viable conversion of a pedal powered bicycle into an electric bike," 2013 International Conference on Electrical

Machines and Systems (ICEMS), Busan, Korea (South), 2013, pp. 450-453.

[6]. K. Ravikumar , R. Sachin, V.Deep, T.Ganesh,"Design of Solar Tricycle for Handicapped Person, IOSR Journal of Mechanical and Civil Engineering (IOSR-JMCE), 2013, vol.5, no. 2 , pp 11- 24.

[7]. T. Y. Ho, W. C. Chen, C. H. Chiang, W. C. Hung and M. S. Chen, "The Design of Motor Drive with Speed Control for an Electric Bicycle," 2014 International Symposium on Computer, Consumer and Control, Taichung, Taiwan, 2014, pp. 864-867.

[8]. A.A.M. Azad, "The Solar Assisted Rickshaw Van: A Complete Off-Grid Solution," IEEE Transportation Electrification newsletter, 2015.

[9]. E.A.Ebrahim, "Ant-colony optimization control of brushless-DC motor driving a hybrid electric-bike and fed from photovoltaic generator," In 2016 IEEE Congress on Evolutionary Computation (CEC) ,2016, pp. 4221-4228.

[10]. A. Azarudeen and D. Mary, "Performance analysis of conventional and digital PWM control scheme for speed control of BLDC motor drives," 2017 International Conference on Advances in Electrical Technology for Green Energy (ICAETGT), Coimbatore, India, 2017, pp. 69-75.

[11]. M. D. Kolgaonkar, S. S. Khanvilkar, M. D. Adarkar, A. S. Joshi,

N. K. Rahate and S. D. Sawant, "Arduino Based Hybrid Power Auto Cycle," 2018 Second International Conference on Electronics, Communication and Aerospace Technology (ICECA), Coimbatore, India, 2018, pp. 1791-1794.

[12]. J. Gromba, "Torque control of BLDC motor for electric bicycle," In 2018 International Symposium on Electrical Machines (SME) , 2018, pp. 1-5.

[13]. T. Metz and J.K.Moore, "Design of an Electric Bicycle Speed Controller," Proceedings on Bicycle and Motor cycle dynamics, Symposium on the Dynamics and Control of Single Track Vehicles, 2019, Padova, Italy.

[14]. S.C. Ganapathy, S. Madhumitha, P. Dhivya and S. Suresh, "Arduino Based Speed Control for Hemo," In 2020 International Conference on Power, Energy, Control and Transmission Systems (ICPECTS), 2020, pp. 1-4.

[15]. C. Conto and N. Bianchi, " E-Bike Motor Drive: A Review of Configurations and Capabilities, ". Energies, 2022, 16(1), 160.

[16]. electric-bike-using-arduino-and-gyroscope-mpu6050/

[17]. motor-construction-working-principle.html.

[18]. board#microcontrollers.

[19]. mpu6050-module-with-arduino.