



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Class: Senior Design Project Lab; Subject: Electrical and Computer Engr; University: University of Illinois - Urbana-Champaign; Term: Fall 2005;
Typology: Study Guides, Projects, Research
1 / 35
This page cannot be seen from the preview
Don't miss anything!




























By Alexander Gray Shaurya Mehta ECE 445, SENIOR DESIGN PROJECT FALL 2005 TA: Wayne Weaver 6 th^ December 2005 Project No. 6
We designed and created an easy-to-use DC Motor Controller primarily for robotics applications. It aims to provide accurate position, velocity and torque control. Our design integrates the entire drive module including the motor, power amplifiers, gearing, sensors and basic control functions. We created a simple interface which makes the controller useable with advanced robot control algorithms implemented on a computer. Under manual control, the user inputs commands using the keyboard of an external PC and can see the operation results on the PC monitor. A microcontroller based PID loop is used for each control mode. The project is fairly accurate, fast, ready-to-use and user-friendly. We believe that such a device could significantly simplify the design and manufacturing of industrial and experimental robots. ii
1.1 Purpose Robotic manipulators and similar systems require precise and often relatively powerful drive motors and control systems, which can be a major part of their design processes. We have endeavored to create a user-friendly drive module integrating the motor, power amplifiers, gearing, sensors and basic control functions, which can be interfaced to a personal computer. We believe that such a device could greatly simplify the design and manufacturing of industrial and experimental robots. 1.2 Functions Most modern robotic arms use advanced control algorithms incorporating the dynamic properties of the robot to compute the joint torques needed to track a given trajectory. As a result, torque regulation is a major feature of our system, and the data from the sensors is passed on to the user’s PC for use in their control scheme. We have also provided a basic PID controller for shaft position and velocity, largely for non-manipulator applications due to serious stability and tracking problems which arise when one does not consider the arm dynamics. The power amplifier section has been designed to reliably operate at 24 volts and 80 amps, with protection against interference and voltage spikes from the motor and against accidental over-current conditions. 1.3 Specifications The motor controller is intended to provide at least 1.5KW of electrical output and about 1KW peak mechanical output, corresponding to 62.5 amps at 24 V. Because of the high currents being switched and noisy nature of dc motors, we paid attention to circuit protection features. These include safeguards against overcurrent, shoothrough, voltage spikes, and electromagnetic interference. The maximum position control accuracy is 1.4 degrees at the motor shaft, because of the encoder resolution. We hoped to reach this, at least with the motor unloaded. Our minimum speed control accuracy target was 10 RPM. The theoretical maximum current control accuracy is about 0.2 A given the current sensor’s resolution (25 mV/amp) and the PIC’s ADC resolution (5 mV), corresponding to about 0.1 Nm. Our actual target was 1 A / 0.5 Nm for torque control. Our targets for unloaded response time were roughly 1 second for any position within one revolution, 150 RPM per second for velocity. In theory, it should be relatively easy to reach any torque quickly, but our rough target is 0.1 second (limited by the LR time constant of the motor to something like .03 second). Note some of these values are different from those stated in the design review, having been scaled to match a new motor. The performance specifications for the different control modes are summarized in Table 1.3.1.
Table 1.3.1: Performance Specifications Feature Accuracy Response Time Position Control 1.4º 1 sec Velocity Control 10RPM 150 RPM/sec Torque Control 1A 0.1 sec The user interfaces to the module via a Personal Computer. The inputs commands comprising of the mode, direction and the target values are entered via the PC keyboard. The controller in return will execute the command and display the subsequent sensor readings in a Hyper Terminal window of the PC. These results are decoded to a convenient format where appropriate. 1.4 Subprojects A block diagram showing all subsystems and interconnections can be seen in Figure A.1, in appendix A. 1.4.1 PIC 18F452 Microcontroller The microcontroller fulfills communications and most computation functions. It features an internal asynchronous serial receiver/transmitter module, which is used to communicate with the PC via a standard RS-232 interface. The control algorithm is a fully implemented PID controller, which gives us sufficient accuracy and response time. 1.4.2 MOSFET Driver The MOSFET Driver is an Intersil HIP4081A full bridge driver chip which receives logic-level signals from the PIC and converts them to the levels needed to drive the MOSFET gates. It includes a charge pump voltage booster with some logic and delay circuitry to reduce the chance of shoot-through, a condition where the H-Bridge becomes a short across the power supply and often fails catastrophically. Additional components control the gate turn-on and turn-off currents, and protect the bridge from various noise and voltage spike hazards. 1.4.3 H-Bridge The H-Bridge handles the actual transfer of current from the source to the motor. It consists of four power MOSFETs arranged so that the magnitude and polarity of the average voltage across the motor can be varied by switching the MOSFETs with a pulse width modulated (PWM) signal. 1.4.4 Current Sensor The current sensor is an Allegro ACS755-100 Hall effect current sensor. It produces an analog voltage output linearly proportional to the motor current with 2.5 V corresponding to 0A, 5V to 100A and 0V to –100 A. The current sensor is used for torque control and over-current protection. 1.4.5 DC Motor The DC motor is a DeWalt drill motor and matching gearbox, rated at 18V, 450 RPM, and 450 lb-in (50 Nm). However, it is run at 24V, giving a max speed of 600 RPM, and momentary torque over the rating was found to occur normally without damage.
2.1 Control Algorithm A standard proportional-integral-derivative (PID) control algorithm was used, although initially
e xd^ x (2.1)
to the motor, between 0 and 1. Ideally, this would be computed as: dt k e dt de u kp e kd i (2.2) However, due to the microcontroller’s limited math capabilities, the actual formula used was: n u (^) n kp en kd ( en en 1 ) ki e n (2.3) The coefficients k^ p , k^ d , and ki^ were selected by trial and error. Greater k^ p was used to decrease the response time, at the risk of overshooting the target and causing oscillation. k^ d was adjusted to regulate the rate of change in error, reducing overshoot at the expense of response time. k^ i served to eliminate the steady-state error that would otherwise be experienced, while increasing the settling time. The time step was ignored in the determination of the integral and derivative, but compensated for by the coefficients to reduce computation requirements. The final coefficient selections are shown in Table 2.1.1. The first microcontroller used lacked a hardware multiplier and commands for 16 bit math. As a result, the performance was very limited until a more powerful one with the above features was selected. Table 2.1.1: PID Coefficients and Control Mode update rates Mode Kp Ki Kd Update Rate Position 4.2e- 1/ deg 3.56e- 1/ deg.s 3.34e- s/ deg 6.1ms Velocity 1.47e- 1/RPM 4.04e- 1/RPM.s 1.09e- s/RPM 103.8ms Torque 1.57e- 1/Amp 3.64e- 1/Amp.s 3.38e- s/Amp 43.1ms
2.2 Serial Interface Standard RS-232 serial communications were found to be the most convenient method for interfacing to the PC. Since this protocol required different voltages levels than TTL logic, a MAX level-shifter chip was necessary. Standard DB-9 cables and connectors were used. Commands were sent in a four-byte format, the first indicating the mode, the second the direction, and two hexadecimal characters representing the target. Sensor data was outputted as three-digit decimal numbers separated by commas. Some error checking was performed on the input 2.3 Input Power Supply The system is intended to be operated from a 24 VDC source, typically batteries or an external ac-dc converter. The connection to this source is furnished with a large capacitor to reduce the voltage fluctuation when large current pulses are drawn, and a transient voltage suppressor (TVS) diode to clip voltage spikes coming from either the supply or the motor. This input voltage is used directly to drive the motor. The logic circuits require about 50 mA at 5 volts, and the gate driver IC require about 100mA at 12 volts. To provide these voltages, two switching regulators (buck converters) with 1A output were used. These devices are more powerful and sophisticated than necessary, but there was a concern that linear regulators would not be adequate. 2.4 Output Power Stage To operate a motor of the desired size, considerable current handling was required at the output stage of the controller. An H-Bridge topology was selected, using four switches to set each terminal of the motor to either the dc positive or negative rails. This configuration provides control over the average voltage across the motor terminals, over the range V^ sup ply. Due to the inductance of the motor windings, a roughly constant current flows through them and the bridge despite the pulsed voltage. To provide a path for this current when the low-side switches are off, both positive-rail switches are turned on, and parasitic diodes provide an additional, albeit higher-resistance path. Power MOSFETs were selected for the switches, because of their low losses compared to other available technologies (normal and insulated-gate bipolar transistors) in this range of voltage and current ratings. The main criterion in selecting a MOSFET, after the maximum voltage and current ratings, was the on-state resistance. This resistance determines the amount of power lost in the switch, and the amount of heat that must be removed. The power dissipated is given by: P I R on 2 (2.4) This power must be removed by a heatsink, and the actual maximum current handling is determined by the highest tolerable temperature increase and the thermal resistances between the semiconductor junction to the case, the case to the heatsink, and the heatsink to the ambient environment. on jc chs hs amb
2 max max max (2.5)[1]
2.5 Sensors A shaft encoder was used for sensing the position and velocity of the output shaft. The encoder with the highest possible resolution for a reasonable price was selected, as this resolution is the main limitation on the overall system’s precision. Quadrature outputs were also desired, so that the direction of rotation could also be sensed. This is done using an edge-triggered D flip-flop with one encoder channel as the clock and the other as the data input, so that the output indicated whether the second channel was leading or lagging the first (see encoder output waveforms in Figure B.12 in appendix B). The pulses of the encoder are connected to a counter IC, with the direction indicating whether to count up or down. Thus, the position is measured by reading the counter value, and the velocity by resetting the counter, waiting a given amount of time, and reading it. Because the torque produced by a dc motor is directly proportional to the current, it was measured by way of a current sensor. A relatively inexpensive hall-effect model was chosen, with an
with large current ripple (possibly arising from the motor’s commutator), a simple low-pass RC filter was placed in the line. A sample output is shown in Figure B.11, in appendix B. 2.6 Mechanical System The mechanical components include the motor, gearing, and mounting fixture. Robotic arms generally require relatively low speed and high torque, while dc motors are usually best when designed for high speed and low torque. This makes a fairly large gear ratio necessary. For manipulator applications, it was desired to have an output shaft speed of approximately 150 RPM, with a peak mechanical power around 1000 watts (1.33 HP). Originally, a typical motor with a top speed of several thousand RPM was selected, and the speed was to be reduced via two or three stages of gears or sprockets and roller chain. This approach proved to be complex and expensive, so a motor/gearbox combination intended for cordless drills was obtained to replace it. This solution is considerably cheaper, more compact, and better integrated than the alternative. The output of the gearbox is 600 RPM, which was used for testing purposes, but the mounting hardware was designed so that sprockets and chain can be installed for an additional reduction ratio up to 4:1. 2.7 Components The individual components selected based on the criteria described above are shown in Table A.1, in appendix A. 2.8 Electrical Schematics Schematics for the electrical subsystems are shown in appendix A. The voltage regulators, PIC, serial interface hardware, and shaft encoder logic are shown in Figure A.2, and the H-Bridge, gate driver, and protection circuitry are shown in Figure A.3. 2.9 PCB layout The layout of the printed circuit board is shown in Figures A.4 and A.5, in appendix A. Some connections were made with separate wires, notably the final connections from the drive circuits to the MOSFET gates. To make room for wide current-carrying traces, the gate and source leads of each MOSFET were bent up and connected to the top layer of the PCB, while the drain terminals went
through to the bottom layer as usual. Copper bus bars approximately 0.3” wide by 0.04” thick were soldered over the high-current tracks.
3.1.3 MOSFET driver and Power MOSFETs After constructing the entire power section, the gate driver IC was tested by monitoring its inputs and outputs with an oscilloscope. The low-side inputs to the driver are shown in Figures B.13 and B.14, and the high side inputs were tied to logic high. Outputs for each leg of the bridge are shown in Figure B.15 (these tested were done with the motor connected and loaded). The actual gate voltages for the above situation are shown in Figure B.16. As intended, the turn- on is relatively slow and the turn-off very fast. Finally, the motor terminal voltages are shown in Figures B.17 through B. 3.1.4 Shaft Encoder We observed the shaft encoder output on the oscilloscope to verify its correct operation. The encoder outputs two pulse lines with a frequency dependent on the motor speed. The two lines have a phase difference of 90 degrees. By observing the change in the encoder output and the corresponding motor speed we tested the functionality of the shaft encoder. Sample output is shown in Figure B.12. 3.1.5 Complete System Testing Once we verified the functionality and performance of the individual sub-systems, we combined all the systems to do overall performance tests. During this time we also tested the complete PID controller on the PIC 18F542. One of the challenges was to optimize the PID controller constant values, which was done by observing the performance results. This testing was done separately for each control feature (Position, velocity and Torque Control). A command was given to the PIC, and the returned sensor data was saved. For position mode we told the controller to go to a certain position (hex 0 through FF) giving us a resolution of 256 counts/revolution = 360 degrees/256 = 1.4 degrees. The controller would execute the command and return the actual position of the motor with an update period of 6.1ms. We would then save the data from HyperTerminal and put it into MATLAB to analyze the accuracy and the rise time of the operation. We did this for several input values. Two of the response curves from MATLAB are attached as Figures B.1 (small swing) and B.2 (large swing) in appendix B Similarly for Velocity mode we could tell the controller to run the motor at various speeds. The controller returns the actual speed of the motor on the Hyper Terminal screen at an update rate of 103.8ms. After transferring this data to MATLAB we analyzed the accuracy and response time of velocity control. Two of these graphs are attached as Figures B.3 and B.4 in Appendix B. For Torque mode we inputted several test values and the controller, using the current sensor, would return the actual current running through the motor to the Hyper Terminal screen. This data was once again fed to MATLAB in order to analyze the accuracy and response time of our torque mode. Two of these graphs are attached as Figures B.5 and B.6 in Appendix B.
3.2 Verification Conclusions The numerical performance results are show in Table 3.2.1. Evidently we achieved some of our targets and missed some. However, from the start we knew that a lot of these targets were basically theoretical limits and that achieving some and coming close to many meant that we were very happy with the end result. There are several improvements that we can make to further improve this project for e.g. using a better resolution encoder and current sensor, using a better microprocessor or possibly a DSP etc. We shall talk about some of these in the Conclusion of this report. Table 3.2.1: Performance Results Feature Desired Accuracy Desired Response Time Achieved Accuracy Achieved Response Time Ripple (typical) Position Control 1.4º 1 sec 2.8º 0.4 sec 0 Velocity Control
RPM/sec
RPM/sec
Torque Control 1A 0.1 sec 4A 2 sec 20%
In the end we were pleased with the results of the project. From the start we had set our goal very high by deciding to build a motor controller that could handle three different modes with very good precision and response. At all times we knew that implementing all three modes would be a great challenge. Given the aggressive performance level we were shooting for we knew that if we could come close to that then the project would be a success. We not only came close to most, but exceeded some of them as well which was very satisfying. A few aspects of the project were done particularly well. The user interface system was robust and user-friendly, and assembling the entire project on a single PCB made for a convenient plug-and- play product. Thus, in the end we are pleased with the result. However, we know there is plenty of room for improvement. Our torque mode is not very precise or quick and could use some improvements. This probably has to do with several factors like the noise from the motor, the update rate and the PID constants for the torque mode. We have a rough idea on how it can be improved further and are confident that given some time it can be fixed. Besides that there are several ways in which we can improve the overall performance of this project. For one, we could try to further reduce the noise level on some of the signals. This could be done by using better grounding practices. We are running high voltage and current levels on the board, so better isolation of the noise would definitely improve the overall performance. We could use some better and more expensive parts for the project. A higher resolution shaft encoder could have an immediate impact on the results. Also, a more precise current sensor could improve the performance. A high-speed DSP or microprocessor would likely improve the performance of the controller. We would be able do lot more computing and build a more sophisticated PID controller with higher update rates. In the future we could employ a better strategy to find the optimum constants for the PID controller. A self-learning controller would be ideal and would reduce the likelihood of instability under unusual loads. Based on the application, this motor controller can be adjusted in many ways to trade off cost with performance. In the end we settled for a balance and produced acceptable results.
APPENDIX A: Block Diagram, Schematics, Layout, Mechanical Diagram, Parts List The following is the overall block diagram of our controller. The shaded area is the internal block diagram of our PIC control logic. A/D Converter User Input via USART Asynchronous Receiver Data from Encoder PWM Converter MAX 232 MAX 232 Data to transfer to User via USART Asynchronous Transmitter Computing Algorithm
Power H-Bridge Current Sensor DC Motor Gearing Shaft Encoder Output Shaft PC* is the same PC Figure A. 1 : Block Diagram
Figure A.3: Power Section Schematic
Figure A.4: PCB Bottom Copper (Green) and Silkscreen (Yellow)