A control system was designed to control the motion of a single degree of freedom truss type design robot arm. The control system was designed based on three main steps. Firstly a model of the system was developed using recognized theory. Parameters in the model were then adjusted so that the natural response of the system matched the simulations performed using the model. This model included the addition of non-linear elements such as coulomb friction.
Secondly a detailed analysis of the types of controller available for use was conducted. This analysis resulted in the selection of a PD controller as the controller for the robot arm. The PD controller was selected for its fundamental simplicity and stability in comparison to any other controller such as a PI or PID controller. The PD controller uses the benefits of a proportional controller by increasing the transient response of the system, but minimizes the instabilities experienced with higher proportional gains by dampening with derivative gain. The values for proportional and derivative gain were obtained by applying the developed constraints and criteria for the response. These values were developed using simulation, then optimized and tweaked using the real system.
Finally the logic control for the collection and release of the metal disk was designed. This was based on a position-velocity system. A comparison between position and velocity was performed and if the value obtained was within specified limits then the metal disk was released. This process was then optimized using the real system. The range of angular motion was then divided into three sections, (low, middle and large angles) and each sections controller gains were optimized. This resulted in average drop times of 0.46 seconds for 20°, 0.90 seconds for 90°, and 1.20 seconds for 160°. During testing the control system was 100% accurate under normal operating conditions with negligible overshoot.
Lunar Consulting recommend the developed system be implemented with modifications incorporated to transfer the prototype system to the real system. Also recommended is the further division of the range of angular motion to further optimize the drop time for each section.
Racing Pistons Inc. has been manufacturing pistons for racing applications for 40 years and have achieved the highest quality levels in their field. Currently on their manufacturing cell of their racing piston production line, there is a sub-cell which performs the functions of a quality control system. The quality control system has two aspects to it, firstly a visual inspection system. This is designed to test each part and ensure every required specification is within tolerance. A piston not within the desired tolerances would be defined as a defective part and is removed from the conveyor belt before the next stage of the manufacturing process.
The second part of the quality control system is the removal of the piston from the conveyer belt. Lunar Consulting has been awarded the contract to design and construct a prototype system to complete this task. Lunar Consulting recommended a single degree of freedom robot arm. This arm would allow the defective part to be removed from the conveyor belt to a recycling bin. Control of the arm is achieved by the use of a control system that is coupled together with a servomotor and planetary gear reduction to drive the system with the assistance of an encoder.
The first stage of the system design process involved the design of the conceptualized single degree of freedom robotic arm. Various constraints and criteria were applied to ensure a viable design was produced. This procedure has been completed and a prototype single degree of freedom robotic arm was produced. The second stage of the system design process is the design of the control system used to ensure the robotic arm performs correctly.
The objective of this report is to highlight the procedure used in the development of the control system used to control the single degree of freedom control. This is achieved by highlighting the three main aspects of the procedure, which are system modelling, controller design, and control logic. At each stage details regarding background theory, design, development, and implementation of the system will be discussed.
1.2 Control System
A brief introduction to the control system is listed below highlighting the problem, objectives, criteria, constraints, and various procedures needed.
Problem Definition: To design and fabricate a prototype (single unit only) robotic arm and develop a control system to be used to transfer a metal disk from several defined positions to a hole within the test cell. This procedure is performed using an electromagnet attached to one end of the robotic arm; the other end of the robotic arm is attached to a servomotor, which allows angular rotation along the arc of travel to the end of the robotic arm. The servomotor is to be controlled using a control system, which should be designed using Simulink.
Objective: To design a controller which when activated will pick up the metal disk using the electromagnet attached to the end of the robotic arm, then control the rotation of the arm, as efficiently as possible until a datum position is reached, whereby the control system will disconnect the electromagnet and the metal disk should fall through the hole. This process should be achieved as fast and as accurately as possible.
Control Constraints: This aspect deals with how the robotic arm should move with parameters such as period of travel, accuracy, reliability, and tolerances.
· A PC running the program Simulink should be used for control of the robotic arm.
· The controller must allow the metal disk to be dropped into the recycling hole 100% of the time. The controller must allow for different starting positions of the arm ranging from an angle of 20° to 160°. The precise angle of rotation is determined by the use of an encoder.
· The arm should not overshoot the recycle slot by over °.
· The controller must be optimized to drop the puck in the shortest time. The minimum acceptable time should be 3,2, and 1 second for the 160, 90, and 20 degree angle respectively.
· The overshoot from the recycle slot should be under 5°
Testing Procedure: A test will be performed to ensure the performance of the developed control system and robotic arm structure. The test consists of the metal disk being placed within an angular range of 20° to 160° at a distance of 20” from the centre of the servomotor. The test requires the robotic arm and control system to move the metal disk via angular rotation to the hole in the base of the test bed several times at different angular starting points. A successful test is defined as a demonstration of acceptable control of the robotic arm. This test has a further aspect where the time taken for the test to be completed will be recorded for comparison to other prototype designs undergoing similar testing procedures. Therefore the system must be accurate and fast.
Design Procedure: The controller design process will consist of the following sequence.
A system as a group of interacting, interrelating, or independent elements forming a complex whole. The process of describing mathematically by the direct application of established laws is described as modeling. The goal of the system modeling is to obtain an understanding of the system interactions as part of the process of developing a successful and robust control strategy. The first stage of almost all strategies for control is the development of a mathematical model for the part of the system to be controlled (Plant). This developed model can then be used to develop a model of the complete system that includes the controller and powering devices.
This control design procedure uses an armature-controlled permanent magnet D.C. motor. This type of device is commonly used in many control system applications such as C.N.C. machines and robotic systems. The operation of a D.C. motor with armature control provides a nearly linear ratio of steady-state velocity to input voltage that extends over a speed ratio from zero to a maximum rated angular velocity . This coupled with established physical laws can be used to develop a model of the system.
The system to be used in this project includes an encoder attached to the motor to give position and hence velocity of rotation, a gear reduction device which reduces the velocity output of the motor to give a more useable output, an amplifier which is used to power the motor and a computer with matlab simulink which is used to control the system. Also included in the system is the robotic arm which has been developed prior to the control system development. The electromagnet is attached to the robotic arm and is used to pick up the metal disk and the metal disk itself.
Once a model for the system has been develop which describes how the system naturally responds, the controller for the system can be developed using the desired response of the system. In this case the desired response for the system is to rotate as fast as possible, and then precisely stop with as little overshoot as possible and then drop the metal disk into the recycle bin.
2.2 Model development
D.C. Motor: Lewis  and Huissoon  states the derivation of the basic model for the D.C. motor. The D.C. motor consists of mechanical and electrical components. A simplified representation of the two components is shown in figure 1.
Figure 1: Permanent magnet D.C. motor model
The left side of figure 1 shows the armature circuit. The circuit has a controlling voltage (Va(t)) given in volts, an armature resistance (Ra) given in ohms, an armature inductance (La) given in Henry’s and a dependant voltage source given in volts. If a controlling voltage (Va(t)) is applied to the circuit then a magnet field is developed. This leads to the development of a torque (Td) that is proportional to the magnitude of the armature current and the magnetic field intensity. Rotation occurs if the torque is maintained by the switching action of the commutator and brushes. The torque developed torque can be described as varying in proportion to the armature current with Td(t) = Kaia(t) . If the develop torque produces motion then a voltage in the armature circuit that is proportional to the angular velocity of the armature and the intensity of the magnetic field is developed.
The generated voltage is highlighted in figure 1 and has the symbol Vb(t). The polarity of this voltage acts in opposition to the current that produces the motion. This is also highlighted in figure 1 by the direction of the signs on the armature circuit. This generated voltage is described as the back electromotive force (EMF) and varies in proportion to the angular velocity where . Vb(t)
By equating the instantaneous conversion of electrical power (Vb(t)ia(t)) to mechanical power (), it is possible to prove that ia(t) is equal to ia(t) or that equals. The units of and will not be identical as the numerical value of the back EMF constant () will be in volt-seconds per radian will be identical to the numerical value of the torque constant () in Newton-meters per ampere.
The motor exhibits feedback to maintain a constant angular velocity. This means that if the load on the motor increases due to an increase in viscous friction then the steady state angular velocity of the motor will reduce. A reduction in steady state angular velocity produces a reduction in the back EMF. This change results in an increase in armature current which increases the developed torque. This is highlighted in figure 2 which shows a block diagram highlighting the feedback action of the D.C. motor.
Figure 2: Block diagram showing feedback action of the D.C. motor
Using either block diagram algebra or Masons gain formula the transfer function relating angular velocity to input voltage is:
Equation 1 shows that the motor is a second order system. To simplify the model the inductance of the motor is neglected. This can be achieved because the ability of the motor to respond quickly to a change in input voltage is restrained by the change in kinetic energy of the motor and load. The change in armature current can occur much faster than a change in velocity (i.e. the electrical time constant is much faster than the mechanical) therefore using order reduction the inductance of the armature circuit can be neglected and so the transfer function for the motor becomes a first order transfer function and is shown in equation 2.
Additional Elements: An additional element must be added to the transfer function (equation 2) for the motor to model the system. The gain of the amplifier which is 4 has to be added to the model in the form of the gain constant. The new block diagram for the system is shown in figure 3.
Figure 3: Block diagram of motor system including amplifier
The new transfer function for the system is shown in equation 3. (This includes the removal of the inductance term)
The basic model for the motor system has been developed. The next stage is to evaluate and establish how the system operates so enabling the identification of the system constants. Further non-linear elements such as saturation, coulomb friction and backlash can then be added to give a full system model.
2.3 Experimental results
From equation 3 several constants are identified. Several of these constants are identified from the motor manufacturer’s specifications for the motor. These parameters are shown in appendix A table 4. They are the motor torque constant () which is 0.10 N.m/A, the back EMF constant () which is equal to the motor torque constant and has a value of 0.10 V/rad/s, the armature resistance () which is equal to 1.44 ohms. The value for the amplifier constant has already been identified.
Rewriting equation 3 into standard form yields the following equation.
The effective gain constant () of the system can be derived using the final value theorem and is shown in equation 5. Equation 6 shows the time constant () of the system.
The aim of the experiments is to identify the values for the effective inertia of the system (J) and the viscous friction of the system (B).
Experiment 1: The first experiment was to give the system input step voltage of 1 volt, with the robotic arm and magnet attached to the servomotor flange. A voltage greater than 1 volt was not chosen because of possible damage to the robotic arm. The test was also repeated with the metal disk attached to the magnet. The results of these experiments are shown in figure 4. From both graphs the time constant () and the gain constant (Kε) can be obtained. The gain constant (Kε) is estimated to be 7 rad/s per volt for the system with no metal disk and 6.7 rad/s per volt for the system with the metal disk.
The time constant for each test is calculated by calculating the average between the time taken to reach 63% of the gain constant (1 time constant) and the time taken to reach 95% of the gain constant divided by 3 (3 time constants). Values for the time constants were found to be 0.8 seconds for the system without the metal disk and 0.95 seconds for the system with the metal disk.
Figure 4: D.C. motor response to 1V step input
From figure 4 it is noticed that the system responds slower when the metal disk is attached. Also noticed is that the graph appears to be the graph of a first order system, this implies that the assumption to neglect the inductance of the armature is correct.
Using the above mentioned experimentally obtained values, the manufacturers details and equations 5 and 6 values for the viscous damping (B) and effective inertia of the system (J) can be calculated. The method used is shown below and the results are highlighted in table 1. Rearranging equation 5 yields
Rearranging equation 6 yields
Table 1: Estimation of model parameters
The results from table 1 were then entered into the block diagram of the system (figure 3). The simulation was then run and the results were compared to the experimental values. The comparison is shown in figure 5. It shows that the theoretical simulated predictions almost match the experimental results. The simulated results are calculated using a first order characteristic equation in the transfer function whereas the actual transfer function for the system should be second order. By both sets of results being identical it means that the effect of the electrical time constant that was neglected when simulation modeling is minimal and the assumption is correct. Assuming the system is a first order system means that the system is easier to use to simulate the experiments. Therefore this simplifies the design of the control system.
Figure 5: Comparison of experimental and simulated results
Addition of Non-linear elements: A basic model linear model for the system has been created. The next stage is to add non-linear elements such as current and voltage saturation, coulomb friction and backlash.
Saturation: The amplifier has a saturation level of. A saturation block was added to the model of the motor system (figure 3) before the voltage gain of the amplifier block (). The amplifier has a maximum continuous current of . A saturation block must be added to the system to represent this. It is added to the model of the motor system (figure 3) where the current is developed in the system. This is after the electrical transfer function but before the motor torque constant gain. Figure 6 shows system block diagram with the non-linear blocks added.
Figure 6: Block diagram of system with saturation blocks
Figure 7: Comparison of experimental and simulated results with saturation blocks
Figure 7 shows that the experimental results match the simulated results even with the addition of the saturation blocks. This is the case for the low input voltage however when the voltage is increased to the maximum 5 volts it might not be true. There are no experimental results to test this hypothesis as an input of 5 volts was deemed to be damaging for the system.
Coulomb friction: This non-linear element acts as disturbance torque feedback for the mechanical system. In order to estimate the value of coulomb friction offset a further experiment is needed.
Experiment 2: This experiment is almost identical to experiment 1 except that once the rotation of the servomotor has reached steady state the emergency stop button is hit and the response of the system is noted. This experiment was again repeated with and without the metal disk. Once the emergency stop button the motor is slowed down by the negative torque caused by coulomb friction. Figure 8 shows the results of this experiment. Equation 9 is the equation used to calculate the coulomb friction offset. Equation 4 is used to calculate the angular deceleration of the system . This can then be multiplied by the mass moment of inertia of the system (J) to gain the torque due to coulomb friction.
The torque and hence effect of coulomb friction was therefore calculated as 0.0209N.m for the system without the metal disk and 0.0223N.m for the system with metal disk. The block diagram for the system can then be modified to include this and then the simulated results compared to the experimental results for experiment 1. The block diagram is shown in figure 9 and the results in figure 10.
Figure 8: D.C. motor response to 1V step input with emergency stop
Figure 9: Block diagram of system with coulomb friction
Figure 10 shows that the addition of coulomb friction has an effect on the values and the simulated values are no longer the same as the experimental. Therefore the model parameters are needed to be changed to allow the simulation to predict the real system accurately. Via iteration the new values for B and J could be calculated and they are 0.0305 Nms/rad for B and 0.0410kg m2 for J for the system with the metal disk and 0.00295 Nms/radfor B and 0.305 kg m2 for J for the system without the metal disk. Figure 11 shows how these new values compare to experimental results.
Figure 10: Comparison of experimental and simulation results with coulomb friction
Figure 11: Comparison of experimental and simulation results with coulomb friction and iteration
3.1 Background and Theory
The purpose of the controller is to manage a variable in order to produce an appropriate output. The equations used to calculate the output are the modes of controller operations. The type of controlled variable being analyzed determines the mode of the controller and the value of certain constants related to the action. The variable is measured by the controller and compared with the desired set output value. The difference between the variable and the output, known as the error, is minimized by the controller parameter. The controller parameter is chosen based on the level of dependence it has over the variable. A self-regulating system is often required to accommodate the changes within the system and still maintain the desired output. Continuous observation of the output can be achieved by the use of a feedback. There are several different types of continuous controllers, such as the proportional controller, the integral controller, the derivative controller, the proportional integral (PI) controller, the proportional derivative (PD) controller, and the proportional-integral-derivative (PID) controller.  
The Proportional Controller: The proportional controller is a straightforward approach of controller design. The controller output, p(t), is proportional to the error signal, e(t), by an adjustable gain factor of Ko. If the error is zero, the output remains constant on the set point value. If an error is present, a Ko factor corresponding to the error will be added or subtracted to the set point value. The output of the proportional controller is as follows:
p(t) = Koe(t) (11)
The controller gain is adjusted to increase or decrease the sensitivity of the output to the differences between set point vale and the controlled variable. The output and the error have a smooth and linear relationship. This simplicity is the main advantage of the proportional controller. However, the use of this controller is appropriate only if offset can be eliminated or tolerated. Moreover, the process should not involve large load changes, as large load change would cause high process lag time, and the controller would act as an on/off switch due to a very short proportional band.
The Integral Controller: The Integral control depends on the integral of the error signal over time. There is a continuous change of output depending on the error. The integral controller is represented as follows:
where: = Rate of controller output change and KI = Integral gain constant
The controller output can be determined by integration and is as follows:
The major advantage of the PI controller is that it eliminates offset. At steady state, the deviation between the set point value and the controlled variable will be eliminated because p(t) will vary until the error is equal to zero. The disadvantage of PI controller is that the controller has relatively slow response to an error signal, which can lead to large deviation when error is produced. Also, the controller will not respond until the error signal has persisted.
The Derivative Controller: The derivative controller uses corrective action based on the rate of change in error signal to anticipate the future behaviour of the error. The output of the controller is represented as follows:
where: KD = Derivative gain constant
When the error signal increases, the output is large; and vice versa. The derivative action is used to stabilize the controlled process. Note that the derivative controller cannot be used individually because there is no output when the error is zero or constant.
The PI Controller: The proportional plus integral (PI) controller is applicable to situations that require an improvement in steady-state performance as obtained with an increase in the type number . The controller output combines the proportional controller and the integral controller, and is as follows:
Combining an integral controller to a proportional controller will eliminate the steady state error. The system will saturate when error is equal to zero since the integral term cannot be negative. The PI controller is often used in systems with large load changes. The disadvantage is that this controller will also increase settling time and the amount of overshoot.
The PD Controller: The proportional derivative controller combines the advantages and disadvantages of the proportional and derivative mode controllers. It introduces an LHP zero into the forward path function to improve the inherent stability of a system. The PD controller is represented as follows:
The PD controller can handle fast process load changes. The derivative mode reduces the overshoot and settling time. However, it cannot eliminate the offset that is generated by the proportional mode.
The PID Controller: The three mode proportional-integral-derivative (PID) controller is both powerful and complex. The controller output is as follows:
The PID controller combines the advantages of each individual mode of control. It eliminates the offset while still providing a fast response and reduced overshoot. A disadvantage of the PID controller is that a rapid change in the set point such as a step will be portrayed as a disturbance and could have a negative effect.
3.2 Controller Selection
The PD controller is chosen for the design of the controller for the system. This is due to the PD controller providing the ability to handle fast process load changes. The load change will occur when the magnet picks up and drops down the steel disk; which is a significant process that must be taken into consideration for the logic design. Furthermore, the PD controller reduces the amount of overshoot, which is another important aspect since the allowable overshoot is not to exceed 10 degree. The PID controller would be applicable, but its complexity gives additional difficulties to the control logic design. Since the integral of the output used in the project is zero, the use of an integral controller would be unnecessary.
Controller design can now be implemented using the completed mathematical model of the system, the system parameters and the selected PD controller. Figure 12 shows the basic closed loop system. In order to design this PD controller the settling time, proportional gain (Kp), and the derivative gain (Kd) must be computed.
Figure 12: Basic Controller Design
First, using the specifications outlined in the project guidelines a settling time can be determined. Since the arm is designed to withstand a load of 2kg horizontally the maximum torque the arm experiences can be computed using:
where, F = force of 2kg mass, r = radial distance from the motor axis (20” = 0.508m)
Now the angular acceleration of the arm can be computed using this value of torque and the moment of inertia (J) computed previously in the report:
Finally the settling time can be computed for an angle of 160˚ or 2.79 radians (the maximum angle according the restrictions outlined above).
The computed number is extremely small mainly due to the fact that the arm will not undergo the maximum acceleration throughout the entire motion as it will be difficult to control. Moreover, it will not be possible to achieve the maximum acceleration as the input voltage is limited. Thus, this time will increase significantly and a more accurate assumption for settling time can be arbitrarily estimated at 0.8 seconds. It is also important to note that the angle of 160˚ was chosen as this is the maximum angle according the restrictions, which will produce the maximum overshoot (restricted to 10˚).
The analytical calculations are presented in Appendix C - Calculations. The values for Kd and Kp computed are 0.2681 and 1.596, respectively. These values have significant error due to ignoring non-linear components such as coulomb friction, voltage saturation, current saturation, and backlash.
All the values required in the Simulink model have now been determined and this model can be implemented with a PD controller in place. The completed Simulink model is shown in figure 13 below. The parameters for the model were the parameters obtained in section 2 for the robotic arm with the metal disk attached to the arm.
Figure 13: System model including controller
First, the natural response of the system is shown in figure 14. The figure shows the results of a simulation where a PD controller is used, however the system has no derivative gain and only proportional gain. Figure 14 shows that there is significant overshoot from this uncontrolled response. With the PD controller in place and the computed Kp (1.596) and Kd (0.2681) inputted the system behaves with significantly less overshoot as shown in figure 15. However the system responds with an overshoot of greater than 10 degrees. This would result in failure under test conditions. Therefore in order to get a better response and take into account non-linear components the Kd and Kp values are tweaked experimentally and determined to be 1.86 and 7.11. Figure 16 shows this result and there is overshoot in the model however it is within the limits imposed. These tweaked Kd and Kp values are the final values used in the control system.
Figure 14: Uncontrolled response
Figure 15: Controlled response (un-tweaked)
Figure 16: Controlled response (experimentally tweaked)
4.1 Background and Logic Theory
The prescribed motion of the arm is as follows; initially, a reference position will be set, by placing the arm over the recycle slot. Next the arm will be manually rotated to the location of the metal puck, where it will await the trigger signal. Once the signal is triggered the electromagnet will energize and pick up the puck, and the arm will then begin to rotate towards the reference point (recycle slot). At the reference point the electromagnet will be de-energized and the puck dropped into the recycle slot. This prescribed motion is to be achieved in the least possible time, and constrained to a maximum overshoot of 10 degrees from the recycle slot. The dynamics of this motion are to be implemented by using a series of controller logic statements in Simulink.
4.2 Simulink Controller Logic
The logic that controls the arm motion is programmed using Simulink. Simulink translates the digital signals into analog ones and causes the desired motion. Figure 17 shows the block diagram of the controller logic that regulates the motion of the arm.
Figure 17: Block diagram for motion logic
The angular position is measured by the encoder. A gear ratio is used to correct for the internal gearing in the motor. A PD controller is used in a closed loop feedback to govern the motion of the arm and a manual switch is used to activate the motion once the arm is positioned.
The logic of the code dictates that the switch is in the open position and the arm is positioned at the reference point when the code is first initiated. The position of the switch in figure 17 is opened. While the switch is opened, the arm is rotated to the desired position. During this rotation the encoder reads the angular position off the motor. It is apparent from the block diagram that here is no feedback during this operation, and the input signal is continuously zero, which has no effect when passing through the PD controller. Thus a zero voltage is applied to the motor and hence no motion is produced. Furthermore, when this input signal is read by magnet logic circuit, it causes the electromagnet to remain de-energized. This magnet logic is explained in the latter part of this section.
When the switch is closed (lowered) it activates the logic that governs the arm motion, and the pickup and the release of the puck. In the initially stages of its motion, the arm accelerates and then decelerates to a stop as it approaches the reference point. The logic that controls this motion is governed by closed loop feedback control and a PD controller. The encoder is used in the position feedback loop, to compare the actual arm position to the desired arm position. If there is a discrepancy between the two positions, an error signal e(t) is generated that will drive the motor in such a way that this error is minimized. In this project the desired position is set to zero, thus the error signal is the difference between zero and the current encoder reading. The error in this project is governed by the PD controller.
As mention in section 3.1 a PD controller is composite controller consisting of the proportional and derivative modes. The proportional gain (Kp) indicates how hard the motor should work to keep its current position. The higher the proportional gain the faster the arm will return to its initial position. However, the overshoot value increases as the Kp value is increased above a certain value. Physically this will cause the arm to move back and forth about the reference point, which is not desired. The effect of increasing the proportional gain constant is shown in figure 18. The derivative part of the controller helps stabilize the motion, by acting as a dampener. Increasing the derivative gain constant (Kd) is analogous to increasing the dampening coefficient. Thus a higher Kd value increases the stability by eliminating or minimizing the overshoot. This however causes the velocity, as the arm approaches the reference point, to be reduced. The effect of increasing the Kd value is shown in figure 19. For this project an optimal combinations of Kp and Kd was acquired by tweaking the values during testing. These values were further optimized for different specified angles. The results used for this optimization are shown in Appendix B, Table 5.
Figure 18: Effect of increasing the proportional gain constant 
Figure 19: The effect of increasing the derivative gain constant with a set Kp value 
Figure 20 shows the block diagram of the logic that controls the pick up and the release of the puck. When the arm is brought to a stop above the recycle slot, the position and the velocity error should be zero. When both these conditions are true, the puck can be safely dropped. It is crucial to compare both values, and not just one case. If only position was compared, an overshoot in the arm will cause the puck to be released as the arm passes the reference point and is still in motion. Whereas, if velocity alone was compared, the puck will be released when the arm changes direction in an overshoot.
Figure 20: Block diagram for pick up and drop off logic
Once the switch is lowered the error signal if fed down two paths. The upper path carries the absolute value of the position error. The lower path converts the position error to an absolute velocity error by taking the derivative of the signal. The difference between the values of both signals is then taken to determine if the puck can be dropped. If the absolute value of the difference is zero, the velocity and the position are zero, and the puck can be dropped. This however is not the case since there are slight irregularities in position and velocity, when the arm is above the reference point, because of vibrations. To overcome this, an experimental threshold value (drop constant) has been determined, such that if the difference is smaller than this value, it can be assumed that the arm is stopped above the reference point. This comparison accomplished by using a comparative logic statement as seen in the block diagram. Through extensive testing the drop constant was optimized such that the puck is released while the arm is still in motion.
The electromagnet is energized when the input signal is 0, and de-energizes when the signal is 1. The design of the electromagnet is such that a multiplexer signal must be used to turn the magnet on or off. The multiplexer functions as an OR logic gate where one input is from the logic comparator, as described above, and the other input is a continuous 0 input. Table 2 shows the truth table for the magnet logic. Figure 21 shows the conditions when the electromagnet is activated and deactivated. Table 3 shows the truth table for the logic of the overall system. Figure 22 shows the block diagram logic of the completely assembled logic. 
Figure 21: Activation and deactivation of the electromagnet
Table 2: Truth table for magnet logic
Table 3: Truth table for entire control logic
Figure 22: Block diagram of complete controller logic
One final aspect of the control system development was the division of the whole angular range (20° -160°) motion into three separate sections then optimizing the controller for that particular section. This was achieved by the replacement of the PD controller shown in figure with an arrangement as shown in figure 23. Each PD controller shown in figure 23 is optimized for a particular angle in order to lower the travel time for each angle.
The first PD controller is optimized for small angles (up to 40°) and has values of 7.11 for the proportional gain (Kp), 1.86 for the derivative gain (Kd),. The second PD controller is optimized for the mid range angles (40° -120°) and has values of 9.2 for the proportional gain, 1.9 for the derivative gain. The third controller is optimized for the high end angles (40° -120°) and has values of 13 for the proportional gain, 1.9 for the derivative gain. These three controllers cover the entire range of operation. The value for the drop constant was kept constant at 0.1 to simplify the process.
Each proportional controller is selected by the use of a switch. The PD controller used for each test is determined by which position the switch is in. For the prototype testing manual switches were used however as the real scenario is expected to operate without interface with a person then the switches will have to be converted to automatic switches. This could be achieved by using automatic switches and having the operational limits of these switches controlled by the angle the robotic arm is rotated through.
Figure 23: Actual PD controller representation
4.4 Final Results
To demonstrate and prove the ability of the system, tests are performed at three angular locations (20°, 90°, 160°). The tests were invigilated by Arash Narimani, a representative of Racing Pistons Inc. Each angle is tested a total of 4 times with the 3 lowest times used to obtain an average time.
Table 4: Final Results
These tests marked the conclusion of the development side of the project.
Various aspects of the procedure used to develop the control system for the robotic arm have been highlighted. By using these procedures an accurate and reliable control system was developed for the system.
In order to effectively design the controller, a model of how the system responds naturally had to be identified. This was obtained using standard theoretical model a permanent magnet D.C. motor. The model for the motor was then applied to the system used by obtaining various parameters for the motor from the motor manufacturer and from experimental results. Also included in the motor model were other aspects such as amplifier gains and non-linear elements. The main points to draw from this aspect of the development was the calculation of the viscous friction (B) and effective inertia of the system (J). These values were calculated to be for B and for J for the system with the metal disk. A comparison of the theoretical model of the system and the experimental results was performed and this showed that the model of the system almost reflects the natural response of the system.
The proportional derivative (PD) controller was chosen among the various types of controllers for the control logic. The PD controller was most appropriate because it can handle fast process load changes and can also reduce the amount of overshoot. The controller gains were determined theoretically. However these predicted values had to be optimised as the actual system varies because unpredictable factors were ignored in the calculation. The optimised values of Kp and Kd were experimentally established to be 1.86 and 7.11.
A control logic system was developed which used the position and velocity of the arm to control precisely the position at which the metal disk was dropped. This system was then optimized by dividing the angular range in sections and then optimising each angular sections controller proportional and derivative gains to yield optimised characteristics of motion. With the objective to transport the disk in minimum time with less than 10 degrees overshoot, the tested average travel times were an impressive 0.46 seconds for 20°, 0.90 seconds for 90°, and 1.20 seconds for 160°. The testing showed a consistent and reliable result with 100% accuracy.
The development of the control system has produced an accurate and reliable control system. Lunar Consulting therefore recommends that the developed control system and single degree of freedom robotic arm be implemented on the quality control cell of Racing Pistons Inc production line. Further optimization of the produced gains could produce marginally lower travel times however it is judged that the extra cost of this process would far out way the added benefit of this process as the developed control system shows 100% accuracy in testing under normal conditions and very low travel times.
Due to the developed control system and robotic arm using idealized assumptions such as simplifying the piston as a metal disk various parameters of the development should be adjusted to fit the real scenario however the method of development of robotic arm control system should be the same as that highlighted in this report. The systems used to identify the starting position of the metal disk (piston) should also be included in the development of the real scenario control system.
It is also recommended that smaller angular increments are used to optimize the travel time. The developed control system used three angular increments and optimized the controller gains for each angular position. Further optimization by increasing the number of increments could result in a lower travel time for each angle. This however adds extra complexity to the control system and therefore comparison of benefit over cost would need to be performed before development and implementation of such aspects.
Motor Manufacturers Specification
Table 5: Motor Specifications 
Control system optimization raw data
Table 6: Results of controller optimization