DESIGN AND IMPLEMENTATION OF FEEDBACK CONTROL SYSTEM FOR 6-DOF STEWART PLATFORM.

Gopiya Naik S 1 , Manojgowda S. P 2 and Kishor G 2 . 1 Associate Professor, 2 Students, Department of Electrical & Electronics Engineering, PES College of Engineering, Mandya, Karnataka (India). ...................................................................................................................... Manuscript Info Abstract ......................... ........................................................................ Manuscript History Received: 02 August 2019 Final Accepted: 04 September 2019 Published: October 2019


ISSN: 2320-5407
Int. J. Adv. Res. 7(10), 28-40 29 servos, micro-controller, joints, PWM module, touch panel etc., This section also includes building GUI for controlling the platform in a Java based programming language/Processing". Section-4 deals with the control system design for the ball-on-plate system; this includes mathematical modelling of the system and design of control blocks using two methods PID and LQG. Section-5 explains implementing the control strategies on the actual prototype. This includes programming the control logic in Arduino and Processing. Finally, Section-6 gives results anddiscussion

Modelling and Simulation of Stewart Platform
Stewart Platform is a parallel manipulator which uses 6 actuators to position the top platform .Usually these actuators are hydraulic pistons whose lengths can be varied by pumping hydraulic fluid into them, these kind of actuation is suitable in large load application on the platform. Since we are building a prototype model cost of a hydraulic actuators are a major constrain. Linear actuators also give linear motion just like hydraulic actuators but they are relatively slow for real-time control of the platform. So we are using xed length rods connected to a servo motor arm, thus by rotating the servo arm we can emulate the varying length between the servo center of rotation and the top platform. Literature survey was done to find research papers that explains the control of the Stewart platform, [1] [2] [3] most of the papers go through control using hydraulic actuators there are very few papers deal with rotary actuators. [4[, [5] show that there are two ways of controlling the platform Forward Kinematics: This is the method of obtaining the orientation of the platform by solving bunch of simultaneous non-linear equations having length of actuators (in this case servo angles) as inputs and platform orientation as output.

Inverse Kinematics:
This is the method of obtaining the length of actuators (in this case servo angles) by providing the required orientation of the platform. This method employs geometric transformation to reverse calculates the servo angles from the platform orientation.
Since the system to be controlled is ball-on-plate, it is required to control the roll and pitch (rotation along X and Y axes respectively) of the platform. By designing a controller that takes in roll and pitch as input of the system and positions the ball, we need to calculate the servo angles required to position the platform in the right pitch and yaw .So it is convenient to use Inverse Kinematics for ball-on-plate system. 3D Simulation of Stewart platform gives a visual understanding of the system and its physical limitations. This allows to actually animating all the movements of the plat-form before building actual prototype. The Sections below give a brief description on the steps taken to building and simulating the Stewart Platform.

3D Modelling in Solid Works
Each part of the Stewart platform shown in Fig. 2.1 is modelled as 3D Part (.ipt le) in Solid Works (2015 Student edition), Then assembled with appropriate joints to obtain a full dynamic model with all the movements. This allowed us to make necessary changes to the model without having built the model to get the required motion and test it. MATLAB add-on in the Solid Works allows us to open this entire 3D model in the MATLAB.

Fig. 2.2:-SolidWorks Window
Solid Works is a solid modeller, and utilizes a parametric feature-based approach which was initially developed by PTC (Creo/Pro-Engineer) to create models and assemblies. The software is written on Parasolid-kernel. Parameters refer to constraints whose values determine the shape or geometry of the model or assembly. Parameters can be either numeric parameters, such as line lengths or circle diameters, or geometric parameters, such as tangent, parallel, concentric, horizontal or vertical, etc. Numeric parameters can be associated with each other through the use of relations which allows them to capture design intent. Building a model in SolidWorks usually starts with a 2D sketch (although 3D sketches are available for power users). The sketch consists of geometry such as points, lines, arcs, conics (except the hyperbola), and splines. Dimensions are added to the sketch to de ne the size and location of the geometry. Relations are used to de ne attributes such as tangency, parallelism, perpendicularity, and concentricity. The parametric nature of SolidWorks means that the dimensions and relations drive the geometry, not the other way around. The dimensions in the sketch can be controlled independently, or by relationships to other parameters inside or outside of the sketch.
In an assembly, the analog to sketch relations are mates. Just as sketch relations define conditions such as tangency, parallelism, and concentricity with respect to sketch geometry, assembly mates define equivalent relations with respect to the individual parts or components, allowing the easy construction of assemblies. Solid Works also includes additional advanced mating features such as gear and cam follower mates, which allow modelled gear assemblies to accurately reproduce the rotational movement of an actual gear train. Finally, drawings can be created either from parts or assemblies. Views are auto-matically generated from the solid model, and notes, dimensions and tolerances can then be easily added to the drawing as needed. The drawing module includes most paper sizes and standards (ANSI, ISO, DIN, GOST, JIS, BSI and SAC).

SimMechanics Model
The Solid Works assembly is converted into a Simechamics model shown in Fig. 2.3 (Package in MAT-LAB) using STP and xml les generated by the Soli Works simmechanics add-on. The automated conversion is not efficient, Hence the converted model has to be cleaned by removing redundant joints , adjusting the co-ordinate system, rearranging the block orientation (i.e., Some blocks may have their driven and Driving side interchanged), reorganizing the blocks into subsystems to obtain a manageable Simulink model . Inputs to the Servo angles are created by changing the input method in blocks, this makes the model to respond to the input rather than simulating just random dynamics due to gravity.

Inverse Kinematics Simulation in Simmechanics (MATLAB)
Stewart Platform is a Parallel Manipulator (i.e., the one input does not directly influence one output, all 6 inputs have to synchronously move to obtain desired output), the equations of motion of the platform are Highly non linear and forward dynamic simulation is computationally taxing and also real time control is not easily feasible. So a reverse approach is taken, instead of calculating output based on 6 inputs, inputs are calculated to a given set of outputs this method is known as Inverse Kinematics.

Inverse Kinematics Formulation and Simulation
We modelled our Inverse Kinematics (Fig. 2.4) based on [6], kinematic equations are coded in MATLAB as functions and are called by the Simulink model, All 6 motions are Simulated , verified and correctness of inverse Kinematic equations are conformed.

Fig 2.4:-Inverse Kinematic Bolck in Simulink
Simulink Simulink (Fig. 2.5), developed by MathWorks, is a graphical programming environment for modelling, simulating and analyzing multi domain dynamical systems. Its primary interface is a graphical block diagramming tool and a customizable set of block libraries. It offers tight integration with the rest of the MATLAB environment and can either drive MATLAB or be scripted from it. Simulink is widely used in automatic control and digital signal processing for multi domain simulation and Model-Based Design. MathWorks and other third-party hardware and software products can be used with Simulink. For example, State flow extends Simulink with a design environment for developing state machines and ow charts. MathWorks claims that, coupled with another of their products, Simulink can automatically generate C source code for real-time implementation of systems. As the efficiency and flexibility of the code improves, this is becoming more widely adopted for production systems, [5], [6] in addition to being a tool for embedded system design work because of its flexibility and capacity for quick iteration[citation needed]. Embedded Coder creates code efficient enough for use in embedded systems. 32

Fig. 2.5:-Simmechanics Simulation of the Stewart Platform
Simulink Real-Time (formerly known as xPC Target), together with x86-based real-time systems, is an environment for simulating and testing Simulink and State-flow models in real-time on the physical system. Another MathWorks product [10] also supports specific embedded targets. When used with other generic products, Simulink and Stateflow can automatically generate synthesizable VHDL and Verilog. Simulink Verification and Validation enables systematic verification and validation of models through modeling style checking, requirements traceability and model coverage analysis. Simulink Design Verifier uses formal methods to identify design errors like integer over flow, division by zero and dead logic, and generates test case scenarios for model checking within the Simulink environment. SimEvents is used to add a library of graphical building blocks for modeling queuing systems to the Simulink environment, and to add an event-based simulation engine to the time-based simulation engine in Simulink. Therefore in Simulink any type of simulation can be done and the model can be simulated at any point in this environment. Different type of blocks can be accessed using the Simulink library browser. And therefore the benefit could be taken out from this environment efficiently.

Stewart Plat form Prototype
After simulating the platform, Actual prototype is built and a GUI to control the platform is also built using Java based programming language \Processing". The process followed in building the prototype (Fig. 3.3) is given below.

Physical model
Using the Simulated model as reference a physical model was built.
Top and Base of the platform are made from Plywood (Fig. 3.1).

Fig 3.1:-Plywood Base
Used futuba s006 servo motor for actuating the arms (Fig.3.2), this uses pulse width modulated signal to give a precise angular rotation (upto +/-1 degree accuracy). It was found by experimenting that pulse width of 120 ms to 470ms in 1000 ms period gives a 0 to 180 degree rotation without over turning or physical damage to the servo. 2. Universal joints with plastic rods are used as connecting rods between base and top platform the length of these are longer than the simulated version. 3. Arduino Uno is used to control the servos using PWM signals over an I2C bus, the arduino is programmed to receive angles from the computer and send corresponding PWM signal to servos, and also programmed to read touch sensor data and send it back to computer using Serial communication with a baud rate of 115200 bits/second. 4. Touch Sensor is used as a feedback device that give the position of a ball when is placed on it, this is 11inch 4 wire touch screen (diagonally) with a 10ms refresh rate. 5. I2C communication protocol is used to send PWM signal to servos. Even though the Arduino has more than 6 PWM ports we have used I2C module to send PWM signals because each servo draws about 250-400mA (depending on load) so 6 servos will easily consume about 2-2.5A but Arduino can only supply about 250mA of current, So this module allows us to power the servos using an external power supply and this also helps is easy routing of cables.

Description of components Arduino Uno
The Arduino UNO (Fig. 3.4) is an open source microcontroller board based on the ATmega328P microcontroller and developed by Arduino.cc. The board is equipped with sets of dig-ital and analog input/output (I/O) pins that may be interfaced to various expansion boards (shields) and other circuits. The board features 14 Digital pins and 6 Analog pins. It is programmable with the Arduino IDE (Integrated Development Environment) via a type B USB cable. It can be powered by a USB cable or by an external 9 volt battery, though it accepts voltages between 7 and 20 volts. The ATmega328 on the Arduino Uno comes pre-programmed with a boot loader that allows uploading new code to it without the use of an external hardware programmer.  Weight: 25 g

Fig 3.4:-Pin Configuration of Arduino Uno
Servo motor A servomotor Fig. 3.5 is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors.
Most hobby servos use a standard type of 3-pin plug, with the same control signalling. The connector is a female, 3pin, 0.1" pitch header. One thing that can be confusing is that the wiring colour code is not always consistent there are several colour codes at play. The good news is that the pins are usually in the same order, just that the colours are different. Table I gives the wiring colour code of Servo motor The third pin of the servo connector carries the control signal, used to tell the motor where to go. This control signal is a specific type of pulse train. The pulses occur at a 20msec (50 Hz) interval, and vary between 1 and 2msec in width. The Pulse Width Modulation hardware (Fig. 3.6) available on a microcontroller is a great way to generate servo control signals. Common servos rotate over a range of 90 as the pulses vary between 1 and 2msec they should be at the center of their mechanical range when the pulse is 1.5msec.

Touch Panel
The sensor used to obtain the position of the ball is a 4-wire resistive touch panel (Fig. 3.7). A transparent screen with four wires coming out of it is used for interfacing. Though transparent, but consists of 2 resistive layers lying parallel to each other one above the other having an air gap (a kind of insulation) in between. What happens is that when the user touches the touch screen, the two resistive layers gets connected and a voltage divider resistive network is established. In order to conform that, we will have to calculate the co-ordinates. To calculate the coordinates on the touch screen where the user has touched, we play with four wires coming out of the touch screen ( Fig. 3.8). The two wires indicating the x-axis and the other two the y-axis (x and y axis here are the relative directions). So, after the formation of a potential divider network, we apply voltages to X+ and X-and making Y+ OR Y-as a probe (means we take voltages from Y+ or Y-), in the same fashion we take voltage from the X+ or X-. These two voltages we get are function of the resistance which will vary throughout as you move in the touch screen.

PWM module
The PCA9685 is an I2C-bus controlled 16-channel PWM controller (Fig. 3.9). Each PWM output has its own 12-bit resolution (4096 steps) xed frequency individual PWM controller that operates at a programmable frequency from a typical of 24 Hz to 1526 Hz with a duty cycle that is adjustable from 0 % to 100 %. All outputs are set to the same PWM frequency. Each output can be o or on (no PWM control), or set at its individual PWM controller value. The Inter-integrated Circuit (I2C) Protocol ( Fig. 3.10) is a protocol intended to allow multiple slave digital integrated circuits (chips) to communicate with one or more master chips. Like the Serial Peripheral Interface (SPI), it is only intended for short distance communications within a single device. Like Asynchronous Serial Interfaces (such as RS-232 or UARTs), it only requires two signal wires to exchange information.
Communication via I2C is more complex than with a UART or SPI solution. The signalling must adhere to a certain protocol for the devices on the bus to recognize it as valid I2C communications. Fortunately, most devices take care of all the ddly details for you, allowing you to concentrate on the data you wish to exchange. Messages are broken up into two types of frame: an address frame, where the master indicates the slave to which the message is being sent, and one or more data frames, which are 8-bit data messages passed from master to slave or vice versa. Data is placed on the SDA line after SCL goes low, and is sampled after the SCL line goes high. The time between clock edge and data read/write is defined by the devices on the bus and will vary from chip to chip.

Software to Control the Stewart platform
We wanted a Simple program that is cross platform and light to Control the plat form ( Fig. 3.11). We use Processing instead of MatLab to communicate to out Arduino in the platform. Processing is Java base programming language it is much easier to create GUI and Visualizations , It has built in libraries to communicate to Arduino which works well for our application .We translated the Inverse Kinematics Code from Matlab to Processing.

Prototype testing
The physical model and Software were successfully integrated. A Game controller is used to test range to desired motion i.e., X, Y, Z translations and rotation about each axis of top platform.

Control system design and simulation Modelling of the System
The Control problem is to balance a ball on the top platform of the Stewart platform using feedback control techniques.
The general name for ball balancing system is \Ball on Plate System". The papers referred to obtain the mathematical model of the system are [7,8]. With some modification such as ball inertia and neglecting friction etc., nonlinear State Space model is obtained.

Design and simulation of LQG Controller
Linear Quadratic Gaussian or state feedback controller with Kalman filter as state estimator. We use Control law u = K x to control input based on the current state x of the system, to obtain a optimal K we use lqr command in matlab to solve the optimal control problem using \Ricatti Equation", Since Touch sensor can only give position information of the ball we are using a state-estimator to estimate other states like angle of plate, velocity of ball, etc. This is done by using lqg command and spacing the Noise and Disturbance Co-variance matrix. The matlab code for obtaining K and Kalman filter is written.
The designed State estimator and regulator are used to simulate ball-plate system in Simulink (Fig. 4.5 and 4.6).

Implementation of Designed controller in actual system Implementing PID control
The continuous PID Designed in previous step is converted in to discreet system and are coded into the Stewart Platform Control Software designed in Section 2. However, including of Integral controller tends to destabilize the system, so I controller is removed and only PD controller are being used. The PD gains adjusted to obtain smooth motion.
Successfully implemented the PD controller, the platform can autonomously balance the ball in the given position.