2009 Take Home System and Dynamics Lab Team Members: Mohd Azman Ab Aziz Ke Li Ilia Nikiforov Brian Ramnarain Chris Spartz Advisors: Traian Dumitrica Will Durfee SPONSOR: Department of Mechanical Engineering University of Minnesota 4/30/2009 2 Executive Summary The System Dynamics and Controls course (ME3281) at the University of Minnesota has, in recent years, issued each student a take home lab kit. These kits are educational tools that enhances the student's ability learn frequency response and PID control at their own pace and from the comfort of their home. These kits are inexpensive to produce and are designed to last at least four years. Over the years, these kits have become outdated and certain flaws have been discovered. The most serious issue was software compatibility, which prevented some students from being able to complete the lab assignments from their home computers. Therefore, one of the goals of this project was to make the software more compatible with Windows XP and Vista. Also, another requirement was that the software is easy and quick to install on most computers, which will increase the amount of time that the student has to complete the assignments. Cost also needs to be considered when redesigning the kit. If the previous kits were to be produced again, it would cost approximately $59.65 per kit, and the advisers for the project specified that the cost should remain less than $50 per kit, while retaining the same functionality. In addition to being inexpensive, the kit must also be reliable, because the kit must last at least four years. Also, in order to make the kit more portable for the students, a reduction in volume is desired. The proposed solution to the software compatibility issue was to write the software in MATLAB. Since MATLAB is free for students, most students already have it installed on their computer. The students will also become familiar with some of the many uses of MATLAB, which is a software that they will most likely encounter in their future courses and career. To reduce the cost, the potentiometer used to measure position was replaced with a Hall effect sensor. This was also expected to improve reliability, since it reduced the amount of mechanical components, which could wear over time. Also, the electrical circuit was made more compact, and a smaller motor was selected, which should decrease the size of the kit. Figure 2-1: Photo of the old lab kit Figure 2-2: Photo a prototype of the new lab kit After the new lab kit was designed, a prototype was built and the software was written. As expected, the software written in MATLAB became more compatible with newer operating systems. Also, the installation time was found to be less than 5 minutes. The new design was also costs $41.70, which is much less than the previous design. However, the volume of lab kit was not reduced enough to meet the goals of this project. In conclusion, the incoming ME3281 students can look forward to using a more reliable lab kit with improved software, which also reduces the expenses of the University. 2 3 TABLE OF CONTENTS 1 Title Page……………………………………………………………………………………………………………………1 2 Executive Summary…………………………………………………………………………………………………….2 3 Problem Definition 3.1 Problem Scope……………………………………………………………………………………..…………5 3.2 Technical Review………………………………………………………………………………….…………5 3.3 Design Requirements……………………………………………………………………………….……12 4 Design Description 4.1 Summary of the Design…………………………………………………………………………………14 4.2 Detailed Description 4.2.1 Functional Block Diagram………………………………………………………….….……16 4.2.2 Functional Description……………………………………………………………….………16 4.2.3 Overview Drawing…………………………………………………………………….….……28 4.3 Additional Uses………………………………………………………………………………………..……28 5 Evaluation 5.1 Evaluation Plan………………………………………………………………………………………..……29 5.2 Discussion 5.2.1 Strengths and Weaknesses…………………………………………………………………31 5.2.2 Next Steps…………………………………………………………………………………….……32 6 References ………………………………………………………………………………………………………….……32 4 3 Problem Definition 3.1 Problem Scope The ME3281 course has, in recent years, issued each student a take home lab kit in order to further their understanding of system control. These kits are cheap to produce and tend to last for three or four years. Over the years, these kits have become outdated and certain flaws have been discovered. The aim of our project is to create an updated lab kit to improve instructional value, reliability, compatibility, and ease of use. The scope of this project involves upgrading the current lab kit, software, and assignments to be used in the current classroom environment. 3.2 Technical Review Part 1 Engineering students in System Dynamics and Controls course (ME3281) use a take home lab kit in order to further their understanding of system control and also to gain intuitive sense of physical systems by exploring basic concepts through a hands-on experience that uses inexpensive and user friendly computer controlled hardware kits. Unlike traditional laboratory concepts, where students come to a designated laboratory room and perform experiments under teaching assistant supervision, the distributed lab has different approach. Each student works on a self-paced schedule at home and outside school time in much the same manner as a homework assignment, thus allowing the student to customize the laboratory experience to his or her learning style and pace. Exploring and understanding physical hardware individually results in a deeper and more intuitive understanding of the subject matter. Take-home lab kits provide same or better learning as traditional labs, but for lower cost and lower resource use. The lab kit covered concepts of PID control and frequency response using a small rotational mechanical system. The current kit is a second-order, rotary mass-spring-damper system. The rotary inertia is a commercial shaft collar connected to the rubber band which acts as the spring. The inertia is attached to the motor. The motor also drives a potentiometer using gears, used to read the angular position of the system. The inherent friction of the system approximates a rotary damper. The kit sends and receives data to and from a host computer running proprietary software with a simple GUI. Over the years, these lab kits have become outdated and certain flaws have been discovered. The flaws can be divided into two big groups, mechanical and software. The mechanical flaws are caused by many factors. For instance, trips from class to students’ houses 5 have caused some of the mechanical parts on the kit become loose and break. Furthermore, some of the parts need to be changed due to durability and reliability issues. For example, the rubber band loses elasticity after several years. The main software issue is compatibility. It was written several years ago, and distributed as pre-compiled executables. Incompatibilities with many windows machines have been found. Moreover, there is a calculation error in the current GUI which produces an incorrect result and units. The aim of our project is to create an updated lab kit to improve instructional value, reliability, compatibility, and ease of use. The scope of this project involves upgrading the current lab kit, software, and assignments; to be used in the current classroom environment. This is important because, to maintain their instructional value, the lab kits should perform as they were designed without any failures or major errors. The lab kits were designed to last for several years, so it is important that they maintain their integrity and at the same time help students understand the course. Part 2 To understand how the kits were first developed and how problems were solved before, all three generations of Distributed Lab were studied beforehand. First to understand the process was by understanding the design approach used to solve the problems; it was divided into three steps. The first was to understand the supervisory software, for current lab kit and all older lab kits, software were written in Visual Basic. A PC was used to set experiment parameters, viewing results, and to supervise other tasks. All software and parts for the lab kits were meant to last for several years and easily maintained or modified for updating. The host software was easily maintained through updates and downloadable by the student from course website. The second step was the controller board; a custom 2-sided printed circuit board containing a microcontroller that performs all real-time controls tasks, and a 10-bit analog-todigital converter for reading analog sensors and PWM outputs for driving a small DC motor. The board is powered by a 12 VDC, a wall plug power supply, which also provides power to the sensors and the motor. The third step was the dynamic system that the student tests, controls and observes. The dynamic system can be a mechanical system, an electrical system, a thermal system, a fluid system, etc. Sensors measure the system output and are used by the real-time controller and sent upstream to the PC for display, plotting and analysis. The dynamic system can be integrated onto the control board or be a separate unit that plugs into the control board. The first phase or Generation 0 of the distributed lab was started by a group of students enrolled in the senior design course in spring 2003, with Prof. Will Durfee as advisor. They were required to design and construct lab kit modules that students could used at home or the University computer lab to learn and to understand course concepts. The group completed three modules which were demonstrated at the Design show. These modules were: a mass, spring, damper (MSD) module for showing how system models and equations relate to the real world, this module is a classic representation of a mass, spring and damper system that can be excited using a motor to vibrate the mass for frequency response or can be excited manually 6 for step responses. Students can see a physical representation of their modeling equations, and observe a system in resonance. A linear Hall-effect sensor is used to detect the movement of the beam and then results are sent and displayed on the computer. The second module is an Audio Filtering Module (AFM) that allows a student to play sound files through various interchangeable filters. A Bode plot of the filter is displayed showing the various frequencies in the sound. Toggling a switch allows the student to quickly change between filtered and nonfiltered sound. It teaches first order RC filtering and clarifies cutoff frequency and roll-off. Lastly, a Position Control Module (PCM) is a motor control kit, allowing a student to perform PID control on a simple system. The effects of adjusting Kp, Ki, and Kd can be both seen and felt (by holding the disk). Students can adjust the input knob to allow for reference tracking, and also have the option to give the system a step input. Over, under, and critically damped systems are all obtainable, as are unstable systems. The drawback of all three modules are, its need for a PIC Box which is used to interface the modules to the computer running Visual basic. The box has a serial cable running to the computer, a CAT-5 cable to connect to the module, and a power jack that supplies the power to run the PIC as well as the connected module. Figure 3-1: The speaker (audio filtering) module and the position control module 7 Figure 3-2: The mass spring damper module Figure 3-3: The PIC Control box. This box was the link between the modules and the computer, and housed the PIC chip, motor controller, and other electronics. After Generation 0, Generation 1 was designed by a graduate student, David Waltzko, as his Master Thesis project. At this point, the three modules underwent extensive review. The only module studied from generation 1 is MSD module, this module was constructed based on a quarter car model. The module is driven by a motor spinning a disk to which an offset link is attached. This link is attached to a slider on an aluminum rod. As the motor spins, the disk turns and causes the link and slider to move up and down 1cm vertically. The frequency of the motor is adjustable by the student and determined by a photo reflector which detects the metal link as it passes by. Thus, each pass of the link is counted as one revolution of the disk, and the frequency can be determined. The slider driven by the link acts to simulate the road that the car drives over, and the faster the motor is driven, the more bumpy the simulated road. Next, the first spring, which represents the springiness of the tires they when come in contact with the surface of the road. Above that is the first mass, which represents the weight of the tires and suspension system. That first mass consists of two cylinders which are press fitted together with adhesive. The second spring simulates the spring in the suspension, while the top mass is the mass of the car. A piece of foam is affixed to the top of the second mass in order to represent the damping elements in the suspension. The amount of damping can be adjusted by placing rubber bands on the foam to control how tightly the foam presses against the top cylinder of the first mass. Connected to each mass is a ring magnet. Using Hall Effect sensors mounted to the PCB, the position of the masses can be determined, and then sent to the computer for the student to see. Based on the instructions, or simply to experiment on 8 their own, various combinations of springs, masses, and damping elements can be added or removed by the students, and then excited by the motor. The only problem with this module is the dimension of the module; the PCB board was attached perpendicular to the module base which makes the size of the module larger than any other module build so far. Figure 3-4: Photograph of the Mass Spring Damper module Generation 1 has provided a great deal of information which can be used to improve the next generation lab kit, from determining which concepts to focus on, to designing inexpensive modules that still perform like ideal systems and also what type of position sensor should be used. There are several suggestions made by David in his master’s thesis for further improvements and features which could be added to the module. For example, next generation kits should have an automating calculation of the spring constant Graphical User Interface (GUI) which before was calculated manually by students, additional inertias to the modules which 9 help students understand the effect of moment of inertia to the systems, gears that are adjustable which could be used as new activity in the new lab assignments, expanded data export features of the module, and incorporation with Matlab. He also suggested developing a non-linear model in Matlab, which will be used to study the module and discover ways in which to improve it before the actual module is built. Furthermore, he suggested students and professors surveys, given after module distribution will likely gain some new information that will yield new additional improvements. This year project is a continuation of improving the distributed lab from Generation 2, which was the improved version of Generation 1. Due to the desire to optimize the FR/PID module, work on the audio filtering module was put off for a later time. The largest change was that the MSD module was combined with the Position Control Module. The combination of these two modules creates the Frequency Response/Proportional-Integral-Derivative Control (FR/PID) module and no PIC box needed for connecting the module to host PC. Generation 2 FR/PID is extensively used as a reference by us to solve given problems. Improvements and adjustments were made by studying the previous generation 0, 1 and 2 and as David suggested, a simulink model is used to verify that the module is performing as it should before the final module is approved. The model is created based on the system’s mechanical and electrical equations. Figure 3-5: The Frequency Response/ PID Module Quanser Inc and Educational Control Product (ECP) are some of the examples of commercial modules available that serve a similar purpose to this project. Quanser builds a rotary control kit which physically looks very similar to the Generation 2 FR/PID module. The SRV02 or rotary control kit is ideally suited to introduce fundamental control concepts. The kit consists of a DC motor equipped with a gearbox that drives external gears. Another gear is attached to an independent output shaft that rotates in a precisely machined aluminum ball 10 bearing block. The output shaft is equipped with an encoder. This second gear on the output shaft drives an anti-backlash gear connected to a precision potentiometer. SRV02 models are equipped with a potentiometer to measure the output and load angular position. Additional sensors are available to give higher resolution results; users can choose optical encoders or tachometers to improve results. The external gear ratio can be changed using various gears. Two inertial loads are supplied with the system in order to examine the effects of changing inertia on closed loop performance. The square aluminum frame provides better stability and allows the kit to rotate about a vertical or a horizontal axis. There are several advantages of this kit; it provides larger scope of curriculum topics compared to generation 2 FR/PID module. The module is fully compatible with MATLAB/Simulink & LabVIEW which makes the kit widely accessible by student. Moreover, it was built with robust machined aluminum casing which provides a sturdy and strong frame to survive trip from class to student house, in a backpack. The drawback of this kit is the size; the size is too big for students to take it around; it’s about twice as big as generation 2. The cost to manufacture one kit is not available, but based on the kit robustness and sophisticated design it was assumed to be expensive, more than $50. Figure 3-6: Quanser SRV02 or servo rotary control kit ECP comes with a bigger model than Quanser, The Industrial Emulator / Servo Trainer is perfect for studying systems control in both the educational and industrial work places. Since this module is bigger than the Quanser kit, it offers a wide range of features that support the introduction and removal of non-ideal properties that are prevalent in real-world. The mechanism provides an abundance of thoughts for improvement of generation 2; it offers easy adjustment load inertias, gear ratio, disturbance torques (programmable), viscous or coulomb friction, backlash, and drive flexibility. This system is furnished with a comprehensive set of experiments that provide an excellent introduction to applied control system fundamentals. It includes a special section on practical control implementation where the above non-ideal 11 properties are studied and their effects mitigated through feedback control. Further experiments address practical issues such as sensor quantization, sample period, and drive saturation. This system is ideal for teaching practical control of modern industrial equipment such as spindle drives, turntables, conveyors, machine tools, and automated assembly machines. It was emulated using the many available configurations of the apparatus. Its adjustable dynamic parameters remove that non-ideal properties in a controlled manner make it a perfect selection for industrial servo control training and also for educational purposes. Figure 3-7: ECP The Industrial Emulator / Servo Trainer From these modules, it is obvious that functionality and accuracy are proportional to size. In other words a bigger module will have a great range of educational topics that can be taught and has a better accuracy. Likewise, size is proportional to cost; a bigger module will need more money to develop since it needs more parts and more materials for the module frame or chassis. In addition to these assumptions we learned that gears are actually a good choice for power transmission and friction damper for the system, simple and effective. Due to cost limitations, these two modules do not fit the University’s needs. However, it is important to study them to gain information and improve our design. 3.3 Design Requirements Cost The new Lab Kit must have a low cost. We instituted a requirement of less than $50 per Lab Kit bought in lots of 100 kits. This requirement is set in order to keep the Universities expenses low. By decreasing the cost of each kit, we are able to manufacture a greater amount of kits in 12 order to ensure that each student has a kit available to them. In this way, we hope to increase student understanding of course material. Size The new Lab kit must have a low volume. When conducting student surveys about the previous generation lab kit, a common complaint was the size of the Lab Kit. Students found it very difficult to carry the large awkward sized box in their backpacks. This is why we imposed a design requirement of the length of the shortest side of the Lab Kit must be less than two inches. In this way, the packaging for the kit can be much more flat, and will fit into student backpacks much easier. Easy Installation One of the requirements of our design is to be easy installed by the students. From the survey which was given to the students who took ME3281 previously, the need for an easy installed lab kit software appeared many times among the responses. The installation time includes the time of downloading the software and the time needed to install the software. The installation time should be relatively short so that the students would not get frustrated for spending too much time on the lab set-up. A short installation time also enables students more time to finish the lab assignments. PC Compatibility Because the lab kit must be able to be used by as many students as possible in their home, it must be compatible with most home computers currently in use. Many former ME3281 students cited problems with machines running Windows XP and Windows Vista using the old lab kits. These complaints came through two channels: current and former course instructors and an online survey of students conducted by the design team. The old lab kits were only worked with Windows operating systems by design and students using other operating systems on their home computers had to use a computer lab. However, no complaints were received about this inconvenience through either channel previously mentioned. It should also be noted that students with University of Minnesota IT Labs accounts (which usually make up the entire enrollment of the ME3281 class) have access to free XP and Vista licenses for their home computers. These factors, in addition to the difficulty of developing multi-platform software led to the decision of limiting the required compatibility of our design to Windows home operating systems. 13 Thus, the kit must work on all computers running Windows XP or Vista (provided they have a USB port). Since this covers the past 8 years of Windows releases designed for home PCs, the design team deemed compatibility for earlier Windows operating systems unnecessary. Reliability A characteristic that the kit needs to have is reliability. Reliability is important because the kits need to operate correctly and consistently for its designed lifetime in order to maximize the quality of education the student receives. A broken lab kit can reflect badly on the University, and it can cause a student to become frustrated and develop a dislike for course. The kit also needs to provide accurate and repeatable results, so the students do not get confused if they run an experiment more than once, or if they decide to compare their results with another student. According to the advisors for this project, the kit is required to work for about 4 years. If the average student uses the kit for one hour per semester, and if the kits are used for two semesters in a year, then each kit will operate for an average of 8 hours during its lifetime. It will also be run near its natural frequency most of the time. Therefore, the kit has to be designed to last at least 8 hours at its natural frequency, without any mechanical or electrical damage, and it needs to give repeatable results as well. 4 Design Description 4.1 Summary Our design is based on the previous generation of the lab kit. It is a second order rotary mass-spring-damper system on which the student can implement two experiments: frequency response, PID control. The students are able to visualize the change of angular position of the mass by changing the input frequency or control parameters through a GUI which can be download on the course website. The angular position is measured by two Hall Effect sensors, which is mounted close to the inertia; the damping is provided by the internal friction of the system; the torque of the system is a DC motor; the GUI is created by running a combination of C and Matlab code. The variable chosen to measure PID control and frequency response is the angular position of the motor. It is possible to measure the velocity or acceleration for frequency response, or to perform PID control over velocity. However, this module is an educational tool, and it is more 14 difficult for the student to visualize the concepts of frequency response and PID control if he or she has to think about how quickly the system is rotating, as opposed to simply where it is. Figure 4-1: Overview Sketch of the Take Home Lab Kit The angular position of the inertia is sensed using linear Hall Effect sensors and a magnet attached to the motor shaft. A magnetic strip is attached to the top surface of the gear, so that the mass will not fly off during the rotation. When the motor rotates, the Hall Effect sensor senses the position change of the magnet by the change of the magnetic field, and the computer can calculate the position base on the output voltage from the sensor. The new kit uses the internal friction of the system as the source of damping. The internal friction of the new design will all come from the motor and it has been proven to have a linear relationship between torque and angular velocity. However, alternative methods are being studied because of the need to show the students the effect of varying the damping. A DC motor is used to rotate mass create angular positions which can be detected by the sensors, it also provide torque and damping to the system. The rotation of the motor is controlled by a microcontroller on the circuit board. The motor is mounted perpendicular to the 15 circuit board. To reduce the size of the lab kit, alternative mounting method has being evaluated. The user interface of the new software is written in Matlab, however, the executive program of the lab kit is written in a combination of C and Matlab. Several functions which used to communicate with the lab kit are written in C since Matlab cannot directly communicate with USB. The C codes are then loaded into Matlab, and a Matlab GUI is created to provide the necessary functions the students needed to finish the lab. 4.2.1 Functional Block Diagram Figure 4-2: Functional Block Diagram of the Lab Kit 4.2.2 Functional Description Position Sensing The variable chosen to measure for PID control and frequency response is the angular position of the motor. It is possible to measure velocity or acceleration for frequency response, or to perform PID control over velocity. However, this module is an educational tool, and it is more difficult for the student to visualize the concepts of frequency response and PID control if 16 he or she has to think about how quickly the system is rotating, as opposed to simply where it is. For both PID control and frequency response, accurate sensing of position is required. Inaccuracies in the frequency response amplitude would cause the Bode plot to be incorrect, while the PID controller would be unable to apply appropriate corrections to the system if the position it senses is incorrect. However, low cost, low friction, small form factor and low complexity are also important considerations. The solution found to best fit these requirements is position sensing using linear Hall Effect sensors and a magnet attached to the motor shaft. Hall Effect sensors generally cost around a dollar each, are mere millimeters in size, are simple to implement, and have zero friction due to the non-contact nature of the sensing. Using a MATLAB script, many configurations of sensors and magnets were investigated. The magnets were modeled as a point dipole, which allowed for simple calculations of magnetic fields for a wide variety of cases. It is common to place the magnet in a location where it will move and the Hall Effect sensor senses the distance to the magnet by the strength of the magnetic field. This is called “slide-by sensing”. In our case, one could attach the magnet to a disc on the motor shaft, some distance away from the motor shaft itself. However, this configuration proved to be impractical for our application. Because the magnetic field strength drops off as the cube of distance, acceptable sensitivity only occurs when the magnet is near the sensor. Because the sensors have a limited voltage output range, increasing the strength of the magnet would quickly max out the sensor. While it is possible to make this configuration work with a large number of Hall Effect sensors spaced around the motor, there are better solutions. Figure 4-3: Sensor response to final design sensing configuration. Note the sinusoidal shape. The layout most appropriate for our application is to place the magnet concentrically with the motor shaft. The magnet is magnetized such that the north and south poles are diametrically opposite of each other. The motor shaft is in the center of the magnet, in 17 between the poles. The sensors are placed so that the Hall element faces the motor shaft. This way, the sensor measures the change in magnetic field orientation as opposed to the position of the magnet. This is favorable because in this case the only spots with low sensitivity are when the magnetic dipole is perpendicular to the normal vector of the Hall element. The MATLAB calculation showed that, under the point dipole approximation, this configuration produces an output voltage that is the cosine of the angular position, scaled and offset in the ydirection by constants (see figure). A single sensor cannot resolve a full rotation of the system because the position is not a single-valued function of the voltage. Even if one is only interested in a 180-degree range, the edges of that range will approach zero sensitivity. However, two sensors spaced 90 degrees from each other provide a simple way to resolve the entire 360 degree rotation, because while one sensor outputs a cosine of the position, the other outputs a sine of the position. Using Euler’s identity, in addition to the form of the sensor outputs, and , one can obtain the magnet angle as a function of the voltages, . The constants A,B,C and D may be found by the following procedure – orienting the north and south poles of the magnet to face each sensor can be used to find the maximum and minimum of each sensor’s output in that configuration, which can be used to calculate the amplitude and y-offset of the sine and cosine waves. These points (orienting the magnet so that a pole faces the Hall Effect sensor) correspond to the minimum and maximum of a sine wave, where the derivative with respect to angle is zero. This is beneficial for calibration because near these points, deviations in angle only cause small changes in voltage. Figure 4-4: Slide-by layout and response [1] Figure 4-5: Close-up of chosen sensor layout This layout, while effective in resolving the angular position of the rotational system, is challenging to implement. The Hall Effect sensors should be as close as possible to the magnet 18 both radially and vertically to ensure a strong enough magnetic field at the Hall element. While the through-board mounted sensors come with long pins, it was necessary to mount the sensor with the bottom flush to the PCB to avoid possible damage to the sensor package. This meant the magnet had to be as close to the board as possible. However, since the motor is mounted with the top of the body flush to the PCB, the motor shaft extends nearly 1cm above the board. Because of this, a ring magnet was chosen, so that it could be placed around the shaft, with the bottom nearly touching the PCB. A plastic rod, drilled to accept a press-fit of the motor shaft, couples the motor to the ring magnet. The outside diameter of the rod matches the inside diameter of the ring magnet. Glue holds the rod to both the motor and the magnet. The minimum radial distance the Hall Effect sensors may be from the motor shaft is dictated by the motor body diameter. This is because the motor is flush with the PCB, and it would interfere with the sensor pins, which protrude slightly below the board. This minimum distance requires a fairly large magnet to produce a large enough magnetic field far away from the magnet. The MATLAB calculation previously mentioned was used to size the magnet as well as choose the sensitivity required from the Hall-Effect sensor. The combination chosen needed to utilize as much of the sensor’s 5 volt range as possible. Due to motor packaging, the minimum distance the sensors could be placed from the motor shaft was 1.5cm. The sensor chosen is an Allegro Microsystems A1301, with a sensitivity of 2.5mV/G. The magnet is an Amazing Magnets H250F-DM. There are many advantages to this design. The packaging of the sensing elements is small, beyond the small size of the sensors themselves. The zero friction induced by non-contact sensing is an advantage as well. Finally, the cost of this configuration is minimal - $4.12 for the two sensors and a magnet in lots of 100. These qualities make Hall Effect sensing in this configuration a natural choice compared to other options, such as a potentiometer. Motor The motor mounted to the kit is used to rotate mass and produce a rotational position which is detected by the Hall Effect sensor located under the inertia mass wheel; it also supplies speed, torque and friction to the system. It was controlled by the L293D H-bridge microcontroller; it controls the motor rotation, speed and angular acceleration. The motor is a plain motor powered by 12V power supply and it was mounted perpendicular to the circuit board and located under PCB circuit board. Motors come in many sizes and types, but their basic function is the same; they convert electrical energy to mechanical energy, nearly always by the interaction of magnetic fields and current-carrying conductors. The common division of electric motors has been that of 19 Alternating Current (AC) types and Direct Current (DC) types. For this project a DC motor was chosen. Table 4-1: Motor Comparison AC Motor Single-speed transmission Light weight Less expensive 95% Efficiency at full load More complex controller Motor controller/inverter more expensive DC Motor Multi-speed transmission Heavier at equivalent power More expensive 85-95% Efficiency at full load Simple controller Motor controller less expensive As shown in the comparison table, an AC motor is less expensive, but due to its high controlling cost and complexity it was rejected. In the motor selection process for this project, there are several types of DC motors that could be chosen to replace the current motor such as a Stepper motor, a Brushed motor or a Brushless motor. We ended up choosing a small brushed DC motor, because our main objective is to decrease the size and our target is 2 inches thick. Refer to design requirements for more explanation. The size of the motor should be less than 2 inches long to achieve this target but there are some tradeoffs for choosing a smaller motor; if the motor is too small, it will have insufficient torque to drive reasonable size mass and spring. The problem of the current motor is the size; the size of the motor is too big, about 3 inches long, and it was designed to be mounted perpendicular to the circuit board. These two conditions need to be modified to produce a smaller lab kit. The current motor used for the kits is no longer available; due to this particular reason we have come up with several ideas of using different types of motor; one of the motors that meet the criterion is the brushless motor. Even though the motor is a lot smaller than the current motor, we were advised to neglect the idea because cost to control the motor can be expensive and it is hard to mount the motor to a circuit board because the size is too small. We are striving to prototype a smaller model by redesigning the layout and eliminating the potentiometer; we believe that choosing the correct 20 motor is key to success. But due to cost and size limitations, the choices are narrowed to several plain motors. The physical criteria which we used as guidelines to choose correct motor are that motor must be small and less than 2 inches long. For the electrical criterion the motor should has 12V or less voltage operation and very low friction. The motor should available to purchase in lots of 100. In order to effectively design with D.C. motors, it is important to understand their characteristic curves. For every motor, there is a specific Torque Speed curve and Power curve. Torque is inversely proportional to the speed of the output shaft. In other words, there is a tradeoff between how much torque a motor delivers, and how fast the output shaft spins. The motor characteristics are frequently given as two points on the Torque Speed curve; it’s usually provided by manufacturer together with the motor data sheet. Two motor parameters that govern the Torque Speed curve are stall torque and no load speed. Stall torque, represents the point at which the torque is maximum, but the shaft is not rotating; no load speed is the maximum output speed of the motor (when no torque is applied to the output shaft). For this particular project maximum stall torque is preferred. Some manufacturers didn’t provide any information about stall torque or speed. In this case, we chose the motor based on its torque constant and speed constant. According to equation below torque is proportional to current, and torque constant, τ m. Torque = τm*current The torque constant is equivalent to the inverse of the speed constant in SI units; this information is important to give some idea about what the torque and speed of the motor will be if Torque Speed curve is not available. When choosing a motor, it is important to choose one that meets the design requirements and budget. The motors were chosen from several websites, but only Jameco Electronics have motors that can be bought in lots of 100 at a reasonable price. Several motors were selected as a possible replacement for the current motor, the selection were done by going through the manufacturer’s catalog to choose the right motor based on its torque constant, velocity constant and resistance. Then, each Torque Speed curve of the motor is thoroughly checked to finalize the selection. Finally, to verify the preliminary selection, we created a Simulink model to simulate each motor into the system. The mathematical model was created based on the system’s mechanical and electrical equations. These equations are governed by the damping coefficient, the mass moment of inertia, and the spring constant. By entering motor parameters into the mathematical model, system current, position of the mass, angular velocity, and angular acceleration are obtained. Base on all these values, the motor torque is obtained and compared. At this point, the motor that produced sustain high torque is 21 preferred. We ended up with five possible candidates, which could be use for the prototype. Refer to the companion CD for analysis details. After we received the motors, several testing procedures were implemented to check whether the motor worked as simulated by Simulink model. The new prototype will use the inherent friction as the damper and for that reason damping test were conducted to identify the damping coefficient for each motor. The method of testing is explained in the damping section. Figure 4-6: The DC motor, Source PN 238473. Graph 4-1: Torque Speed curve for the DC motor, Source PN 238473. 22 We chose DC motor Source PN 238473 as the final design based on the Torque Speed curve; from all the graphs that we required, motor 238473 turned out have the highest stall torque and the highest torque constant. While the primary objective of this project was to reduce the lab kit size and at the same time increase its reliability; we are one step closer to success by incorporating the new motor that smaller and cheaper than the original motor but capable to produces the same performance. The motor for the prototype will be controlled by the same L293D H-bridge microcontroller. Refer to volume 2 Evaluation for details. Damping One of the problems of the old kit was finding an ideal damper. In order for the student to be able to model the system using techniques taught within the class, the torque that the damper produces must be proportional in magnitude of the angular velocity. In equation form, it looks like the following: Tdamper=Bω If there is any deviation from this requirement may cause the student to become confused, since they are only familiar with linear damping. Therefore, a major requirement for the damper is that the damping coefficient is a constant. A next constraint is that the damping torque is large enough to be measured, and yet it has to be small enough so the motor can handle it. Also, cost is always an issue in this project. For this reason, it would be preferred to have a damper that is commercially available, as opposed to something that is custom made in a machine shop. The method used to measure the damping coefficient was to wrap a string around a pulley, which is attached to the potentiometer and the damper, and a mass is attached to the other end of the string. The mass is then released off the edge of a table, while the angular position is measured by the potentiometer and recorded on the computer. As the mass falls, eventually it will reach a velocity where the force of gravity will be balanced by the damping force. At this point, the mass will be traveling at a constant velocity and the torque applied will be constant as well, and both of these values can be measured. After this experiment is repeated for several different masses, the data is then analyzed by fitting it with a linear regression curve to determine if the damping coefficient is a constant or not. An indicator of a good damper is a large R^2 value. 23 The current lab kit uses the friction present within the system as a damper. Initially, this solution is not very appealing for a variety of reasons. First of all, before any testing was done, it was not clear if the internal friction provided a constant damping coefficient. Furthermore, it is desirable to have a damper that the student can attach or detach, which is not possible with internal friction. After performing the damper test previously mentioned, it was found that internal friction created an exceptionally linear relationship between the torque and angular velocity, which allowed this idea to gain some support. T o rq u e v e ru s V e l o c i ty fo r E n ti re T o rq u e (N* m ) 0.0150 S y s te m (g e a r, m o to r, p o te n ti a m e te r) 0.0100 0.0050 0.0000 0.0000 1000.0000 2000.0000 3000.0000 4000.0000 A n g u l a r V e l o c i ty (d e g re e s /s e c o n d ) Graph 4-2: Graph that shows the relationship between torque and angular velocity for the entire system An alternative damping method, which is indirectly employed in the current kit, is to deform an elastomer. An elastomer, such as a rubber band, is usually modeled as a combination of a spring and a damper. One major way to characterize an elastomer is to model it as spring and a damper in parallel, which is called a Kelvin-Voigt model. A next way would be to model the elastomer as a spring and damper in series, which is called the Maxwell model. The current kit uses a rubber band as a spring, but the students are not aware that it may provide damping. Several different methods for deforming an elastomer was introduced by the design team as well. One major drawback is this method of damping would be difficult to test, because the damping coefficient cannot be found using the test previously described. Also, it would be difficult to know if it would be better to characterize the elastomer as a Kelvin-Voigt material, a Maxwell material, or some other type. Also, it has been known that elastomers can possibly become brittle over time, so the damping properties that they have are not guaranteed to last 24 from semester to semester. It has also been proven, by using Fourier analysis, that elastomers have the potential to introduce nonlinearity into the system. For these reasons, not much effort was put into researching this technique any further. Graph 4-3: Fourier Transform of output of the system with a rubber band oscillating at 6Hz. Notice the nonlinearities present at 11Hz and 16Hz. It was decided that the new kit will retain the internal friction of the system as the source of damping. One major benefit of this method is the low cost, since no extra parts are needed. Also, it has been proven that internal friction provides a linear relationship between torque and angular velocity. It has been found that the internal friction in the current kit originates from the potentiometer and the motor. Since the future kit will have a hall effect sensor, rather than a potentiometer, the damping will all come from the motor. There is still interest in some of the alternative damping methods, because it would be favorable to have some sort of damping method that can be attached or detached, so the student can observe how damping affects the system. Software The previous generation Lab Kit software had several problems. Many of these problems were caused by the software being written in Microsoft Visual Basic 6. Since the creation of the previous generation software, Microsoft has released many new updates, and as a result, the software has compatibility issues with newer versions of Microsoft Windows. Also, the ME3281 teaching staff would like to have this software rewritten in MATLAB to accompany the 25 extensive use of MATLAB in the ME3281 course. These problems have been solved by rewriting the Lab Kit software in a combination of Visual C++ and MATLAB. To accomplish this task, the code used to communicate with the lab kit was written in C. This was done because C code is much more versatile than MATLAB code. MATLAB cannot directly communicate with USB devices without utilizing additional tool boxes. Although MATLAB cannot communicate with the Lab Kit directly, there are several C functions included with Microsoft’s Software Development Kit that can be used to identify and connect to the Lab Kit. Because of this, several functions were written in C to communicate with the Lab Kit. First, a function was written to check if the Lab Kit is connected. A second function was written to request data from the Lab Kit. The final function sends data to the Lab Kit. Once these functions were written and working in C, they were loaded into MATLAB. MATLAB contains a function which allows C code to be compiled and run as MATLAB code. This function takes programs written in C code and compiles them into a single MATLAB library file. These C functions can now be called from MATLAB like any other MATLAB function. Using these functions, the Lab Kit can be completely controlled through a single simple MATLAB interface. MATLAB was chosen to be used as the user interface for the software for many reasons. MATLAB is a powerful engineering tool that is used throughout the Mechanical Engineering program. It uses a simple interface and programming language to allow students to easily accomplish complex tasks. MATLAB is used extensively in the ME3281 class, so all students have access to the software and should have basic knowledge of MATLAB. Another reason MATLAB was chosen is because MATLAB files are not precompiled. Because MATLAB files are not precompiled, MATLAB offers a higher degree of platform independence than other precompiled programming languages such as Visual Basic or C/C++. When programs are precompiled, they are linked to Microsoft libraries which are then called when the program is run. If Microsoft updates or changes these libraries, then the software may no longer function. With MATLAB, all programs are compiled at runtime. Because of this, a MATLAB program written in a certain version of MATLAB will be compatible with all other versions of MATLAB. This is also true for operating system independence. A MATLAB program written using a certain version of Windows will retain its functionality if it is run on a different version of Windows. This means that our software will be compatible with any Windows computer with MATLAB installed. Once the USB communication functions were written, a user interface was created in MATLAB. This user interface offers two separate modes: PID Control and Frequency Response. The MATLAB interface opens a window and displays two buttons: one for PID control and the other for Frequency Response. This prompts the user to select which mode they would like to 26 use. Once a mode is selected, MATLAB sends data to the Lab Kit specifying which mode was selected. This causes the Lab Kit to enter the desired mode and begin sending data back to the computer. MATLAB then interprets this data and performs any necessary calculations to transform the Lab Kit data into information the user can understand. Figure 4-7: Figures Showing the MATLAB User Interface MATLAB then opens a user interface for the selected mode. The user interfaces for the two different modes are separate, but have many similarities. For example, from both user interfaces, the user is able to see the output of Lab Kit. In Frequency Response mode, the user is also able to generate a Fourier Transform of the output. Also, the interface allows the user to change the input variables. In PID mode, this means setting the P, I, and D constants as well as the reference value. In Frequency Response mode, this means setting the frequency of oscillation. 27 4.2.3 Overview Drawing Figure 4-8: Line Drawing (Cross Section) of the Lab Kit 4.3 Additional Uses The take home lab kit is primarily designed for students in ME 3281 to understand the basic concept of control and system dynamics. However, one can always extend its usage to other field of study. Since the system is all controlled by microcontrollers, it can also be used as a microcontroller courser lab kit for the electrical engineering department. The student would be able to run their program onto the microcontroller to control the motion of the motor. Additionally, the vibration generated at various input frequencies of the lab kit can be used as models for the vibration courses 28 5 Evaluation 5.1 Evaluation Plan Cost In order to evaluate the cost of the Lab Kit, a bill of materials will be constructed for the Lab Kit. By summing the price of each component purchased in lots of 100, we can evaluate our low cost requirement. We find this cost to be $41.70. A bill of materials was also prepared to find the cost of reproducing the previous generation Lab Kit. This cost came out to be $59.65. We can see that our design requirement of having the total cost of the Lab Kit under $50 has been met. We can also see that our kit is quite a bit cheaper than the previous generation kit. Size Our low volume requirement can be evaluated by measuring the dimensions of the Lab Kit. If the smallest dimension is less than two inches, we have met our requirement. After measuring the dimensions of the kit, it was found the smallest side was greater than two inches. Thus, this design requirement has not been reached. Easy Installation Evaluation The design team determined that the amount of time it takes to install the software should be shorter than 5 minutes. 5 minutes was estimated by combining the time of downloading the “Dlab.rar” file (approximate 4 MB, usually take 2 minutes to download, but the time may vary depending on the internet connection) and the time of installing the software to the host PC. The evaluation were conducted by distributing the lab kits to 5 randomly selected ME students who owns a Windows PC, and record the time it took for each student to install the kit. The test showed that all of the five students were able to finish the installation within 5 minutes. PC Compatibility Evaluation The design team determined that the lab kit must be compatible with all computers running Windows XP or Vista (provided they have a USB port). To evaluate this requirement, two main tests were run. The first test was a natural consequence of developing the kit, and consisted of 29 each team member making sure the software worked on their personal computer. This provided a random sample of 6 computers, 2 running Vista and 4 running XP. The second test was necessitated by the dynamic, self-updating nature of modern operating systems. The possibility that all or some computers tested had downloaded a particular update which allowed the software to function needed to be ruled out in order to satisfy the design requirement. A testbed computer had each operating system available installed on it, followed by MATLAB and the redistributable package included with the kit software. The software functionality was then checked, without making any updates to the operating system (the computer was not even connected to the internet). The operating systems tested were XP Professional 32-bit, XP Professional 64-bit, and Vista Business 32-bit. A 64-bit version of Vista could not be located, and testing one would be a recommended future step, although it is highly likely that the results would be identical to XP 64-bit or Vista 32-bit. All computers tested ran the software with no issues after installing the redistributable package included with the software. Therefore, the module passed this test. Reliability Evaluation Reliability is one of the requirements of the lab kit. One of ways that the kit was improved was to remove some of the parts that may wear due to friction. The main method used to accomplish this was by removing the gears, which were connected to the potentiometer, and replacing it with hall effect sensors. A prototype of the new design was created to evaluate the reliability. The prototype was made out of acrylic glass, and has the holes drilled into it for holding the hall effect sensors, motors, rubber band pole, and the legs. The electric circuits were separate from the acrylic glass board in the prototype. This will be tested by running the kit continuously for 8 hours, which is the expected design life of the kit. The mass and the rubber band were attached while the test was performed. The kit operated at a frequency of 4.5 Hz, because the natural frequency was calculated to be 4.34 Hz. Before and after the test was performed, a Bode plot was created for the system, to see if anything within the system changed. Also, after the kit was run, the kit was inspected for any visible signs of wear, such as components becoming loose, or the electrical circuit becoming hot. The test was run and it the kit remained largely undamaged by being run continuously for 8 hours. The circuits were inspected for overheating and the mechanical system was inspected for any loose components, and everything seemed normal. The only issue was that two rubber bands broke during the 8 hour period. Also the Bode plot for the system was compared before and after, and there was a resemblance between the two, but there was room for improvement. 30 From the results of the test, it can be concluded that the kit can perform as expected during the time it will be used. It can also be concluded that the kit needs an alternate method for introducing a spring force into the system or higher quality rubber bands needs to be used. 5.3 Discussion 5.3.1 Strengths and Weaknesses Strengths Although there are a few issues that needs to be resolved, new lab kit has many strengths and innovations. The first major strength is the fact that the software was written in MATLAB. This allows the student to become familiar with the capabilities with MATLAB, and it also increases the compatibility of the software across different operating systems. The two major operating systems on which the kit was tested were Windows Vista, and Windows XP, and the software performed as expected. Also, since the software was written in MATLAB, it allows the software to have advanced features that would have been difficult to implement in the Visual Basic version. One major addition to the software is the Fourier transform, which will allow the student to learn more about real world tools that are used in analyzing systems. Another strength of the new lab kit is the fact that the cost of each kit, when bought in lots of 100, are only $41.60. This is inexpensive compared to the old design, which would cost approximately $60.00 if the components were purchased today. A factor that has contributed to the low cost if the minimal amount of custom designed components. The only custom made parts are the PCB board and the Delrin bushing. The use of off the shelf components allows the kit to be repaired quickly and easily if it were ever damaged. Low friction is another strength that the new kit has. Since the potentiometer and gears were replaced by the Hall effect sensor, the amount of energy loss due to friction is reduced. This means that the kit could possibly use a smaller motor in the future, which would reduce the size and cost of each kit. Weaknesses There are many weaknesses in the new kit, and there are many problems that have not been addressed yet in the new design. One problem is the fact that the motor is big. This is a concern, because the motor is a major factor that determines the overall size of the kit. 31 A next weakness is the fact that the new design still has the suction cups on the bottom of the legs. This idea was not liked by the design team, because they were expensive and ineffective. Efforts were made to change the method of keeping the kit adhered to the table, such as having a student apply a textbook on top of the kit. However, due to time constraints, this idea was never pursued. The lack of rigidity of the kit is also a weakness. When first viewed by the design team, it was generally agreed that long legs of the kit being directly bolted to the PCB board gave the impression that the kit was “flimsy”. Many new concepts for a new base were created, but the same design was used in the end. This is mainly due to cost considerations. The new design still has the rubber band as a spring. This idea works relatively well, but the rubber band is known to become brittle and snap over time. Many concepts were generated to replace the rubber band, but no other method could compare to this low cost solution. Another weakness is the fact that the kit uses a gear as a surface to connect the mass to the system. This is a poor design, because the teeth of the gears are not being used, and the teeth probably raise the cost of the kit. A better design would be to find a simpler and more inexpensive component that provides the same functionality. 5.3.2 Next Steps One of the steps that needs to be taken would be to buy the components and assemble the kits. Once they are assembled, they need to be introduced to the professors and students. The next steps taken would be to work on removing the weaknesses from the new design. This will most likely be done by an incoming senior design team or a graduate student, which is how the kit has improved in the past. Once feedback is obtained from students using the new kits, more weakness may be discovered, which must be eliminated by the next team working on them. 6 References [1] Durfee, Li and Waletzko, “Take-home lab kits for system dynamics and controls courses”. Proceedings of the 2004 American Controls Conference, June, 2004. *2+ Durfee, Li and Waletzko, “At-home system and controls laboratories”. Proceedings of the 2005 American Society of Engineering Educators Conference, June, 2005 [3] David Waletzko, “Distributed Laboratory Modules for System Dynamics and Controls Courses”, A Plan A Master’s Thesis, University of Minnesota, Institute of Technology ,December 2005 32 *4+ Quanser, “Rate Servo, Rotary”, Available: http://quanser.com/english/html/products/fs_product_challenge.asp?lang_code=english&pcat _code=exp-rot&prod_code=R13-rateserv&tmpl=1. [Accessed: April 5, 2009]. [5] Educational Control Product (ECP), “industrial Plant Emulator”, Available: http://www.ecpsystems.com/controls_emulator.htm. [Accessed: April 5, 2009]. [6] Joe Gilbert and Ray Dewey, “Linear Hall-Effect Sensors”, Allegro Microsystems, Inc., Application Note 27702A. Available: http://www.allegromicro.com/en/Products/Design/an/an27702.pdf, [Accessed: March 3, 2009]. [7]Jameco Electronics, Product Descriptions, . Available: http://www.jameco.com/Jameco/Products/ProdDS/238473.PDF, [Accessed: April 5, 2009]. 33