Loading...

Summer Research Fellowship Programme of India's Science Academies

Toward Developing a Distributed Control Hardware for Control of Flexible Joint Manipulator

BISWAJEET SAHU

National Institute of Technology, Rourkela

Guided by: 

Dr. SOUMEN SEN

Central Mechanical Engineering Research Institute, Durgapur

ABSTRACT:

Robots find wide applications in various areas, especially in industrial assembly processes. Flexible joint robot manipulators form an important class of manipulators where they interact with the environment physically. Control of mechanical impedance at the end-effector becomes essential in such applications while maintaining the position. The end-effector mechanical impedance results from individual contributions of the compliant joints and the instantaneous configuration of the manipulator. The actuation of a compliant joint with stiffness variability requires two inputs, and thus two prime movers.    This project activity deals with hands on study of a distributed control harware architecture and embedded controllers for positon control of individual prime movers (brushed DC motors) and position/ velocity measuremens.

The scope of the project was confined to the study of Arduno microcontrollers, the technique of position measurement using incremental encoders, the implemention of quadrature encoder reading and velocity estimation algorithms in Arduino, and the implemention of PD position controller using encoder feedback for controlling the position of individual motors. Several variants of the Arduino board were used, namely Mega, Uno and Nano. Additionally, various motor driver amplifiers (with PWM control) were studied. All the concepts were implemented in the hardware, followed by experiments.

This is a joint report being submitted with Subham Panda under the summer internship program.

Keywords: PWM, I2C, PD Controller, Quadrature Encoder, Arduino. micro controllers.

Abbreviations:

Direct Current as DC

Proportional–Integral–Derivative controller as PID

Proportional–Integral controller as PI

Proportional–Derivative controller as PD

Process Variable as PV

Charge Coupled Device as CCD

Self-Learning Fuzzy Logic Controller as SLFC

SPI requires more number of pins as compared to UART and I2C. For connection of single master to a single slave with a SPI, bus requires four lines. Each slave requires an additional chip select I/O pin on the master. The large number of connections make it undesirable where many devices must be slaved to single master.

Pulse Width Modulation as PWM

Universal Asynchronous Receiver/Transmitter as UART

Future Technology Device International as FTDI

Electrically Erasable Programmable Read-Only Memory as EEPROM

INTRODUCTION

Background

Mechatronic systems are complex. Generally, a mechatronic system, like a robotic arm, executing some physical work, consists of a mechanism, an end-effector, actuators to drive the mechanism, sensors to assess its own configuration with respect to a reference frame, and an environment and a controller to control the motion of the mechanism as desired under a feedback control law. Such robotic manipulators have several degrees of freedom to accomplish a task in a desired way and each degree of freedom is actuated with feedback control. A prime mover, e.g., an electric motor, provides torque to move a degree of freedom based on a compared referenced input (e.g. a position).

Statement of the Problems

The project activity attempts to develop of a control hardware built upon a master-slave distributed control architecture for position control of DC motors using several Arduino microcontrollers, where, a closed loop PD controller is implemented for each motor in the respective Arduino microcontroller configured as a slave. The individual motor position is sensed by an incremental digital encoder and read in the quadrature mode by an individual Arduino microcontroller as a slave. A master microcontroller generates the user-defined reference position and sends it to the individual slave position controller, which works on the error between the current encoder value and the set position and the controller eventually generates PWM signal based on the error to drive the DC motor through an H-bridge motor driver.

Objectives of the Research

The objective of this project activity is to study and develop a distributed control hardware for a mechatronic system with multiple degrees of freedom , actuated by DC motors, especially for use in the development of a variable stiffness actuator for a flexible-joint robot.

Overall objective

The overall goal is to study the features of the Arduino microcontrollers and to configure them as master and slaves for a distributed motion control hardware mechanism with multiple degrees of freedom . It consists of the following objectives:

  • Study Arduino Nano, Uno, and Mega microcontrollers.
  • Explore the principles of incremental encoders and the method of obtaining encoder values in quadrature mode, program for it in microcontroller and arrive at the method to compute velocity.
  • Study and implement PD control algorithm in Arduino microcontroller.
  • Study and implement I2C communication among master and slave Arduino microcontrollers to pass the signals and monitor status.

Scope

The scope of the project was confined to the basic study of the Arduino microcontrollers, encoder principles, programming for the controllers and preliminary hardware implementation for position control of two motors to be used for a single flexible joint of a compliantly actuated robotic arm.

LITERATURE REVIEW

Information

There are various types of controllers used in industry, laboratory, and robotic applications. Some of the commonly used controllers are on/off, PID, fuzzy, and neural. The latter two are a bit complex, and use more sophisticated concepts like artificial intelligence. The controllers can also be differentiated as feedforward and feedback controllers. The feedforward controller works by giving a result based on the anticipation of the next step, while the feedback controller works by giving an observed result that changes the processing value of the later step. In this project, the entire focus is on the feedback control system that uses the PID algorithm.

Optical[1] encoders are widely used to apply feedback control on motion systems where the motion is measured at a fixed sampling frequency. They are available in both rotational and linear forms. The position accuracy is limited by the quantized position measurement of the encoder i.e. it is limited by the number of slits on the encoder disk. The quantization error is reduced by using more expensive encoders with more increment at the expense of increased cost price. Velocity and acceleration information is often obtained by numeric numerical differentiation of the quantized position signal. Direct differentiation mostly leads to signals that are not useful. The quantization errors limit the performance in high accuracy control applications. Smart signal processing techniques can be used in combination with cheap low resolution encoders to obtain position estimations with the same accuracy as expensive high resolution encoders.

The research paper[2] discusses the control applied to wireless communication. The paper proposes the acquisition, tracking, and pointing system for free space laser communication to improve the misalignment issues in Free Space Optical Communication. It detects the image of the laser beam using a CCD sensor array while the central detection is employed to find the location of the image. An SLFC is used to derive the fast-steering mirror mechanism to point the laser beam on the receiver for coarse and fine tracking. The SLFC controls the two DC motors for controlling the fast-steering mirror mechanism.

The authors in [3] describe a method for the position control of the motor. The proportional gain, or, Kp takes into account the present error only. The P-Term calculates the proportion to how far the process variable is from the set point now. However, approaching closer to the set point, the error becomes so small that the controller cannot trigger the process variable enough to catch the set point, which implies that there always exists a steady state error, which appears as an offset from the set point in the system. However, a larger value of the proportional term can trigger the process variable to the set point, but it makes the system unstable with oscillations and overshoots. Thus, the controller’s response in such a case is more like the response coming from an on/off controller. Thus, the P-controller alone is not sufficient for most control designs.

P-Term = ????????.  e  (t)\operatorname{????}\operatorname{????}.\;e\;(t)

where, ????????\operatorname{????}\operatorname{????} = Proportional constant and e (t) = error at the time “t”.

The integral term Ki takes into account all the errors present in the system from the starting point to that particular point of time in the process. It looks at the history of the error until the specific point. Introduction of Ki increases the order of the system. That is the reason why large integral gain may destabilize a controlled system. It is required to recheck for stability after introducing Ki term.

I-Term = 0T  ????????.  ????(????)????????\int0T\;\operatorname{????}\operatorname{????}.\;\operatorname{????}(\operatorname{????})\operatorname{????}\operatorname{????}

Where Ki  Integral gain and t = total time of operation of the controller.

The derivative term, or, Kd takes the derivative of a PV of the system at every point. Thus, it predicts the future of the operation of the PID loop (this loop is an operation of the PID controller for each iteration). The purpose of this term is to check how the process variable moves without overshooting the set point. The D-Term acts on the PI terms by counteracting them. As the PV approaches the set point, the PV settles with the set point with a small or no overshoot.

D-Term = ????????.\operatorname{????}\operatorname{????}​. de(t)dt\frac{de(t)}{dt}

Where Kd = Derivative Gain Constant and ​ de(t)dt\frac{de(t)}{dt}​ is the rate of change of error.

The overall control function can be expressed mathematically as u(t)=Kp.e(t)+Ki.0τe(t)dt+Kd.de(t)dtu(t)=K_p.e(t)+K_i.\int_0^\tau e(t)\operatorname dt+K_d.\frac{de(t)}{dt}

where Kp, Kd, and Ki all non-negative, denote the coefficients for the proportional, integral and derivative terms respectively (sometimes denoted PI, and D). In the standard form of the equation Ki and Kd are respectively replaced by  KpTi\frac{K_p}{T_i} and  Kp.TdK_p.T_d; the advantage of this being that  Ti and Td have some understandable physical meaning, as they represent the integration time and the derivative time respectively.

Summary

The use of PID controller in diverse applications is studied with the realization of the interplay of the Arduino interfaced with technical computing language and the basic understanding about the signals. The latter gives an idea about the measurement and control of the signals. The overwhelming role played by the PID controllers while using sophisticated controllers, like fuzzy and neural controllers, is recognized. The fuzzy controller uses the PID controller in the beginning to control the system until the fuzzy controller finds the pattern of the system. The significance of the widespread applications of the PID controller from different regimes is understood from the literature.

DESCRIPTION OF HARDWARE SETUP

ENCODER

An encoder is an electromechanical device that can measure motion or position. Most encoders use optical/ magnetic sensors to provide electrical signals in the form of pulse trains, which can, in turn, be translated into motion, direction, or position. In incremental encoders (optical), slots are provided which allow light to pass in equal intervals to produce digital pulses.

An encoder with one set of pulses would not be useful because it could not indicate the direction of rotation. Using two code tracks with sectors positioned to 90 deg out of phase as shown in Figure 1, the two output channels of the quadrature encoder indicate both position and direction of rotation. If A leads B, for example, the disk is rotating in a clockwise direction. If B leads A, then the disk is rotating in a counter-clockwise direction. Therefore, by monitoring both the number of pulses and the relative phase of signals A and B, both the position and direction of rotation can be tracked. Figure 3 shows a commercial Rotary Encoder.

For Rotational Position (0)=EdgeCountxN3600(^0)=\frac{Edge-Count}{xN}\ast360^0

Where  N = number of pulses generated by the encoder per shaft revolution                       
x = encoding type

For Linear Position (in)=EdgeCountxN[1PPI](in)=\frac{Edge-Count}{xN}\ast\left[\frac1{PPI}\right]

Where PPI = pulses per inch (a parameter specific to each encoder)

1.jpg
    Pulses on Channel A and Channel B
    2.jpg
      Inside Circuit of Rotary Encoder
      3_1.jpg
        Commercial Rotary Encoder

        ARDUINO MICROCONTROLLER

        It is an open source platform with easy to use hardware and software. Arduino has a programmable circuit board and a piece of software (Arduino IDE). It uses a simplified version of C++, which is user friendly and easier to learn. It is known for its rapid prototyping. It comprises a programmable board and an IDE (Integrated Development Environment) that runs on a personal computer. It is widely accepted because of its simplicity of the development and programming syntaxes. Arduino has an inbuilt framework which allows a user to develop a working application without prior knowledge of hardware, in contrast with most embedded firmware. This is all possible because of the use of simplified version of the C++ language, making it easier to develop Arduino application. In addition, there are huge number of third party libraries and example codes that gives quick interaction. Arduino does not need any other hardware to load code.

        6.png
          Arduino  Board

          It has a set of circuit boards and IDE used to program the board. Different Arduino boards have different computational capabilities and different I/O devices. Arduino UNO with an AT mega 328P microcontroller has 16MHz, 14 digital I/O pins and 6 Analog inputs. Similarly Arduino DUE outperforms UNO as it has 32 bit Atmel SAM3X8E ARM Cortex – M3 microcontroller running at 84 MHz and has a greater number of I/O pins.

          Arduino offers simple programming which has two basic functions, setup ( ) and loop ( ). Function setup ( ) has codes which are executed when Arduino is powered on. Function loop ( ) contains code which are cyclically repeated indefinitely. These form the global data structures and are the part of the main file. Arduino has inbuilt standard libraries to support users in writing applications.

          The Arduino Uno can communicate with a computer, another Arduino or other microcontrollers. The AT mega 328P supports UART TTL (5V) serial communication, which is accessible through RX and TX pins. An FTDI (Future Technology Device International) on the board helps writing on the computer, which appears as a virtual com port. The RX and TX LEDs on the card flash when USB is transmitting data.

          5.png
            Arduino IDE Platform

            Interrupt is a function, which provides multi-tasking and multi-processing. It is a signal that prompts the operating system to stop working on the ongoing task and acknowledge the interrupt. It should have an ISR (Interrupt Service Routine) which dictates the code to go when the interrupt condition is met. It has different Interrupt modes, which determines what pin action triggers.

            • Rising - activates on rising edge
            • Falling – activates on a falling edge
            • Change – activates on any change in the interrupt pin
            • Low – activates when pin is low

            In this project, RISING is used as the interrupt mode. When writing an Interrupt Service Routine (ISR), the following should be taken into account:

            • Keep it short
            • Don’t use delay ()
            • Don’t do serial print ()
            • Make variables shared with the main code volatile
            • Variables shared with main code may need to be protected by “critical sections”
            • Don’t try to turn interrupts off or on

            Variables shared between ISR functions and normal functions should be volatile. This tells the compiler that such variables might change at any time, and thus the compiler must reload the variable whenever we reference it, rather than relying upon a copy it might have in a processor register.

            The encoder position and velocity data can be stored in the inbuilt EEPROM in Arduino. EEPROM stands for Electrically Erasable Programmable Read-Only Memory. The microcontroller used in the project has 1024 bytes of EEPROM, which may vary up to 512Kb in DUE. This memory is non-volatile which means data is not erased when the board loses power. The stored data can be used for various purposes. EEPROM is specified to handle 100,000 read/erase cycles. Each write takes 3.3ms. Only the numbers from zero to 255 are allowed. Intelligent coding that knows the size of the data type, can work around the restricted memory. (Used four-memory space to store a single Encoder value which decreases the memory space by 4)

            Since the EEPROM memory is insufficient for our task we used a software, TERATERM, to stored the data in MS-EXCEL and did operations on the data. However, while using TERATERM, the serial monitor of Arduino cannot be accessed. So TERA TERM is used only for storing data and offline calculation.

            DC Motors and Motor Drivers

            Motor converts electrical power to mechanical power. It has some unavoidable losses, which are divided into frictional losses, winding losses and iron losses. The motor we used is maxon motor, which has precision and does not have iron losses, as it is coreless.

            Maxon Motor is a supplier of high precision drive systems of up to 500 W. The company develops and manufactures brushed and brushless electric DC servomotors as well as corresponding encoders, gears and control electronics. The motor we used has a gear ratio of 103:1. Rated voltage 48 v and maximum current is 1.4A.

            maxon_145375_b_1.jpg
              HEDS Optical Encoder

              Desirable features of a DC motor to be used in servo mechanisms are:

              • No magnetic cogging
              • High acceleration by minimizing rotor inertia
              • Low electromagnetic interference
              • Low inductance
              • High efficiency
              • Linearity between voltage and speed
              • Linearity between load and speed
              • Linearity between load and current
              • Small torque ripple by providing multi-segment commutator
              • Ability to bear high overloads for short periods
              • Compact design - small dimensions
              mm_1.JPG
                Maxon Motor

                L298 Motor Bridge IC

                An H-Bridge is an electronic circuit that enables a microcontroller, to control the movement of a motor. A microcontroller cannot be connected directly to a DC motor because the microcontroller cannot supply the high current required by the motor. The H-bridge contains the high-current switches needed for motor control. These switches are controlled by signals from Arduino. An H-bridge allows a motor to be moved forwards or backwards. The direction is determined by the sequence of control signals from the Arduino.

                Motor speed is determined by setting the duty cycle of the control signals. This type of speed control is called pulse-width modulation. The motor will run at full speed when the duty cycle is 100%. When the duty cycle is 0%, however, the motor will stop and will no longer move.

                A very popular and reasonably priced all-in-one H-bridge motor driver is the L298. It can control two motors. It can handle 2 amps per motor. There are three input pins for each motor: Input1, Input2 and Enable1 control Motor1. Input3, Input4, and Enable2 control Motor2.

                7_1.jpg
                  L298 Motor Driver
                  Input and Action
                  LOWLOWMotor breaks and stops
                  HIGHLOWMotor turns forward
                  LOWHIGHMotor turns backward
                  HIGHHIGHMotor breaks and stops

                  I2C: Inter Integrated Circuit Communication

                  Inter integrated Circuit commonly abbreviated, as I2C is a protocol that allows multiple slaves to communicate with one or more Master. It is meant for short distance communication within a single device. It requires two signal wires to exchange information. It consists of two signals: Serial Clock Line (SCL) and Serial Data (SDA). SCL is the clock signal, and SDA is the data signal. The current master generates the clock signal but some slave devices may force the clock low at times to delay the master sending more data.

                  I2C uses open drain pins. Bus signals are actively pulled down while communicating, and are only passively pulled up by the pull-up resistors on each line. Therefore, the rate of a voltage transition from a logic low to high depends on the resistance value and the capacitance of the signal line. The maximum number of devices on a bus is limited by the capacitance value on the SDA and SCL pins. It is also dependent on the pull up resistance values on the SDA and SCL lines. 4.7 K ohms pull is used in the lines. Therefore, I2C port is capable of data transfer rates of up to 100 KHz.

                  The maximum bus length of an I2C link is about 1 meter at 100K baud and 10 meters at 10K baud. The easy implementations come with the fact that only two wires are required for communication between up to almost 128 (112) devices when using 7 bits addressing and up to almost 1024 (1008) devices when using 10 bits addressing. 

                  Before deciding on I2C we must compare it to the other available options to see how it differs.

                  Serial ports are asynchronous so the two devices must also have the clocks that are close to the same rate and they require hardware overhead- the UART at either end and is difficult to implement in software. Here, one start and stop bit is required for each frame of data, meaning that 10 bits of transmission time is required for 8 bits of data sent, and it eats into data rate. Another core fault in it is they can communicate between two, and only two devices.

                  I2C requires only two wires, like asynchronous serial but can connect up to 1024 slave devices. In addition, it can support multi-master system, allowing more than one master to communicate with all devices on the bus. Here only one extra bit of Meta data must be transmitted. 

                  PROTOCOL:

                  Communication via I2C is more complex than a UART or SPI. Communication must adhere to a certain protocol for the devices on the bus to recognise it. Most devices take care of all the complicated details, allowing concentrating on the data to exchange. Information are broken up in two frames, an address frame and one or more data frames. Data is placed on the SDA line after SCL goes low, and is sampled after the SCL line goes high. The devices on the bus define the time between clock edge and data read/write.

                  ADDRESS FRAME:

                  The address frame comes first in any communication sequence. For communicating to a 7 bit address slave, the most significant bit (MSB) first consist of the address, followed by R/W bit for indicating a read or write operation. NACK/ACK is the 9th bit.

                  DATA FRAME:

                  Data frame is sent after the address frame has been sent. The master generate clock pulse and data are placed at the SDA and read, write master does operation, or slave as per the operation. The number of data frames can be arbitrary.·

                  METHODOLOGY

                  Concepts

                  The objective of this project is to make a hands-on study to develop a distributed controller hardware architecture for motion control of dc motors with encoders as position and velocity feedback sensor. For the purpose, Arduino microcontrollers are used. In the following a description of the method is delineated.

                  Methods

                  The first step is the studying of quadrature encoder, the different types of encoder incremental, absolute. A simple rotary encoder is taken and is configured with Arduino programme so as to count the number of pulses moved by the rotary encoder up to certain revolution. Upon implementation the rotary encoder is either coupled with a rotating device or is moved manually. It is done in order to count the number of pulses moved by the rotary encoder. By proper normalization the pulses are mapped to degrees and hence the degrees of rotation of the rotating device is obtained by the use of rotary encoder.

                  11_1.jpg
                    Encoder interfaced with Arduino

                    Position and velocity measurement of the rotary encoder. The number of pulses moved by the rotary encoder is utilized to measure the velocity and encoder position of the encoder in particular and the rotating device in general. As previously explained the pulses are normalized to degrees to obtain their position. The original position value is subtracted from the present position value so as to obtain the reference position. The time at the instant of original position and present position are measured using the millis () function in Arduino to obtain the original and present time respectively. The reference position divided by the difference of original time and present time gives us the velocity of the encoder. Using the moving average method the velocity was averaged and calculated. Thus the position and velocity measurement is achieved.

                    Rotation of DC motor as per user input. After testing the rotary encoder, the next step is to give a user input of number of pulses and the motor rotate as per the number of pulses given by user. Although the objective was achieved but there were some complications which were needed to be removed in the long run. Once the pulses are set, the motor rotates until the set point is reached. After the set point is achieved, because of inertia the motor continues to rotate and ultimately stops because of dissipative forces. However, it is desired the motor to stop at exactly the set point. Otherwise the system is quite unstable. Soon after the motor crosses the set point the motor oscillates before it stops which is anyway not desired. Then comes the implementation for PID control.

                    PID control of motor. The first step is PID control of a normal DC motor. The DC motor has a rating of 500 pulses per revolution, 12 Volts.   The following procedure is adopted in tunning the PID controller. First, for a step input, the Kp value was increased till a overshoot occured and the motor ust started oscillating. Then Kd was introduced and adjusted to stop the oscillation. This way , the system was made just little overdamped. Introduction of Kd resulted into a steady tate error. To reduce the steady state error, sometimes,Ki is introduced. Howeve introduction of Ki increases the order of the system and hence it may result into instability. This only happened here and later Ki was removed from the controller. However, the system becomes more unstable. Thus, the Ki constant is neglected for this case. The exact values of Kp, Ki, Kd can be calculated by modelling of the motor. All the three constants are system parameters that is they are dependent on the modelling of the system. Thus by the exact values of the three constants the oscillations in the system reduced considerably. Other small problems are explained later.

                    PID control of maxon motor. The major problem that is observed in PID control of a DC motor is its oscillation and the smoothness with which it runs.    The maxon motor is rated at 103000 pulses per revolution which increases its resolution.   As done previously, Kp, Ki and Kd values are chosen by hit and trial method. Introduction of Ki makes the system unstable. So Ki is neglected. Although considerable stability is obtained but with exact values of Kp, Ki, Kd the system has near zero steady state error.

                    How does Serial.print() affects the output of the system?

                    The Serial.print() statement itself takes considerable time to get executed. In position control of a motor, until the set encoder position is reached the motor keeps moving. Now since Serial.print() is time consuming to execute it may happen some of the encoder positions might be skipped. And hence the motor takes more time to stop in that case. The same is observed in this project. If the Serial statements are removed the motor takes less time to stop. Hence we try to minimise the Serial statements as much as possible. The second difficulty arises in the case of loop execution. It is found that a much part of the loop execution time is consumed by the Serial statements itself. So to decrease the loop execution time it is needed to minimise the Serial statements again.

                    Two-maxon motor with encoder embedded within it and three rotary encoder. A integer value greater than 255 as the data are sent at a stretch is 8 bit which corresponds to 255 in decimal cannot be send directly. The data are sent using I2C protocol.To tackle this a string is used to store the float value and then one character each time is sent and at the receiving end, the character received are assembled to form a string. Now using the Arduino in built function string.tofloat () the string is converted to float value. (The sending data size or number of bytes to be send need to be specified in the code and same for the receiving side i.e. how many bytes master will receive need to be specified in the master code).

                    14_1.jpg
                      Circuit diagram for I2C communication using 1 master and 5 slaves

                      RESULTS AND DISCUSSION

                      Purpose

                      Quadrature Encoding

                      Quadrature Encoders are a type of incremental encoders which are used to know the direction of motion and the degree of rotation of a rotating device. A quadrature encoder has a code disk which has two channels namely channel A and channel B. depending on the direction of motion either channel A leads channel B or channel B leads channel A.

                      22.jpg
                        Quadrature Mode of Operation

                        As it can be seen in the Figure11 in the first case channel A is leading channel B. the tracks (channel A and channel B) are coded 90 degrees out of phase and that gives the quadrature encoder its functionality. When more accuracy and precision is required the counter in the encoder may be coded to count the leading as well as trailing edges which doubles the pulses per revolution.

                        Velocity Computation

                        The velocity computation is performed using the running window technique. The running window technique is a simple yet a very effective tool in obtaining near accurate values of the velocity of the rotating device through the quadrature encoder. In this method, for every consecutive encoder position obtained through the micro-controller, the time gap was also obtained (using the millis () function in Arduino for our case). The change in encoder position divided by the time gap would give us the instantaneous velocity of the encoder. This velocity value is sent to an array of a particular size (say n). The array stores the last n velocity values obtained. The average of this n values would give us the resultant velocity. On the increasing the value of n the computation method becomes more accurate.

                        first.png
                          Velocity and Encoder position of a motor rotating at constant speed

                          A 48V maxon motor(103000 pulses per revolution) is operated at 12V. In this operation the maxon motor is under closed loop condition with no PWM input to the motor driver and is directly fed from the supply voltage. As expected the motor runs at constant velocity and as can be confirmed from the encoder position vs time plot the slope of the plot is almost constant thus confirming our constant velocity assertion as shown in figure 12.

                          The following plots are the characteristics of the maxon motor for different values of Kp and Kd per single revolution. The maxon motor is given a user input to rotate 360 degrees. Depending on Kp and Kd values the maxon motor settling time was noted.

                          sec.png
                            P controller with Kp=0.8 for AntiClockwise Rotation 
                            third.png
                              PD controller with Kp=0.8 and Kd= 0.5 for Anticlockwise Rotation

                              In the Figure 14 it can be seen that the quadrature encoder takes around 4500 ms to reach the user input of 360 degrees i.e. one revolution. But it takes more 500-600 ms to reach steady state. So the next step is to check with other values of Kp, Kd and see if it settling time.

                              With only P controller in Figure 13 the motor takes even more time to settle although it has reached the desired position (near to 360 degrees) at almost the same time. Thus for anticlockwise rotation PD controller has better controllability than P controller.

                              four.png
                                P controller with Kp=0.8 with Clockwise Rotation
                                five.png
                                  PD controller with Kp=0.8 and Kd=0.5 for Clockwise Rotation

                                  Similarly like anticlockwise rotation it is done for clockwise rotation with different values of Kp and Kd. The plot in Figure 16 has both Kp and Kd values and it takes around 8000 ms to settle.

                                  This plot corresponding to Figure 15 with only Kp value of 0.8 and it is seen from the plot that it has higher settling time than PD controller. So from these plot it is ascertained that PD control works better than P controller.

                                  IMG_20180713_114253_202_2.jpg
                                    Setup with 1 Master and 5 Slaves(3 position encoders and 2 motors). 

                                    CONCLUSION AND RECOMMENDATIONS

                                    Conclusion

                                    This project provided a scope for hands on experience in motion control of a DC motor. The controller implemented was a close loop feedback control system. The system hardware consisted of two DC motors with integrated incremental encoders and three other independent incremental encoders. A study on the components of a feedback control system was carried out first, such as DC motors as prime movers and encoders as feedback position sensors and Arduino microcontrollers were studied, configured and programmed for the encoder reading, velocity computation, controller (PD) implementation and generation of controlled commands for driving the motors. First of all, the principle of position reading from an inremental encoder was made and then implemeted on a microcontroller. Then, Arduino Nano boards configured to read three independent encoders. Two more Arduino Uno boards were configured as closed loop position controller for the two motors with integrated encoders, where, the encoder readings were implemented within the same microcontroller. The choice of Kp and Kd plays a crucial role in settling time of the motor. The encoder should have a good resolution for better controllability and result. All the slaves were connected to the master through I2C communication. The master had to wait for a fixed time duration to get next reading from the same slave as it had to ping sequentially. The Arduino Uno has a processor of 16 MHz which comparitively slower processing time than Arduino DUE with processor of 84 MHz and real time implementation require extensive use of DUE.

                                    Future work

                                    Future work will attemt to develop a realtime cotroller, built upon Arduino Due boards, where, the timed loop will ensure a deterministic fixed control rate. Syncronization of clocks of all the microcontrollers had been an issue, which will be attempted to be reslolved for real time operation of the distributed controller.

                                    REFERENCES

                                    [1] R.J.E Merry, M.J.G van de Molengraft, M. Steinbuch, “Velocity and acceleration estimation for optical incremental encoders”, ELSEVIER.

                                    [2] Premeaux, E., & Evans, B. (2011). Saving the world. In Arduino Projects to Save the World, Spider temp. Berkeley, CA: Apress.

                                    [3] Alvi, B. A., Asif, M., Siddiqui, F. A., Safwan, M., & Bhatti, J. A. (2014). Fast Steering Mirror Control Using Embedded Self-Learning Fuzzy Controller for Free Space Optical Communication. Wireless Personal Communications, 76(3), 643-656.

                                    ACKNOWLEDGEMENT

                                    I am highly obliged to Prof. (Dr.) H. Hirani, Director, CSIR-CMERI for providing this opportunity to carry out my project work. I would like to express my deep sense of gratitude to Indian Academy of Sciences for providing me a golden opportunity to carry out this project. I owe my heartiest gratitude to respected Dr. Soumen Sen, Senior Principal Scientist, R&A and Dr. Aman Arora, Scientist, R&A , CSIR-Central Mechanical Engineering Research Institute, Durgapur for their critical supervision, advice, excellent scientific guidance and constant encouragement throughout my internship period.

                                    I would like to extend my special thanks to all of the technical staffs of the Robotics and Automation Group. It is my privilege to express my profound regards and deep sense of gratitude to Prof.Asim Kumar Naskar, Department of Electrical Engineering, National Institute of Technology, Rourkela for providing my letter of recommendation to Indian Academy of Sciences.

                                    I would like to express my deepest sense of gratitude towards my beloved parents who have supported me with their valuable suggestion and guidance.

                                    APPENDICES

                                    Datasheets

                                    arduino.PNG
                                      ATmega328P Datasheet

                                      encoder.PNG
                                        Encoder HEDS 5540 Datasheet

                                        rotary encoder.PNG
                                          E50S Incremental Rotary Encoder Datasheet

                                          L298.PNG
                                            L298 Datasheet 

                                            This is a joint report being submitted with Subham Panda under the summer internship program.

                                            More
                                            Written, reviewed, revised, proofed and published with