Design of Spatial Inverted Pendulum System

Pendulum-based systems which are highly non-linear and unstable have become one of the most widely studied subject of control theory. The close interest of researchers on inverted pendulum problem arises from its strong representation ability with real engineering applications. This study focuses on the design and production of an experimental setup in which a spatial inverted pendulum can be balanced by means of a planar mechanism in RRRRP configuration. A mechanism with two different motion inputs (rotational and linear) that no studies were performed on before was prototyped. This system is highly unstable and shows non-linear dynamic behavior. The mechanical parts that forms the system were manufactured by a 3D printer and a CNC milling machine. At the end of study, a four-degree of freedom spatial inverted pendulum experimental setup has been established on which the control works can be carried out, by installing the electronic and electro-mechanical equipment.


Introduction
Inverted pendulum systems have nonlinear and unstable behavior. Researchers have long been working on this problem because of its high level difficulty. These systems owe their popularity to their basis providing ability for real engineering applications. For instance, in modelling of human posture and gait [1], control of robotic arms used for selection and placement [2], flight control of rocket and missiles [3] and balancing of aircraft in turbulence [4] pendulum dynamics are utilized.
Spatial inverted pendulum (SIP) systems can be classified in three subgroups depending on the mechanism of inverted pendulum stabilization [5]. The work of Soto and Campa [6] can be added to these three as a fourth. The first model is a spatial inverted pendulum which was controlled by a Cartesian mechanism that can be moved linearly in x and y directions [7]. Secondly, it can be mentioned SIPs which were balanced by being placed on a mechanism that can move to more than a direction named omnidirectional inverted pendulums [8].
In the third case, SIP was balanced by using serial robotic manipulator [9]. In the fourth and last case, a SIP was balanced by placing it on a five bar mechanism [6].
In this study, a spatial inverted pendulum and a twodegree freedom mechanism which is going to be used as balancer was designed and produced. The RRRRP (P: Prismatic joint, R: Revolute joint) configured mechanism, (No previous work has been done.) has two motion inputs: linear and rotary. This mechanism was approved due to obtain high acceleration where the SIP is mounted on. With using a linear motion input, it is aimed to give a character to the system which can produce fast responses.
In this paper a mechanical design study was carried out to produce balancing forces. The study was completed in two stages which are mechatronic design and production. At design stage the link lengths of mechanism were determined with an optimization study. By using genetic algorithm (GA), the planar working space of the balancing mechanism was maximized. Also the electronic and electromechanical equipment such as the encoder, motor, motor driver, data acquisition card and power supplies used in the system have been determined by the studies which was carried out in this stage. At the end of the study, all mechanical parts were produced and all mechanical and electronic equipment were assembled. Finally, the experimental setup was revealed as ready to control.

Materials & method
In this section, the theoretical design, manufacturing process of the mechanical parts and the electronic hardware which are used in the system will be emphasized.

Design of SIP System
The inverted pendulums come to a state of instability by deviating from the equilibrium position as they are subject to disturbing effects. These effects can be caused by the environment or the system itself. For this reason, dynamic balancing forces which has variable direction and magnitude should be produced in order to keep the system in balance or to rebalance the system. These forces balance the inverted pendulum by repositioning the point which is connection of the inverted pendulum and mechanism (Oj). In this study, the positioning process was carried out with a two degree of freedom planar mechanism ( Figure 1). To obtain balancing forces properly, the point Oj should move in an area as wide as possible. Also the actuators should be capable of having continuous motion within this zone. Due to this reason it is very important to design a system which has the widest and the most dexterous planar working space.

Optimization of mechanism workspace
As mentioned before the point (Oj) should have free motion ability so that the SIP can be properly balanced. To obtain high mobility there has to be minimum number of singular positions as possible. Regarding this size of working space and joint space of the mechanism are directly related to the link lengths of mechanism which forms the system. To maximize them both the optimum link lengths should be determined. In this study genetic algorithm was used for to obtain maximum mobility in the maximum working space.
The optimization work was first started with the representation of four link lengths. L 1 , L 2 , L 3 and L 4 , were represented by a 1x32 size population of 8-bit (binary code) chromosomes The results were sought among certain limit values.
As required by the nature of the genetic algorithm, in order to reach optimum results, a fitness function which excludes the singular values of Oj in a defined diameter was defined. In this way, the best solutions were selected at the end of each generation and optimization cycle, elite populations with the highest fitness function value have been reached. For 325mm≤s 5 ≤325mm values of prismatic input, L 1 =300mm, L 2 =100mm, L 3 =350mm, L 4 =200mm values were obtained at the end of the optimization.

Mechanical equipment
The spatial inverted pendulum system, whose CAD model is given below, consists of a linear motion module, three straight links, a universal joint and an inverted pendulum. Before manufacturing, solid models of the mechanical links which form the system was created (Figure 2). The mechanical parts manufactured in this study are given in detail.

Linear motion module
As seen in Figure 3 a linear motion module was used for creating linear motion. Thanks to this device, the rotational motion taken from the actuator are converted to linear motion and s 5 input variable ( Figure 1) is produced. It is composed of belts and rollers that make the motion transform. Since the module is required to be compact and light, belt and roller type which is more suitable than railed systems was preferred.

Mechanism links
The links forming the mechanism generally consist of bearings, aluminum plates, bolts, nuts and bearing holders that are produced by 3D printer. As previously mentioned, the rotary motion input is made from the link-2 ( Figure 4). In order to connect it to the DC motor shaft, a shaft assembly hub made of aluminum material with a 6 mm hole was fixed on. The link-2 is 5 mm thick and 30 mm wide and made of aluminum plate with CNC milling. In addition, MR626 bearing was fixed to it with the help of a bearing holder which was manufactured by 3D printer again. The distance between the hub and the bearing rotation axes is 100 mm, which is the optimum length of the link 2. As seen in the Figure 5, the link-3 acts as a base which the SIP connection made on. Unlike link-2, there are two MR628 bearings and two bearing retainers to make the connection of link-2 and link-4 to it. The distance between the axes of rotation of the two bearings is 350 mm, which is optimum dimension of the link-3. Similar with link-3 2 MR628 bearings were used to connect link-4 ( Figure 6) to the linear motion module and to the link-3. In this way a free rotation between the three links is obtained. One of the bearing was attached symmetrically to other to prevent possible collidings. The distance between the axes of rotation of link-4 is 200 mm.

Universal joint and inverted pendulum
The connection between mechanism and the inverted pendulum was made by a universal (U) joint. Universal joints with two degrees of freedom are usually used to connect two parts that working on different axes together and to provide motion transmission over these parts. In this study, it has been used for gaining spatial mobility of the inverted pendulum ( Figure 7). U-joint consists of three parts which were manufactured by a 3D printer, three steel shafts and four MR126 micro bearings (8mm outer diameter x 6mm inner diameter x 4mm width). The Figure 8 shows the inverted pendulum which was squeezed into the sleeve on the universal joint. M3 x 20 inner screw was threaded to a rod with a diameter of 8 mm and 400 mm length.
The masses of all links described in this chapter were measured with the help of precision scales and these mass values were entered in the SolidWORKS software. So the moment of inertias of the links was calculated.

Electronic hardware
The speed of a controller is generally related to the electronic hardware, the established control circuit and the control algorithm. Therefore, it cannot be expected to exhibit a rapid control ability from a simple control circuit and a complex algorithm. The electrical and electro-mechanical equipments needed in this study are consist of a desktop computer, a data acquisition card (DAQ), two gear heads, two brushless DC motors, two motor drives, four encoders and a power supply.

Data acquisition card (DAQ)
The DAQ is the equipment to exchange information between the computer and the system and should have sufficient number of inputs and outputs to enable full communication. In addition, the selection of the card at proper sampling rate is the most important point to be considered. In case of having a DAQ with low working frequency, it is impossible to talk about successful control. In this study, Humusoft MF634 data acquisition card was used (Figure 9). For fast communication the card has been selected as PCI-Express type and it is also compatible with MATLAB / Simulink software. DAQ has: • ± 10V 5mA to 8 14-bit analog inputs • ± 10V 5mA to 8 14-bit analog outputs • 8 digital TTL compatible inputs, 8 digital TTL compatible outputs • 4 32 bit 2.5 MHz quadrature encoder reading input • 4 PWM generators or counters / timers which can be used as pulse counters.

DC motors and planetary gearheads
In this study, to design a precise and fast controller, brushless DC (BLDC) motors which are more precise and have faster responses than brushed DC motors were preferred. EC-40 model BLDC motors of Maxon were used (Figure 11 a). The first one which produces the linear motion was selected as 70W and the second one was selected as 50W. Table 1 shows the characteristics and characteristics of the selected DC motors. The speed and torque required in mechanical applications are variable. DC motors do not produce the desired torque under certain speed due to their nature. They require the use of gear heads when high torque and relatively low speeds are needed. In this study, the planetary gear heads produced by Maxon were used. One of the gear head GP32C has a 23: 1 and the other one GP42C has 4.3:1 reduction ratio (Figure 11 b).

Servo amplifiers
The other electronic equipments used in the study were motor drivers. Their main task is to amplify and transmit the modified input signals which are received from the controller. In other words, it is a bridge between the computer and the power supply and the DC motors. It is known that using different branded DC motor and motor drives may cause incompatibilities. This problem can lead to difficult situations in real-time applications. For this reason, two motors of Maxon and ESCON 50/5 servo amplifiers were used together. By means of drivers, brushed or brushless motors can be driven. Table 2 gives the characteristics of these amplifiers.

Encoders
The encoder is an electro-mechanical device that generates a digital signal (pulse) in response to movement of the shaft that where it is connected. They are used to monitor the position of the connected shaft and to provide feedback. In this study, four optical incremental encoders were used to obtain position measurements of SIP. Two of them measures the DC motor shaft positions and the rest are used for measuring pendulum angles. These encoders were selected in different types. This is due to the weight of the encoders which are going to be in motion during balancing act. The less weight they will have during balancing, will be less the inertia. Maxon brand and ENC RIO16 model optical incremental encoders were installed on both motors (Figure 13 a). Differently from them pendulum encoders are AVAGO AEDL 5810 (Figure 13 b) which has plastic light design. The characteristics of the encoders are shown in Table 3.

Power supply
Both DC motors and encoders need to be supplied with an external power supply as the operating voltages. So a 12V fixed (Figure 14 a) and a 18V regulated power supply (Figure 14 b) was used in the system.

Results
At the end of this study, the mechanical equipments of the spatial inverted pendulum system were manufactured and all mechanical and electronic equipment were assembled. Shafts, segments and bushings were used and a rigorous assembling work was carried out. Figure 15 shows the fully assembled SIP system.
The high potential of inverted pendulum systems in order to carry out qualified and systematic studies in the field of control theory should not be overlooked. In the present study, an experimental setup which provides a basis for the performance measurements of the control methods and many engineering applications has been obtained. Studies in the field of control theory can be carried out through this system which is as far as possible from the linearity. It can be a basic test platform for the studies that can be done on important topics such as missile control systems and balance in transport vehicles (segway and tower cranes).