OVERVIEW
The need for the two wheels self balancing
Mobile robots typically feature a three-wheeled design, consisting of two co-axial wheels and a small tail While various types of mobile robots exist, this three-wheeled configuration is the most prevalent In contrast, four-wheeled vehicles often include two-wheel-drive systems, with one or two wheels equipped with steering capabilities.
The stability of a mobile robot or vehicle is significantly influenced by its three or four-wheel design, which relies on weight distribution across two main wheels and a tail If the weight is concentrated on the rear, it risks losing traction, while excessive weight on the front can lead to tipping Although many robots are effective on flat surfaces, they struggle on inclined terrains, as the rear weight can cause the wheels to lose grip when ascending slopes, making movement challenging.
Descending slopes can pose significant challenges for vehicles and robots, often leading to overturning when navigating stairs Many of these machines struggle to ascend inclines, with a tipping risk at angles as low as 15 to 20 degrees While four-wheel designs, similar to toy cars and four-wheelers, operate effectively on flat surfaces, they introduce complexities in mobile robot design, particularly in steering and accurately measuring distance traveled.
Figure 1 Tricycle status when traveling on flat, steep terrain [18]
In contrast, coaxial vehicles have a very flexible balance when traveling on complex terrain, although it is itself an unstable system As it climbs the slopes, it automatically
17 tilts forward and keeps the weight on two wheels It’s the same when it goes down the slopes
Figure 2 Coaxial two-wheel vehicle status when traveling on flat, steep terrain [18]
Designing a new transport vehicle for narrow spaces can facilitate movement within high-rise apartment buildings, providing essential assistance for the elderly and safe transportation for children This vehicle can efficiently deliver goods to pre-programmed locations within tight spaces and challenging environments By integrating humanoid robots with camera tracking systems and road surface robots, the application becomes highly adaptable However, it's important to note that these vehicles currently cannot navigate stairs.
The future of urban transportation introduces a lightweight, easily transportable solution that minimizes street usage This innovative mode of transport is designed for all ages, including children, and operates on clean fuel Its removable features enhance convenience, making it suitable for various complexes and improving overall mobility in the city.
In today's congested traffic and polluted environment, there is a pressing demand for lightweight and manageable electric vehicles Additionally, the development of mobile robots has become essential to assist children, the elderly, and transport supervisors in their daily activities, enhancing transportation and travel experiences.
The self-balancing robot model represents a significant advancement in the fields of science and technology, serving as a crucial foundation for the development of humanoid robots This innovation is sought after by universities globally, as it enhances the capabilities of various mobility solutions, including three-wheeled and four-wheeled robots, as well as legged mobile robots By diversifying the options available for robotic movement, this model enriches the landscape of robotic mobility solutions.
The self-balancing two-wheeler model raises intriguing questions about human psychology for users and observers alike This innovative design caters to the growing demand for self-balancing vehicles, highlighting its appeal and functionality.
For the objective reasons as mentioned, the topic may have a certain need in the current situation of Vietnam as well as the world.
Some self-balancing robots
1.2.1 nBot [18] nBot created by David P Anderson nBot gets the idea to balance as follows: the wheels will have to drive in the direction that the upper part of the robot is about to fall If the wheel can be driven in a way that stands firmly in the center of the robot, the robot will remain balanced In practice, this requires two feedback sensors: the tilt sensor to measure the robot's inclination with gravity, and the encoder on the wheel to measure the robot's basic position
1.2.2 TOYOTA's rolling man-powered robot
Toyota has developed a versatile human-assist robot that stands 100cm tall and weighs 35kg This compact robot is designed for efficient movement and can perform a wide range of tasks, primarily serving as an industrial assistant.
Figure 4 The robot, Rolling type of TOYOTA
Balance-bot I, developed by Sanghyuk from Korea, is a 50cm tall self-balancing robot that utilizes feedback control Its main frame is constructed from aluminum and features two shafts connected to a gearbox and a DC motor for propulsion The robot operates with three Atmel processors: the master controller implements control principles and estimation algorithms, while a secondary microcontroller manages all analog sensors, and the third microcontroller oversees the DC motor.
The Linear Quadratic Regulator (LQR) is a control circuit designed to optimize performance by managing four key parameters: angle of inclination, angular velocity, wheel rotation angle, and rotational speed These values are utilized to command a DC motor, enabling precise adjustments to the wheel's speed for improved control and stability.
The Industrial Electronic Laboratory at the Federal Institute of Technology in Lausanne, Switzerland, has pioneered the development of an innovative two-wheeled vehicle named JOE Standing at 65 cm tall and weighing 12 kg, JOE achieves a maximum speed of approximately 1.5 m/s and can navigate slopes of up to 30 degrees It is powered by a 32V battery with a capacity of 1.8Ah, marking a significant advancement in personal transportation technology.
The device features a U-shaped design with two axle wheels, each powered by a DC motor, enabling rotation It employs a control system utilizing two separate state-space controls to maintain balance through motor regulation The state of the JOE is monitored by two optical encoders and a gyroscope for speed measurement Control is facilitated via a standard R/C remote controller typically used for model aircraft The central control and signal processing is managed by a digital signal processing board (DSP), developed in collaboration with the Federal Institute, which supports floating-point processing (SHARC), XILINX FPGA, a 12-bit A/D converter, and four 10-bit D/A converters.
In 2003, Carnegie Mellon University students Jack Wu and Jim Bai, under the guidance of GS Chris Atkeson, developed a two-dimensional robot capable of determining its orientation within its environment This robot utilized the built-in Rotofotion's 2DOF corner system, which includes an ADXL202 and gyro circuit for angle measurement The control circuit is managed by a BasicX 24 controller, which connects to a Pocket PC via COM1 and to a Mini SSC 12 servo controller via COM3, functioning as the main CPU for the robot's operations.
Equibot is a balanced robot made by Dan Piponi It basically relies on the ATMega32 RISC microcontroller
The standard Hitec HS-311 servo motors have been modified for 360° rotation, with power directly connected for PWM control One servo is linked to the complex quadrature controller LQR, while the other mimics its speed Equibot utilizes a single Sharp infrared sensor, positioned low to measure the distance to the floor, and the sensor's output helps determine the robot's movement direction.
The Bender Equilibrium project, spearheaded by Ted Larson in San Francisco, aims to develop a self-leveling robot designed for floor use This foundational platform will eventually lead to the creation of a self-propelled robot that operates on wheels.
FUNDAMENTALS
Dynamic calculation method
The balance and stability of three- or four-wheeled vehicles rely on their center of gravity, which is positioned on the surface created by the wheels In contrast, two-wheeled vehicles, such as bicycles, cannot maintain balance when stationary; their stability depends on the gyroscopic effect generated by their motion For two-wheeled vehicles with identical axles, achieving balance requires that the center of gravity, including the weight of the rider, remains directly between the wheels, similar to balancing a vertical object in the palm of your hand.
The exact location of the center remains uncertain, and it may be challenging to adjust the wheel quickly enough to maintain focus Therefore, the most effective approach is to ensure that the two wheels are always self-balancing and aligned squarely with the floor.
To begin analyzing motion, various methods can be employed, including the Newton method, Lagrange method, and energy method This article focuses on the Newton method due to its advantages, such as its reliance on traditional mechanical calculations, making it a practical choice for understanding dynamics.
The calculation process involves 26 formulas and systems that are relatively straightforward The dynamic results of the pendulum model are frequently referenced in materials for testing errors in the dynamic computations of two-wheeled balancing vehicles While this model offers several advantages, it does require linearization at the angle α = 0 However, this limitation is not significant for the subject model, as it operates primarily within a narrow range around 0 (± 1 rad).
Inverted pendulum
We consider the inverted pendulum's mathematical model with the following parameters:
- I Inertial moment of the pendulum (Nm)
- θ The angle of the pendulum to the vertical (rad)
Figure 11 Force analysis on the car and on the pendulum
Force analysis on the car and on the pendulum
The research model consists of two parts:
- A pendulum is attached by a hinged joint to the vehicle
The model consists of two inputs:
Model and diagram of the signal input and output of inverted the pendulum Total force in body
N = mẍ + mLθ̈ cos θ − mLθ̇ 2 sin θ (2)
(M + m)ẍ + bẋ + mLθ̈ cos θ − mLθ̇ 2 sin θ = F (3) Total force in
P sin θ +N cos θ +mg sin θ = mLθ̈ + mẍ cos θ (4)
(I + mL 2 )θ̈ − mgL sin θ = −mLẍ cos θ (6)
If we consider b sin θ = θ , cos θ = 1 , sin 2 θ = 0 -Solve the system of equations
Design the PID
Control systems are essential for modifying operational modes to meet specific requirements They enable adjustments to system parameters, ensuring stability and sustainability These design parameters may include unknown constants within the transfer function or state-space representation, allowing for tailored control that aligns with desired performance outcomes.
The PID (Proportional Integral Derivative) controller is a widely utilized feedback control mechanism in industrial control systems Recognized as the most common type of feedback controller, it effectively calculates the necessary adjustments to maintain optimal performance.
"error rate" value as the difference between the measured value and the desired value The controller will minimize the error rate by adjusting the input control value
The PID controller algorithm, often referred to as three-point control, comprises three distinct parameters: proportional (P), integral (I), and derivative (D) The proportional value influences the current error, the integral value addresses the cumulative past errors, and the derivative value assesses the rate of change of the error.
The algorithm is described by the following equation:
𝑑𝑡𝑒(𝑡) Where, u(t) is the output of the controller, e(t) is the error and 𝐾𝑝, 𝐾𝑖 and 𝐾𝑑 are the tuning parameters
2.4.2 Simulating PID controller systems by Matlab
Integrating the tilt angle control with an emphasis on faster response times and eliminating uncertainty is essential Consequently, the front-positioned controllers will be chosen to optimize the parameters for implementing a multi-loop PID controller.
Signal processing from the sensor
2.5.1 Introduction to the Kalman filter [2]
The primary value output of a two-wheeled scooter is determined by the angle between the vertical steering wheel and the floor in relation to gravity Various sensors, such as encoders, resolvers, and inclinometers, can measure angles; however, this model utilizes only two non-contact sensors: an angle-angle sensor and an accelerometer These sensors are effective for measuring static angles on flat, smooth surfaces, while infrared proximity sensors are also applicable in similar conditions To enhance signal quality and reduce noise from the accelerometer and gyroscope data, filtering techniques such as average filters, complementary frequency filters, and Kalman filters are employed.
This is the result of research 56 years ago, the owner of the algorithm is Rudolf (Rudy)
The filter is extensively utilized in digital computers for control systems, navigation systems, electronic systems, radar, and satellite navigation to effectively filter out noise Its remarkable stability has led to its application in significant projects such as the Apollo program, NASA shuttle missions, Navy submarines, space drones, unmanned aerial vehicles, and cruise missiles, earning it numerous prestigious awards.
2.5.2 The theory of Kalman filter [2]
Once the orientation equation and noise statistical model for each sensor are established, the Kalman filter provides an optimal estimate of accuracy by accounting for errors and noise in the signal, assuming a 'pure' signal with a constant distribution In this system, the filter processes two sensor signals: the inclinometer and the gyro sensor The output from the filter combines these signals, where the gyro's output is influenced by both signals, and the relationship between angular velocity and the derivative of the corner angle is utilized An example of a Kalman filter simulation illustrates this process.
39 Figure 16 Signal acquisition not filtered
Figure 17 Signal passed Kalman filter
Kalman filters are optimal regression algorithms that determine the best outcomes based on specific selection criteria They excel in unifying all available information, estimating the current value of interest while accounting for kinematics and dynamic systems Additionally, Kalman filters effectively manage noise, disturbances, and uncertainties in dynamic modeling, incorporating initial condition data to enhance the accuracy of their estimations.
The Kalman filter solves the general problem:predicted state x n ϵ R n of a discrete process described by linear stochastic difference equation
We have process noise and measurement noise
In practice, the correlation matrix Q and noise interference correlation coefficient R may change with each time step or value, but the assumption is that they are constant
At step k, the a priori estimation represents the predicted value of the posterior state, allowing for the calculation of both priori and posteriori errors.
The correlation of the priori estimation error is:
(51) and the correlation of posteriori estimates is:
The Kalman filter's differential equation aims to establish a posteriori estimation equation based on a priori linear estimation, highlighting the difference between the actual value and the expected value, denoted as H in the formula.
The K matrix, known as the Kalman gain or blending factor, is selected to replicate the covariance matrix of the posterior error, as indicated in Equation (1.6) This optimization is accomplished by substituting Equation (1.7) with the definition provided in Equation (1.6) By differentiating this expression with respect to K and setting the derivative equal to zero, we can determine the optimal value of K.
In addition, the correlation of the priori estimation error is zero, the K gain is lower Special,
The diagram below best describes the algorithm:
Figure 18 Ongoing Discrete Kalman Filter Cycle [4]
Microcontroller
Arduino Uno is a surface mount breadboard embedded version with integrated USB It is a small, complete, and breadboard-friendly board based on ATmega328 (Arduino Nano 3.x)
Voltage on the limit 6-20V DC
Digital I/O pins 14 (6 PWM hard ware pins)
DC Current per I/O Pin 30 mA
The Arduino UNO can be powered via a USB port or an external power supply, with a recommended voltage range of 7-12V DC and a maximum limit of 6-20V For those without a USB power supply, using a 9V battery is often the best alternative However, exceeding the upper voltage limit may result in damage to the Arduino UNO.
- Automatic reset during program download
- Green (TX), red (RX) and orange (L) LED
- Auto sensing/switching power input
- Small mini-B USB for programming and serial monitor
- ICSP header for direct programming and serial monitor
- Standard 0.1” spacing DIP (breadboard friendly)
Accelerometer
MPU- 6050 is the world’s first Motion Tracking devices designed for the low power, low cost, and high-performance requirement of smartphones, tablets, and wearable sensors
Gyroscope measure range ±250, 500, 1000, 2000 degrees/sec
Bluetooth
Bluetooth Protocol Bluetooth Specification v2.0 + EDRo
- Up to +4dBm RF transmit power
- UART interface with programmable baud rate
Dc servo motor GA25
The GA25 servo motor is widely utilized in applications requiring precise control of speed, position, and rotation direction Typically equipped with an encoder, it enables microcontrollers to accurately determine location and velocity, making it an essential component in various automation and robotics systems.
-The supply voltage for the motor operates
-Supply Voltage for Encoder Operation
-Encoder dish 11 pulses, two channels A and B
Motor driver
Figure 26 The DC L298 motor control
The DC L298 motor control circuit effectively manages two DC motors and includes a built-in protection diode along with a 7805 IC that supplies 5 VDC power to additional modules This circuit is user-friendly and cost-effective, making it an ideal choice for various applications.
Hardware
Microcontroller: Receives and analyzes the data from accelerometer
Accelerometer: Collects acceleration data and returns them to Arduino
Bluetooth module: Transfers step count via Bluetooth to Mobile App Unit or triggers the signal to set off
Mobile App Unit: Performs as a visual display for the count
Android Apps: Act as a control panel
3.1.4 Analysis the motor and the sensors
Figure 31 The Actuator Block The Actuator Block has two DC servo motors Module L298N get signal from the controller and produce current signals to drive the motors
The voltage supply for active the DC motors is 3-12 VDC The voltage from L298 is 5V-7V so that easy to control the motors
The MPU6050 is a combined accelerometer and gyroscope that measures acceleration across three dimensions When a device is shaken vigorously, the acceleration values on its axes increase significantly, and conversely, lower values indicate less movement.
Gyroscope rotates between the XYZ axes With the accelerometer are 2 basic tools for sensor action
MPU6050 has communication standards I2C so it needs to connect to I2C / TWI pins
In Arduino UNO, these special pins is A4 (SDA) and A5 (SCL)
Table 5 MPU6050 connect with Aruino UNO
The encoder sends a feedback signal that can be used to determine position, count, speed, or direction A control device can use this information to send a command for a particular function
The GA25 servo motor utilizes an incremental encoder, which generates a pulse for each incremental rotation step While it does not provide absolute position data, this encoder offers high resolution at a reasonable cost A single code track incremental encoder, known as a tachometer encoder, produces a pulse signal with a frequency that reflects the velocity of movement However, to identify direction, a two-channel or quadrature encoder is employed, utilizing two detectors and code tracks to analyze signals from both channel A and B.
Software composition
Figure 34 3-axis acceleration values form MPU6050
To receive data from MPU-6050 via I2C we use Wire.h library
To access the acceleration value, a request must be sent to the MPU, including both the MPU address and the acceleration register address Subsequently, the acceleration value can be read into a defined variable using Wire.read().
3.2.2 Smoothing data using Kalman filter
To ensure accurate step counting, it is essential to smooth the raw data obtained from the accelerometer, as it is often contaminated with excessive noise The analysis indicates that the frequency of this noise significantly exceeds that of the actual step signal.
To use Kalman filter in Arduino we need Kalman.h library After that we set kal Before the accelerometer value
Control
3.3.1 Block diagram of control system
Read raw data from Sensors
Process Data(Scale IMU and Encoder readings)
Loop Time Control Output to motor driver
Carry out motor operation control processing
KalAngle = maxAngle kalAngle> maxAngle kalAngle