Optical Encoder for a Game Steering Wheel Final Report: May05-26 Client: Thomas Enterprises David Thomas Sr., President David Thomas Jr., Vice President Faculty Advisors: Dr. James Davis Dr. Douglas Jacobson Team Members: Samuel Dahlke CprE Peter Fecteau CprE Daniel Pates EE Lorenzo Subido EE DISCLAIMER: This document was developed as a part of the requirements of an electrical and computer engineering course at Iowa State University, Ames, Iowa. This document does not constitute a professional engineering design or a professional land surveying document. Although the information is intended to be accurate, the associated students, faculty, and Iowa State University make no claims, promises, or guarantees about the accuracy, completeness, quality, or adequacy of the information. The user of this document shall ensure that any such use does not violate any laws with regard to professional licensing and certification requirements. This use includes any work resulting from this student-prepared document that is required to be under the responsible charge of a licensed engineer or surveyor. This document is copyrighted by the students who produced this document and the associated faculty advisors. No part may be reproduced without the written permission of the senior design course coordinator. Monday, March 07, 2016 1 Table of Contents 1 Table of Contents i 1.1 List of Figures iii 1.2 List of Tables iv 1.3 List of Definitions v 2 Introductory Material 1 2.1 Executive Summary 1 2.2 Acknowledgement 1 2.3 Background Information 2 2.4 Problem Statement 2 2.5 Solution Approach 3 2.6 Operating Environment 3 2.7 Intended Users 3 2.8 Intended Uses 3 2.9 Assumptions 4 2.10 Limitations 4 2.11 Expected End-Product and Other Deliverables 4 3 Project Approach and Results 5 3.1 Functional Requirements 5 3.2 Resultant Design Constraints 5 3.3 Approaches Considered and One Used 3.3.1 Electrical Design Approach 5 5 3.3.1.1 3.3.1.2 Optical Encoders Power Supply 6 6 3.3.2 Microcontroller Design Approach 3.3.2.3 3.3.2.4 Microcontroller Microcontroller Program 6 7 3.4 Detailed Design 3.4.1 Detailed Electrical Design 3.4.1.5 3.4.1.6 3.4.1.7 3.4.1.8 8 8 Optical Encoders Encoder Background Information Optical Encoder Operation Encoder Selection and Installation 3.4.2 Power Supply 3.4.3 Circuit Board Design 3.4.3.1 3.4.3.2 6 8 8 8 10 11 14 Schematic layout Component placement 14 16 3.4.4 Microcontroller Program Design i 16 3.5 Implementation Process Description 3.5.1 Electrical Design Implementation 3.5.1.3 3.5.1.4 3.5.1.5 Optical Encoder Implementation Power Supply Implementation Board fabrication 3.5.2 Microcontroller Implementation 3.5.2.6 3.5.2.7 Microcontroller Microcontroller Program 18 18 18 18 18 19 19 19 3.6 End-Product Testing Description 19 3.7 Project End Results 20 4 Resources and Schedules 20 4.1 Resource Requirements 4.1.1 Personnel Effort Requirements 4.1.2 Other Resource Requirements 4.1.3 Financial Resource Requirements 20 20 26 30 4.2 Schedules 35 5 Closing Material 38 5.1 Project Evaluation 38 5.2 Commercialization 39 5.3 Recommendations for Additional Work 39 5.4 Lessons Learned 39 5.5 Risk and Risk Management 5.5.1 Anticipated Potential Risks and Planned Management 5.5.2 Anticipated Risks Encountered 5.5.3 Resultant Changes in Risk Management 40 40 40 41 5.6 Project Team Information 5.6.1 Client Information 5.6.2 Faculty Advisors Information 5.6.3 May05-26 Team Members Information 41 41 41 42 5.7 Summary 42 ii 1.1 List of Figures Figure 1 - Pin diagram of the PIC18F4455 7 Figure 2 - Timing diagram of optical encoder quadrature output 9 Figure 3 – Optical encoder 10 Figure 4 - Mechanical drawing of the optical encoder 10 Figure 5 – Steering wheel components 11 Figure 6 – Mechanical drawing of the power supply 12 Figure 7 - Schematic of the power jack 13 Figure 8 - Photo of the power jack 14 Figure 9 - A view of Eagle's schematic editor 15 Figure 10 - Board layout 16 Figure 11 – Data flow for microcontroller 17 Figure 12 – Original personnel efforts requirement estimate 21 Figure 13 - Revised personnel effort requirements estimate 23 Figure 14 - Final personnel effort requirements 25 Figure 15 – Original other resource requirements estimate 26 Figure 16 - Revised other resource requirements estimate 28 Figure 17 - Final other resource requirements 30 Figure 18 – Gantt chart for project tasks 36 Figure 19 – Gantt chart for deliverables 37 iii 1.2 List of Tables Table 1 - Transitions of the encoder output and how they are interpreted 9 Table 2 – Original personnel effort requirements estimate 20 Table 3 – Revised personnel effort requirements estimate 22 Table 4 – Final personnel effort requirements 24 Table 5 – Original other resource requirements estimate 26 Table 6 - Revised other resource requirements estimate 27 Table 7 - Final other resource requirements 29 Table 8 – Original financial requirements estimate 31 Table 9 - Revised financial requirements estimate 32 Table 10 - Revised financial requirements estimate (continued) 33 Table 11 - Final financial requirements 34 Table 12 - Final financial requirements (continued) 35 iv 1.3 List of Definitions The following terms are used throughout this report and may not be widely known or understood. American wire gauge (AWG): A standard system for measuring and classifying the thickness of wire conductors. Analog to digital conversion (ADC): The process of converting a signal from analog to digital form. Assembly language: Programming language one level above binary machine code. C: Programming language used for many hardware systems. Cycles per revolution (CPR): The maximum rate at which voltage pulses come out of an optical encoder. Breadboard: Structure used for the quick assembly/destruction of small circuits for the purpose of testing. Hardware interface driver (HID): Software that converts hardware output into a standard from that can be used by computers. Integrated circuit (IC): Small electrical single-function or multi-function device that is assembled into one convenient package. Microcontroller: Processing device responsible for receiving and handling electrical signals or data from the various input sources. Optical encoder: Small device used to detect rotational movement. Its resolution is determined by the number of ticks that it can detect through one full rotation. Printed circuit board (PCB): Structure that holds small electrical components and their respective connections. Potentiometer: Variable resistor. Potentiometers are commonly used in speaker devices to change the volume. Special function register (SFR): Register that is designated a specific address in memory and function by the microcontroller’s manufacturer. SPICE: Software used primarily for circuit simulation. Universal serial bus (USB): Standard port that allows connection to external devices (such as digital cameras, scanners, and mice) to computers. v 2 Introductory Material This section will introduce the project and specifically define the problem statement. Topics discussed are the problem statement, operating environment, intended users and uses, assumptions and limitations, and the expected end product and deliverables. 2.1 Executive Summary This Iowa State University computer/electrical engineering senior design team has been invited to upgrade a video game steering wheel for Thomas Enterprises’ product line. Specifically, they would like an updated steering wheel design with optical encoders. Currently potentiometers are responsible for the encoding of the steering wheel and pedal input. The optical encoder offers greater resolution and better performance from the steering wheel. The new solution meets the following specifications: Optical encoder: Thomas Enterprises has provided our team with the S1-512 optical encoder from US Digital. It provides a resolution of 2048 positions, but also draws significantly more power than the currently used potentiometers. Compatibility: The new design uses standard HID compliant drivers that are similar to the previous design. This provides compatibility with the connecting computer and software. Cost: The design solution costs less than the $150 per board for parts and fabrication. This is within the budget set at the beginning of the project. In order to make the steering wheel work with the optical encoders, several components needed to be added to the current design, and several components needed to be modified. These components include an external power supply and a new microcontroller. Power supply: Currently, the entire steering wheel circuitry runs on power received from the USB port, into which the steering wheel connects. However, the optical encoders draw significantly more power than the currently used potentiometers, so it was necessary to add a power supply to the system in order to run the steering wheel properly. Microcontroller: A 16-bit microcontroller was selected to handle the resolution of the optical encoders. The team has designed a solution that costs approximately $14 to produce in volumes of about 100 circuit boards (not including optical encoders). The development of the code was independent of the circuit. All code compilation was carried out with MPLAB software and all circuit development was carried out in Eagle software. The solution has been implemented as of March 2005 with testing through April 2005. The project is still on schedule to deliver a working prototype by late April 2005. 2.2 Acknowledgement Special thanks go to Thomas Enterprises of Anamosa, Iowa. Thomas Enterprises, the client of this project, has provided the video game controller hardware and racing simulation software for the team to use in researching the team’s design. 1 Appreciation is also expressed to Andrew Bice of Iowa State University’s Center for Industrial Research and Service. Mr. Bice designed the original USB interface PCB and has provided the team with the technical documentation generated during the original design. Faculty advisors Dr. Doug Jacobson and Dr. Jim Davis have also provided guidance and advice for this project. Gratitude is expressed for their efforts. 2.3 Background Information The overall purpose of this project is to upgrade an existing video game controller that is produced by Thomas Enterprises of Anamosa, Iowa. The video game controller consists of a steering wheel assembly, including several pushbuttons, and a gear shifter control. In a separate module is the foot pedal assembly, which includes a gas, brake, and clutch pedal. The controller is to be used on a personal computer, connected via a USB cable. The most common application of the controller is for racing video games and driving simulations. Many users participate in online racing tournaments, simulating an entire NASCAR season for example. Thomas Enterprises manufactures very high end controllers for gaming enthusiasts who demand a high level of precision and performance from their steering wheel controller. The previous design on the controller used potentiometers to sense the angular position of the steering wheel and pedals. The potentiometer is part of a voltage divider circuit, and as the wheel turns the voltage across the potentiometer changes. A microcontroller, with integrated USB communications, converts the analog voltage of the potentiometer into a digital value and keeps track of the position of the wheel, pedals, and the state of the pushbuttons. The electronics are located inside the housing of the steering wheel assembly and connect to the foot pedal assembly via a cat-5 cable. The previous design uses an 8-bit microcontroller, which makes it only capable of tracking 256 positions. The main goal of this project was to increase the resolution of the controller by incorporating optical encoders and a new microcontroller capable of handling more bits of data. The client wanted to achieve a resolution of at least 1024 positions. The client also wished to maintain the ability to use at least 16 pushbutton inputs 2.4 Problem Statement Thomas’ current products are capable of sensing 256 positions on the steering wheel and pedals and they also accept 16 pushbutton inputs. The output of the PCB connects to a personal computer through a USB cable. The desired upgrade is a direct replacement for the current sensors and PCB. The ideal solution would be capable of sensing at least 1024 positions and retaining all 16 pushbutton inputs. The end-product should cost on the order of $30 - $50 but no more than $150, not including the price of the encoders. 2 2.5 Solution Approach The solution for this project requires using optical encoders to replace the potentiometers that were previously being used to sense the position of the steering wheel and pedals. The encoders have the desired resolution to provide the precision control that is required for this application. The encoders are mounted in the same position as the current potentiometers. The microcontroller senses the input from the wheel, pedals, pushbuttons, and sends output to the computer through a USB cable. The previous microcontroller has been replaced by a newer model that is capable of tracking the higher resolution input and all the pushbutton functions. Assembly code has been written to interpret the input from the steering wheel and pedals. 2.6 Operating Environment The video game controllers are used with personal computers. In most instances the controllers will be used indoors, or in similar conditions where temperature, moisture, and other environmental factors will be controlled. The typical conditions for use are: Temperature of approximately 70°F No moisture Mostly dust-free conditions Thomas Enterprises operates a scaled race car simulator that is taken to local community events. The controller must operate in an outdoor environment under this circumstance, although the simulator would not be operated under adverse weather conditions. The product is relatively robust and strong mechanically, such that it will last a long time under normal use. Even though it is durable and strong it is not intended to be dropped or thrown, but could withstand a drop from approximately 2 - 3 feet. The steering wheel assembly is attached to a desk or table for use by a bracket similar to a C-clamp. The pedals sit on the floor and are heavy so that they will stay in place when the pedals are pushed. 2.7 Intended Users The intended users of this product are serious video gamers, race car drivers, and others who would play racing games on a personal computer and demand a high quality product with high sensitivity from the controller input. The typical description of a person who fits into the category of the intended users is age 12–30 with a familiarity with computers. Described above is the typical user, but many other people can use and enjoy the product. 2.8 Intended Uses It is intended that a person would use this product in their home at a table or desk on video games that are played on a personal computer. The controller is interfaced to the computer via the standard hardware interface drivers (HIDs) that are currently being used. The most common games used with the controller are racing simulation games. 3 Thomas Enterprises also has customers who are interested in controllers for other simulations, such as semi truck driving. It is assumed that this controller will not be used on video game consoles such as Sony Playstation® or Nintendo Gamecube®. It cannot be used to with every video game; it only controls games that accept input from the steering wheel device. 2.9 Assumptions The team assumes the following statements in the design of the project solution: The team should be able to modify and use some of the existing assembly code so that the code can be written in a much shorter amount of time. All the original schematics, documentation, part numbers, computer code, and other relevant data from the design of the original PCB still exist and are available for the team’s use. Any additional power that is needed will be supplied by a secondary power source, instead of solely operating from the USB power. 2.10 Limitations The project solution must operate under the following limitations: A replacement PCB should be of the same dimensions as the original so that it can be replaced in existing products. Optical encoders should be able to be placed in the same location as the current potentiometers so that existing products can be easily upgraded. Cost should be kept within the $150 budget; further funding will have to be requested from Thomas Enterprises The PCB should have all the same connections, inputs, and outputs as the existing PCB. Optical encoders should provide a resolution of at least 1024 positions. 2.11 Expected End-Product and Other Deliverables The end-product includes: Optical encoders that will be used to provide much greater input sensitivity. The optical encoders will be direct replacements for the analog potentiometers that are currently being used. A PCB which receives input from the encoders and pushbuttons and sends output to the computer through a USB cable. The USB interface PCB should be able to discern at least 1024 positions of the steering wheel and foot pedals. The PCB should be of the same external dimensions of the original board so that it may be directly replaced in existing products. 4 The minimum required quality of the end-product is at least of prototype quality, although the higher quality and reliability that the team has time to design and test, the better. If a suitable outside vendor can be found to manufacture the PCBs in high volume for Thomas Enterprises, then it should be fairly simple to implement the circuit design in a way that is robust enough for high volume manufacturing. Thomas Enterprises may also wish to have technical documentation, specifications, and instructions that will fully explain the operation of the encoders and USB interface PCB. 3 Project Approach and Results The approach used to complete the project and the teams results are discussed in this section. 3.1 Functional Requirements The project solution must meet the following functional requirements. Longevity of the product: The new steering wheel controller design with optical encoders should last longer than the potentiometer design and require little or no replacement. Higher resolution: The optical encoders should recognize at least 1024 positions for the steering wheel. This will, in turn, provide a more realistic gaming experience to the end user. 16 function buttons: The controller should maintain the 16 button layout that the current PCB has. 3.2 Resultant Design Constraints The project solution must adhere to the following constraints: Dimensions: The dimensions of the finished PCB should be no larger than the current design of 13.5 cm x 6 cm. Wear and tear: The product should be sturdy and be able to handle racing simulations, which can include long usage periods for the steering wheel and pedals. With the replacement optical encoders, it will no longer be necessary to maintain the internal workings of the controller. USB power requirements: The USB connection will only provide a limited amount of power. An external power supply is needed to provide the current drive for the optical encoders. 3.3 Approaches Considered and One Used This section discusses the approaches considered and used for the various aspects of the video game controller system. 3.3.1 Electrical Design Approach This section describes the approach which was used in considering the design of the electrical components. 5 3.3.1.1 Optical Encoders The optical encoders were provided by the client. The resolution of the encoders is 512 cycles per revolution (CPR). The quadrature encoding scheme provided by the operation of the encoders actually provides a resolution of 2048 positions of the wheel and pedals (explained in design section). This is twice as much resolution compared to the client’s specifications, thus achieves the design goal very well. There was no need to consider another type of encoder for this project. The encoders that were provided exceeded the client’s specifications. The provided encoders also offered a substantial cost savings to the group. The design that was implemented will work with any optical encoder with a two-channel quadrature output. If the client finds a cheaper encoder in the future, it can be installed with no modifications to the hardware or software. 3.3.1.2 Power Supply A 5V DC source was needed to power the optical encoders and also the microcontroller. The previous design used the voltage that came from the USB cable connected to the computer. Due to the additional load of the encoders, the power from the USB cable is not sufficient. A common wall transformer was the best solution in this case because they are cheap, readily available, and most people are familiar with using them in everyday life. A model that can supply 300 mA, at 5% voltage regulation, was chosen because it was the smallest one available and provided more than enough current capability for this application. It would be possible to power the components with battery power. But the controller is meant to be used at a home computer, which assumes a person would have a power outlet nearby. A user would not be capable of moving the controller around while using it anyway, so battery power was not a practical option. The components could also be powered by a DC power supply, but most people don’t own a DC power supply. This was also not considered to be a practical option. 3.3.2 Microcontroller Design Approach This section describes the approaches considered when choosing the microcontroller and designing the program for it. 3.3.2.3 Microcontroller A microcontroller capable of handling at least 10 bit values was needed to handle the higher resolution of the optical encoders. The previous microcontroller was only an 8-bit microcontroller, but was otherwise capable of all functions required. The chip chosen was an updated version of the previous chip. It includes the on-chip USB functionality, not requiring a separate IC for communication with the PC. It also has on-chip flash memory, not requiring a separate IC for storing the controller code. This chip is 16-bit, providing the needed precision for the steering wheel data. It is made by the same company and pin-for-pin compatible with the previous chip, which allowed much of the code to be ported instead of newly written. Other chips provided the functionality needed in terms of precision and features. However, the ability to reuse a large part of the code from the previous chip was a great advantage to the IC which was used, easily being the deciding factor. 6 The previous microcontroller was Microchip’s PIC16C765. This chip is an 8-bit microcontroller with on-chip USB functionality and flash memory for storing microcode. It operates at 6 MHz using an external oscillator. The microcontroller the team decided to use is Microchip’s PIC18F4455. This chip is a 16-bit microcontroller with the same USB functionality and flash memory as the previous one. It is operated at 24 MHz using an external oscillator. This model is available in 40pin PDIP or 44-pin TQFP form factors. The plastic dual-inline-package (PDIP) was chosen because it is pin-for-pin compatible with the previous chip, requiring fewer changes to the board layout. The pin layout of this chip is shown in Figure 1, below. This diagram was taken from the manufacturer's data sheet. Figure 1 - Pin diagram of the PIC18F4455 3.3.2.4 Microcontroller Program The team addressed two major design concerns for the microcontroller program: how to handle the optical encoder input and what language to write the program in. The decoding of the optical encoders and counting could be done using an extra IC or by implementing the functionality into the microcontroller program. Potentially, the decoder/counter IC would make for an easier design and a faster way of decoding and counting. Implementing such functionality in the microcontroller program would require more processing by the microcontroller and extra design time to write the code required. The software approach was used because the PCB would need to be expanded to fit the required ICs. Also, the team felt that the extra processing required by the processor to run the software implementation was small enough that it would not affect the functionality of the design. The program could be written using C or assembly. Normally, the amount of time spent designing, implementing, and testing a program written in C would be significantly less than the time spent doing the same for a program written in assembly. However, 7 assembly was chosen for the team’s design because the microcontroller chosen was so similar to the microcontroller used in the previous design. Only minor adjustments would need to be made to the code used in the previous design. 3.4 Detailed Design This section will detail the design of the electrical components of the video game controller. The necessary components and their interconnection will be explained. 3.4.1 Detailed Electrical Design This section details the design of the electrical components of the video game controller. The necessary components and their interconnection will be explained. 3.4.1.5 Optical Encoders This section explains how the encoders are used to sense the position of the steering wheel and pedals and how the encoders interface with the rest of the components. 3.4.1 Encoder Background Information The purpose of this project is to increase the resolution and sensitivity of the video game steering wheel controller. To achieve this goal the potentiometers that were being used were replaced with optical encoders. The previous design used potentiometers connected to the steering wheel and foot pedals. The potentiometer was used in a voltage divider circuit. The analog voltage across the potentiometer is sampled by the microcontroller. The microcontroller used in the original design has 8 channels of 8-bit analog-to-digital conversion (ADC). The analog voltage is converted to an 8-bit binary word. The microcontroller uses the digital word to keep track of where the steering wheel and foot pedals are, and which way they are moving. The output is eventually sent to the computer through a USB connection that is built into the microcontroller. The previous system was limited by the 8-bit wide channels on the ADC. This only provides, at most, 256 possible positions of the wheel and pedals. The sensitivity was also limited by the analog potentiometers. The output voltage across the potentiometer was not sensitive enough to changes in the angular position of the input shaft. Optical encoders can be purchased in many different levels of resolution. Generally the higher the resolution, the more expensive they are. The type of output generated by the encoder also determines the level of resolution. The client requested that the team implement a resolution of at least 1024 positions per revolution of the steering wheel. 3.4.2 Optical Encoder Operation The most popular type of encoder for applications is an encoder with quadrature output. Quadrature refers to the fact that the signals produced by the encoder are 90° out of phase with each other. The encoder has two channels, A and B, and some models also have an index output. As the input shaft of the rotary encoder is rotated square waves are produced on channels A and B. The rate at which the square waves are produced by the encoder depends on how fast the input shaft is rotated. The direction the input shaft of the encoder is being rotated can be determined by looking at which voltage waveform is leading, channel A or channel B. The index output goes high when both channels A and B are low. The index output will not be used in the design. 8 The most attractive feature of the encoder with quadrature output is that the two square waves give four transitions per cycle, high-to-low and low-to-high on each channel. This effectively increases the resolution by four times the maximum CPR. For the design, an encoder with a maximum cycles per revolution (CPR) of 512 was be used, so that the overall resolution will be 4 x 512 = 2048. The encoder with a CPR rating of 512 was used because it was provided by the client, which provided a significant cost savings to the group. The diagram shown below in Figure 2 illustrates the timing of the output waveforms of the optical encoder. As can be seen, channels A and B are 90° out of phase and the index goes high when both inputs are low. The timing diagram is from US Digital’s data sheet. Figure 2 - Timing diagram of optical encoder quadrature output As mentioned above, monitoring the output channels of the encoder provides information about how fast the input shaft is being rotated and which direction it is being rotated. The most recent state of the encoder’s output channels can be stored in memory and when the channels are sampled the next time, the current state is compared to the previous state. It is necessary that the microcontroller is able to sample the encoders faster than they are capable of changing, or else some transitions will be lost. In general, the clock speed of the microcontroller will be much faster than the speed at which a human would be capable of turning the wheel or moving the pedals. Forward Travel From To 0,1 1,1 1,1 1,0 1,0 0,0 0,0 0,1 Reverse Travel From To 0,1 0,0 1,1 0,1 1,0 1,1 0,0 1,0 Table 1 - Transitions of the encoder output and how they are interpreted 9 The transitions of the encoder output shown above in Table 1 are the desired transitions. There are also unwanted transitions that may occur. The unwanted transitions are: 0,0 to 1,1; 1,1 to 0,0; 0,1 to 1,0; and 1,0 to 0,1. When these transitions occur, it means that at least one state was lost. The microcontroller code must contain instructions to handle these situations. 3.4.2.6 Encoder Selection and Installation This section explains the encoder that was chosen for this project and the issues related to installing it in the video game controller. The optical encoders for this project were provided by the client. The encoder provided is manufactured by US Digital and is the manufacturer’s part number S1-512. The S1 is an incremental rotary shaft encoder with a sleeve bushing and ball bearing. The price for one encoder is $49 and the price for 100 encoders is $39 each. The S1-512 optical encoder is shown below in Figure 3. A mechanical drawing of the encoder is shown in Figure 4, and the dimensions are shown in inches. The following drawings are from the US Digital data sheet. Figure 3 – Optical encoder Figure 4 - Mechanical drawing of the optical encoder 10 The encoders require a 5 V DC supply voltage. The typical supply current for this model and CPR specification is 27 mA, and the maximum input supply current is 30 mA. The encoders require an external DC power supply which will be discussed in Section 3.4.3. Two of the most important characteristics of the optical encoders are the diameter of the input shaft and the CPR of the output. The diameter of the input shaft must be correct so that it can be properly coupled to the steering wheel and foot pedals. Figure 5 shows how the encoder and the steering wheel connect using a rubber sleeve. The output waveforms from the encoder must have a CPR of 256 so that a total resolution of 1024 can be achieved. The encoders that were provided for this design have a CPR of 512, which is more than enough resolution. One encoder will be installed onto the output shaft of the steering wheel. Three encoders will be installed in the foot pedal housing, one for the gas, brake, and clutch. The encoders are installed at the same location of the potentiometers that are currently being used. In Figure 5, the potentiometer can be seen at the top, connected to the steering wheel. Potentiometer Microcontroller USB PCB Figure 5 – Steering wheel components 3.4.3 Power Supply This section discusses the power supply that is needed for the operation of the optical encoders. The previous design did not use an external power supply to the video game controller. The voltage supplied to the circuit came from the USB cable. The encoders require a power input for the LED and circuitry that generates the output signals. The required input is 5 V DC and a maximum current of 30 mA. With a total of four encoders a total maximum of 120 mA needs to be supplied. The USB cable is not be capable of supplying this load, so an external power supply is necessary. 11 The power supply chosen for this design converts 120 V AC, 60 Hz, from the wall outlet into 5 V DC. It has a maximum output current of 300 mA and the output voltage is regulated to within 5%. The manufacturer is CUI Inc. and it can be ordered from DigiKey. The price is $8.10 for one or $5.38 each for one hundred. The manufacturer’s part number is DPR050030-P6P and the Digi-Key part number is T309-P6P-ND. The dimensions of the wall transformer and the plug are shown below in Figure 6. The drawing of the transformer is from the manufacturer’s data sheet and the dimensions are given in millimeters. The drawing of the plug is from Digi-Key and the dimensions are given in inches and millimeters are in parentheses. Figure 6 – Mechanical drawing of the power supply A power jack was installed on the case of the video game controller to accept power from the output plug of the wall transformer. The jack could be installed on the steering wheel assembly or the pedal assembly because both require power. It is more convenient to install the jack on the steering wheel assembly because it is easier to access for the user. A technical drawing and a photo of the jack are shown below in Figure 7 and Figure 8. The drawing and photo are from Digi-Key. 12 Figure 7 - Schematic of the power jack 13 Figure 8 - Photo of the power jack The power jack can also be ordered from Digi-Key. The price is $0.38 for one or $0.26 each for one hundred. The manufacturer is CUI Inc. The manufacturer’s part number is PJ-002B and the Digi-Key part number is CP-002B-ND. Once the power is connected to the video game controller, it must be routed to the encoders. The power from the jack was wired to the encoder connected to the steering wheel. Power also needs to be routed to the pedal assembly and distributed to each of the three encoders for the pedals. The previous design uses a cat 5 cable with RJ-45 connections to connect the steering wheel and pedal assemblies. A standard cat 5 cable consists of 8, 24 American wire gauge (AWG) wires. Of the 8 total wires, 6 carry the output of the encoders to the microcontroller. The remaining two wires can be used to carry power and ground for the power supply to the encoders. According to the Handbook of Electronic Tables and Formulas, the current carrying capacity of 24 AWG wire is 577 mA. Only 90 mA is supplied through these wires, so the cat 5 cable works fine for connecting power between the steering wheel assembly and the pedal assembly. 3.4.4 Circuit Board Design The circuit design was implemented in the Eagle software package. The circuit layout includes three phases: schematic layout, component placement, and board fabrication. 3.4.4.1 Schematic layout All required circuit libraries were included in the software. Andrew Bice has provided CIRAS libraries for some of the specific headers used in the original design, which were adapted to the new circuit layout. The Eagle software uses a graphical interface to place circuit elements, such as resistors, capacitors, and wires. For the schematic portion of the circuit, the layout was not the primary; it only exists to generate a board for the component placement. The schematic was used to check the fabricated PCBs and for reference when testing electrical connectivity. 14 In the Eagle convention, “nets” are used to connect the circuit elements, not to be confused with “wires.” Components were added by clicking on the circuit symbol within Eagle. The team’s hand-drawn circuit was transplanted into Eagle by adding all the circuit elements, reasonably spacing each component, and connecting the appropriate elements to a ground connection. The resistors and capacitors were labeled with incrementing values. Eagle also includes the dimensions of each element for use in the board layout. The new model of Microchip microcontroller was not available in the standard Eagle libraries, so the older model microcontroller was used in the schematic. The previous version is pin for pin compatible with the model in the current design. Since the circuit is not being simulated in Eagle, it was only necessary to model the physical dimensions of a 40 pin DIP socket with the pins labeled accordingly. Lastly, an electrical design rule check was performed within the software. This option checks for any faults and inconsistencies within the schematic. To accommodate for more functionality and for the optical encoders, the resistor count was nearly doubled in the new design. Once the design was verified, the schematic was exported to the board layout component of Eagle. The Eagle schematic editor is shown below in figure 9. Figure 9 - A view of Eagle's schematic editor 15 3.4.4.2 Component placement With a valid schematic, Eagle is able to generate a board design. The schematic was imported into the board function of Eagle. The design constraints were applied to the board area; the original specifications called for a similar sized PCB with the same mounting holes. The component placement is similar to the schematic placement, but with careful attention to the distance between elements and wire dimensions. The ultimate goal of the component placement was to have as little wire between elements as possible, for a cleaner design. This meant putting the appropriate resistors in close proximity to the connections on the microcontroller or headers. Once the components were in place, the wires were routed by the auto routing function; this generates the routing data used for the board fabrication. The mounting holes were placed and the Gerber data was generated, using the CAM processor function. The Gerber data contains the information of board dimensions and component placement. The CAM processor also generates drill-hole locations, routed wires, and any labels on the board. Figure 10 - Board layout 3.4.5 Microcontroller Program Design As is shown in Figure 11, the microcontroller receives input from the four optical encoders and the 16 buttons. Two pins are required for each optical encoder to monitor the A and B channels on the encoders. One pin is required for each of the sixteen buttons. The main program for the microcontroller runs a loop that checks the input, does some computing, and sends data to the USB encoder. The I/O pins used for the encoders and buttons are memory mapped, so reading input only requires reading a predefined memory location. During each iteration of the program’s loop, the I/O pins are read and stored into temporary memory locations. The state of the sixteen push buttons requires no processing, so the data is sent directly to the USB encoder. The processing of the optical encoder input requires just a few steps during each iteration. The current state that was read in the previous step is 16 compared with the previous state to determine if the direction is positive or negative. In this design every change in direction is only one step, so there is no need to calculate the magnitude of change. The stored position is then updated and sent to the USB encoder along with the data from the sixteen push buttons. The USB encoder packages the necessary information and handles the communication between the microcontroller and the driver software on the host that it is connected to. Optical Encoder 1 Optical Encoder 2 Current State Optical Encoder 3 Optical Encoder 4 Buttons 1-16 Previous State Determine Direction Update Position Update State USB Encoder Microcontroller Driver Software Figure 11 – Data flow for microcontroller 17 3.5 Implementation Process Description The implementation process for the various aspects of the system is discussed in this section. 3.5.1 Electrical Design Implementation This section describes the implementation procedure used for the electrical components when assembling the prototype model. 3.5.1.3 Optical Encoder Implementation The encoders were connected with Molex wiring harnesses and wire. An ohm meter was used to verify connectivity between the buttons, wires, and pins and traces on the circuit board. Once connectivity was verified, the wires were soldered into place. The encoder for the steering wheel was connected directly to the circuit board through a Molex connector that connects to the header pins on the periphery of the circuit board. The encoders for the foot pedals connect through a cat-5 cable between the pedal and wheel assemblies. Again, an ohm meter was used to verify connectivity between the cat5 cable and the jumper pins on the circuit board and the socket for the microcontroller pins. For the initial prototype, the encoders were not installed into the brackets that the previous potentiometers were installed into. The encoders were connected electrically, but not to the assemblies mechanically. This allows it to be easier to make changes to the components as prototyping and testing progress. The encoders can be rotated by hand, rather than by the steering wheel or foot pedals. 3.5.1.4 Power Supply Implementation External electrical power coming from the wall transformer plugs into a power plug socket that will be installed on the case of the steering wheel assembly. From the power socket, power is wired to a Molex connector which plugs onto header pins on the periphery of the circuit board. Power is also connected via wire and a Molex connector to the steering wheel encoder. Traces on the circuit board carry power to the RJ-45 socket. The cat-5 cable plugs into the RJ-45 socket, which then carries power to the encoders on the foot pedal assembly. The traces of the circuit board also connect power to the microcontroller. 3.5.1.5 Board fabrication Using the contained files generated from Eagle, the board was fabricated by Advanced Circuits (http://www.4pcb.com). This was a suggested board house from Andrew Bice, as they do not require a minimum order for student projects. The Gerber data was submitted electronically and run through another design check for compatibility with their systems and if the data is consistent. The total cost per board was $33 plus shipping and handling fees. 18 3.5.2 Microcontroller Implementation This section describes how the microcontroller and its program is implemented in the prototype. 3.5.2.6 Microcontroller The board uses a 40-pin DIP socket soldered to the board. This allows the microcontroller to be programmed and inserted after board fabrication. The chip may be removed and reprogrammed easily if future firmware updates are required. 3.5.2.7 Microcontroller Program The microcontroller program was written using Microchip’s PIC18 assembly instruction set. Tasks included converting the program used in the previous design to work on the new processor and implementing the optical encoder decoding and counting. Converting the code was only a matter of updating the names of a few of the SFRs and updating the USB buffers. Also, the new microcontroller has a slightly different method for bank switching and the program was updated to reflect that difference. Implementing the decoding and counting code required the insertion of a small block of assembly code into the programs main function. The completed program was compiled and linked using Microchip’s MPLAB program to create the necessary files required by the boot loader to install the program onto the microcontroller. 3.6 End-Product Testing Description After the circuit board, encoders and all wiring were installed, connectivity was verified with an ohm meter. Connectivity was verified at each connection point, including the header pins on the periphery of the circuit board, and the pin sockets for the microcontroller. After proper connectivity was verified, the various components could be tested. In initial testing, each optical encoder was turned through its full range of motion and tested for proper response across this range. Each of the push-buttons was tested to respond with its appropriate input, when pressed. Success in this test was each component responding with correct values across its operating range for the optical encoders and its activation when pressed for the buttons. In the second phase of testing, the optical encoders were connected to the wheel and pedals. The assembled prototype was tested for integration with the physical devices and continued correct functioning while being used as a game controller, by each of the team members. Success in this test was the prototype effectively serving as the game input device in normal use. In the third and final phase of testing, the prototype was used by non-team members for game input under normal and stressful usage. The testers of this phase attempted to cause the device to malfunction during use through physical strain and unusual input. Damage or errant functioning of the physical components of the prototype outside the scope of the project were not attempted nor tested here. Success in this test was the prototype functioning correctly despite abnormal use. 19 3.7 Project End Results The group has implemented an initial prototype and verified functionality of the software and circuitry. Testing has been performed on common computing platforms, to ensure compatibility. Within the parameters of the provided racing simulation, the steering wheel controller appears to work as expected. 4 Resources and Schedules The resource requirements and schedules are discussed in this section. This section compares the original estimates for financial forecasting and total number of hours for the project. 4.1 Resource Requirements The following sub-section covers the time and money required for the project to be completed successfully. 4.1.1 Personnel Effort Requirements Problem Definition Technology Consideration and Selection End-Product Design End-Product Prototype Implementation End-Product Testing End-Product Documentation End-Product Demonstration Project Reporting Totals The team members have estimated the required effort needed to complete the project tasks successfully. 8 15 60 50 25 15 20 20 213 Fecteau, Peter 10 20 40 40 20 30 20 20 200 Pates, Daniel 8 20 60 40 30 50 10 20 238 Subido, Lorenzo 10 15 50 40 15 40 10 20 200 Combined Effort 36 70 210 170 90 135 60 80 851 Team Member Dahlke, Samuel Table 2 displays the original estimates that were made at the start of the project in terms of the number of hours of work expected to complete each project task successfully in addition to the total time expected to complete the entire project successfully. Figure 12 displays the information graphically. 20 Problem Definition Technology Consideration and Selection End-Product Design End-Product Prototype Implementation End-Product Testing End-Product Documentation End-Product Demonstration Project Reporting Totals Team Member Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Combined Effort 8 10 8 10 36 15 20 20 15 70 60 40 60 50 210 50 40 40 40 170 25 20 30 20 95 15 30 50 40 135 20 20 10 10 60 30 20 40 20 110 223 200 258 205 886 Technology Consideration and Selection End-Product Design End-Product Prototype Implementation End-Product Testing End-Product Documentation End-Product Demonstration Project Reporting Totals Team Member Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Combined Effort Problem Definition Table 3 and Figure 13 show the revised estimates and Figure and 8 5 8 10 31 15 10 15 10 50 12 5 8 20 45 15 16 11 15 57 0 35 25 25 85 2 2 2 2 8 1 1 1 1 4 30 30 26 12 98 83 104 96 95 378 Problem Definition Technology Consideration and Selection End-Product Design End-Product Prototype Implementation End-Product Testing End-Product Documentation End-Product Demonstration Project Reporting Totals Table 4 show the final requirements. 8 15 60 50 25 15 20 20 213 Fecteau, Peter 10 20 40 40 20 30 20 20 200 Pates, Daniel 8 20 60 40 30 50 10 20 238 Subido, Lorenzo 10 15 50 40 15 40 10 20 200 80 851 Team Member Dahlke, Samuel Combined Effort 36 70 210 170 90 135 60 Table 2 – Original personnel effort requirements estimate 21 Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Project Reporting End-Product Demonstration End-Product Documentation End-Product Testing End-Product Prototype Implementation End-Product Design Technology Consideration and Selection Problem Definition 0 50 100 150 Figure 12 – Original personnel efforts requirement estimate 22 200 250 23 Project Reporting Totals End-Product Demonstration End-Product Documentation End-Product Testing End-Product Prototype Implementation End-Product Design Technology Consideration and Selection Problem Definition Team Member Dahlke, Samuel 8 15 60 50 25 15 20 Fecteau, Peter 10 20 40 40 20 30 20 Pates, Daniel 8 20 60 40 30 50 10 Subido, Lorenzo 10 15 50 40 20 40 10 Combined Effort 36 70 210 170 95 135 60 Table 3 – Revised personnel effort requirements estimate 30 20 40 20 110 223 200 258 205 886 Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Project Reporting End-Product Demonstration End-Product Documentation End-Product Testing End-Product Prototype Implementation End-Product Design Technology Consideration and Selection Problem Definition 0 50 100 150 Figure 13 - Revised personnel effort requirements estimate 24 200 250 Problem Definition Technology Consideration and Selection End-Product Design End-Product Prototype Implementation End-Product Testing End-Product Documentation End-Product Demonstration Project Reporting Totals Team Member Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Combined Effort 8 5 8 10 31 15 10 15 10 50 12 5 8 20 45 15 16 11 15 57 0 35 25 25 85 2 2 2 2 8 1 1 1 1 4 30 30 26 12 98 83 104 96 95 378 Table 4 – Final personnel effort requirements 25 Project Reporting End-Product Demonstration End-Product Documentation End-Product Testing Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo End-Product Prototype Implementation End-Product Design Technology Consideration and Selection Problem Definition 0 20 40 60 80 Figure 14 - Final personnel effort requirements 26 100 120 4.1.2 Other Resource Requirements The team has estimated the cost of the required resources needed in order to complete the Materials: Cost Microprocessor $10.00 Optical Encoder $50.00 Miscellaneous Parts $10.00 (Donated) Miscellaneous Resources: Poster $50.00 Total project successfully. $120.00 Table 5 displays the original estimated required resources required and their respective costs. Figure 15 displays the information as percentages of the total projected cost. Table 6 and Figure 27 16 show the Item Catalog 16-bit Microcontroller Microchip 40-Pin DIP PIC Socket Digi-Key revised Manuf. Manuf. Part # estimates and Required Quantities Offered PIC18F4455 1 2 $13.00 ED3740-ND 1 100 $0.91 Catalog Part # Price/Unit To Wires and Connectors $ $ 24MHz Crystal Oscillator Digi-Key CTX026-ND 1 100 $0.57 20pF 500V Capacitor Digi-Key 338-1051-ND 2 100 $0.65 0.1uF 50V Capacitor Digi-Key 399-2054-ND 3 100 $0.11 0.22uF 50V Capacitor Digi-Key 399-2056-ND 1 100 $0.28 1k Resistor Mouser Xicon 291-1k 16 1000 $0.01 1.5k Resistor Mouser Xicon 291-1.5k 1 200 $0.01 100 resistor Mouser Xicon 291-100 20 200 $0.01 RJ-12 Connector Mouser 154-7623PCB 1 100 $0.55 RJ-45 Connector Mouser 154-7641PCB 1 100 $0.65 USB Connector Digi-Key 787780-1-ND 1 100 $0.72 3 Position Header Digi-Key 22-23-2031 WM4201-ND 2 100 $0.23 9 Position Header Digi-Key 22-23-2091 WM4207-ND 2 100 $0.51 6 Position Header Digi-Key 22-23-2061 WM4204-ND 1 100 $0.35 Optical Encoder US Digital S1-512 4 100 $39.00 Power Supply Digi-Key CUI Inc. DPR050030-P6P T309-P6P-ND 1 100 $5.38 Power Jack Digi-Key CUI Inc. PJ-002B 1 100 $0.26 CP-002B-ND Circuit Board Fabrication $ $ Subtotal $ Miscellaneous Resources Poster $ Project Plan Binding $ Design Document Binding $ Final Report Binding $ Subtotal Total Table 7 and Figure 17 28 $ $ Materials: Cost Microprocessor $10.00 Optical Encoder $50.00 Miscellaneous Parts $10.00 (Donated) Miscellaneous Resources: Poster Total $50.00 $120.00 Table 5 – Original other resource requirements estimate 5% Microprocessor Optical Encoder Miscellaneous Parts Poster 26% 64% 5% Figure 15 – Original other resource requirements estimate 29 Required Quantities Offered PIC18F4455 1 100 $1.20 $1.20 Digi-Key ED3740-ND 1 100 $0.91 $0.91 Digi-Key CTX026-ND 1 100 $0.57 $0.57 20pF 500V Capacitor Digi-Key 338-1051-ND 2 100 $0.65 $1.29 0.1uF 50V Capacitor Digi-Key 399-2054-ND 3 100 $0.11 $0.34 0.22uF 50V Capacitor Digi-Key 399-2056-ND 1 100 $0.28 $0.28 1k Resistor Mouser Xicon 291-1k 16 1000 $0.01 $0.10 1.5k Resistor Mouser Xicon 291-1.5k 1 200 $0.01 $0.01 100 resistor Mouser Xicon 291-100 20 200 $0.01 $0.18 RJ-12 Connector Mouser 154-7623PCB 1 100 $0.55 $0.55 RJ-45 Connector Mouser 154-7641PCB 1 100 $0.65 $0.65 USB Connector Digi-Key 787780-1-ND 1 100 $0.72 $0.72 3 Position Header Digi-Key 22-23-2031 WM4201-ND 2 100 $0.23 $0.46 9 Position Header Digi-Key 22-23-2091 WM4207-ND 2 100 $0.51 $1.02 6 Position Header Digi-Key 22-23-2061 WM4204-ND 1 100 $0.35 $0.35 4 100 $39.00 $156.00 Item Catalog 11-bit Microcontroller Microchip 40-Pin DIP PIC Socket 6MHz Crystal Oscillator Optical Encoder Manuf. Manuf. Part # Catalog Part # US Digital S1-512 Price/Unit Total Price Power Supply Digi-Key CUI Inc. DPR050030-P6P T309-P6P-ND 1 100 $5.38 $5.38 Power Jack Digi-Key CUI Inc. PJ-002B 1 100 $0.26 $0.26 Subtotal $170.27 CP-002B-ND Miscellaneous Resources Poster $60.00 Project Plan Binding $10.00 Design Document Binding $10.00 Final Report Binding $10.00 Subtotal Total Table 6 - Revised other resource requirements estimate 30 $90.00 $260.27 3.8% Optical Enco der 3.8% 11-bit M icro co ntro ller P o wer Supply 3.8% M iscellaneo us P arts P o ster P ro ject P lan B inding Design Do cument B inding Final Repo rt B inding 23.1% 59.9% 3.0% 2.1% 0.5% Figure 16 - Revised other resource requirements estimate 31 Item Catalog 16-bit Microcontroller Microchip 40-Pin DIP PIC Socket Digi-Key Manuf. Manuf. Part # Required Quantities Offered PIC18F4455 1 2 $13.00 $13.00 ED3740-ND 1 100 $0.91 $0.91 Catalog Part # Price/Unit Total Price Wires and Connectors $12.00 24MHz Crystal Oscillator Digi-Key CTX026-ND 1 100 $0.57 $0.57 20pF 500V Capacitor Digi-Key 338-1051-ND 2 100 $0.65 $1.29 0.1uF 50V Capacitor Digi-Key 399-2054-ND 3 100 $0.11 $0.34 0.22uF 50V Capacitor Digi-Key 399-2056-ND 1 100 $0.28 $0.28 1k Resistor Mouser Xicon 291-1k 16 1000 $0.01 $0.10 1.5k Resistor Mouser Xicon 291-1.5k 1 200 $0.01 $0.01 100 resistor Mouser Xicon 291-100 20 200 $0.01 $0.18 RJ-12 Connector Mouser 154-7623PCB 1 100 $0.55 $0.55 RJ-45 Connector Mouser 154-7641PCB 1 100 $0.65 $0.65 USB Connector Digi-Key 787780-1-ND 1 100 $0.72 $0.72 3 Position Header Digi-Key 22-23-2031 WM4201-ND 2 100 $0.23 $0.46 9 Position Header Digi-Key 22-23-2091 WM4207-ND 2 100 $0.51 $1.02 6 Position Header Digi-Key 22-23-2061 WM4204-ND Optical Encoder 1 100 $0.35 $0.35 US Digital S1-512 4 100 $39.00 $156.00 Power Supply Digi-Key CUI Inc. DPR050030-P6P T309-P6P-ND 1 100 $5.38 $5.38 Power Jack Digi-Key CUI Inc. PJ-002B 1 100 $0.26 $0.26 Subtotal $294.07 CP-002B-ND Circuit Board Fabrication $100.00 Miscellaneous Resources Poster $60.00 Project Plan Binding $12.00 Design Document Binding $12.00 Final Report Binding $12.00 Subtotal Total Table 7 - Final other resource requirements 32 $96.00 $390.07 16-bit Microcontroller Optical Encoder 3% 3% 3% Power Supply 3% Circuit Board Fabrication Miscellaneous Parts Poster Project Plan Binding 15% Design Document Binding Final Report Binding 41% 5% 26% 1% Figure 17 - Final other resource requirements 4.1.3 Financial Resource Requirements The team has estimated the cost of labor for each team member over the course of the project. Although the team members will be working without pay, for the purposes of the project, adding labor costs adds context to the potential expenses of this project in a real- 33 real-world sense. Materials: Without Labor With Labor Microprocessor $10.00 $10.00 Optical Encoder $50.00 $50.00 Miscellaneous Parts $10.00 $10.00 $70.00 $70.00 $50.00 $50.00 Subtotal Miscellaneous Resources: Poster Labor at $10.50 per hour: Dahlke, Samuel $2,236.50 Fecteau, Peter $2,100.00 Pates, Daniel $2,499.00 Subido, Lorenzo $2,100.00 Subtotal Total $120.00 $8,935.50 $9,055.50 Table 8 displays the original estimated cost of the project with and without labor costs and 34 Table 9 Miscellaneous Resources Poster Project Plan Binding Design Document Binding Final Report Binding Subtotal Labor at $10.50/hour Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Table 10 Item 16-bit Microcontroller 40-Pin DIP PIC Socket Wires and Connectors 24MHz Crystal Oscillator 20pF 500V Capacitor 0.1uF 50V Capacitor 0.22uF 50V Capacitor 1k Resistor 1.5k Resistor 100 resistor RJ-12 Connector RJ-45 Connector USB Connector 3 Position Header 9 Position Header 6 Position Header Optical Encoder Power Supply Power Jack Circuit Board Fabrication Subtotal Total the show Catalog Microchip Digi-Key Digi-Key Digi-Key Digi-Key Digi-Key Mouser Mouser Mouser Mouser Mouser Digi-Key Digi-Key Digi-Key Digi-Key Digi-Key Digi-Key Manuf. Total Price w/o Labor $60.00 $10.00 $10.00 $10.00 $90.00 and Total Price with Labor $60.00 $10.00 $10.00 $10.00 $90.00 $0.00 $0.00 $0.00 $0.00 $0.00 $260.27 revised $2,341.50 $2,100.00 $2,709.00 $2,152.50 $9,303.00 $9,563.27 estimates. Manuf. Part # Quantities Catalog Part # Required Offered Price/U PIC18F4455 1 2 13 ED3740-ND 1 100 0.91 CTX026-ND 338-1051-ND 399-2054-ND 399-2056-ND 291-1k 291-1.5k 291-100 154-7623PCB 154-7641PCB 787780-1-ND WM4201-ND WM4207-ND WM4204-ND Xicon Xicon Xicon 22-23-2031 22-23-2091 22-23-2061 US Digital S1-512 CUI Inc. DPR050030-P6P T309-P6P-ND CUI Inc. PJ-002B CP-002B-ND 1 2 3 1 16 1 20 1 1 1 2 2 1 4 1 1 100 100 100 100 1000 200 200 100 100 100 100 100 100 100 100 100 0.57 0.65 0.11 0.28 0.01 0.01 0.01 0.55 0.65 0.72 0.23 0.51 0.35 39 5.38 0.26 Subtota Table 11 35 and Miscellaneous Resources Poster Project Plan Binding Design Document Binding Final Report Binding Subtotal Labor at $10.50/hour Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Subtotal Total Table 12 show the final requirements. 36 Total Price w/o Labor $60.00 $12.00 $12.00 $12.00 $96.00 Total Price with Labor $60.00 $12.00 $12.00 $12.00 $96.00 $0.00 $0.00 $0.00 $0.00 $0.00 $390.07 $871.50 $1,092.00 $1,008.00 $997.50 $3,969.00 $4,359.07 Materials: Without Labor With Labor Microprocessor $10.00 $10.00 Optical Encoder $50.00 $50.00 Miscellaneous Parts $10.00 $10.00 $70.00 $70.00 $50.00 $50.00 Subtotal Miscellaneous Resources: Poster Labor at $10.50 per hour: Dahlke, Samuel $2,236.50 Fecteau, Peter $2,100.00 Pates, Daniel $2,499.00 Subido, Lorenzo $2,100.00 Subtotal Total $120.00 Table 8 – Original financial requirements estimate 37 $8,935.50 $9,055.50 Required Quantities Offered PIC18F4455 1 100 $1.20 $1.20 Digi-Key ED3740-ND 1 100 $0.91 $0.91 24MHz Crystal Oscillator Digi-Key CTX026-ND 1 100 $0.57 $0.57 20pF 500V Capacitor Digi-Key 338-1051-ND 2 100 $0.65 $1.29 0.1uF 50V Capacitor Digi-Key 399-2054-ND 3 100 $0.11 $0.34 0.22uF 50V Capacitor Digi-Key 399-2056-ND 1 100 $0.28 $0.28 1k Resistor Mouser Xicon 291-1k 16 1000 $0.01 $0.10 1.5k Resistor Mouser Xicon 291-1.5k 1 200 $0.01 $0.01 100 resistor Mouser Xicon 291-100 20 200 $0.01 $0.18 RJ-12 Connector Mouser 154-7623PCB 1 100 $0.55 $0.55 RJ-45 Connector Mouser 154-7641PCB 1 100 $0.65 $0.65 USB Connector Digi-Key 787780-1-ND 1 100 $0.72 $0.72 3 Position Header Digi-Key 22-23-2031 WM4201-ND 2 100 $0.23 $0.46 9 Position Header Digi-Key 22-23-2091 WM4207-ND 2 100 $0.51 $1.02 6 Position Header Digi-Key 22-23-2061 WM4204-ND 1 100 $0.35 $0.35 4 100 $39.00 $156.00 Item Catalog 16-bit Microcontroller Microchip 40-Pin DIP PIC Socket Optical Encoder Manuf. Manuf. Part # Catalog Part # US Digital S1-512 Price/Unit Total Price Power Supply Digi-Key CUI Inc. DPR050030-P6P T309-P6P-ND 1 100 $5.38 $5.38 Power Jack Digi-Key CUI Inc. PJ-002B 1 100 $0.26 $0.26 Subtotal $170.27 CP-002B-ND Table 9 - Revised financial requirements estimate 38 Miscellaneous Resources Poster Project Plan Binding Design Document Binding Final Report Binding Subtotal Labor at $10.50/hour Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Subtotal Total Total Price w/o Labor $60.00 $10.00 $10.00 $10.00 $90.00 Total Price with Labor $60.00 $10.00 $10.00 $10.00 $90.00 $0.00 $0.00 $0.00 $0.00 $0.00 $260.27 $2,341.50 $2,100.00 $2,709.00 $2,152.50 $9,303.00 $9,563.27 Table 10 - Revised financial requirements estimate (continued) 39 Item 16-bit Microcontroller 40-Pin DIP PIC Socket Wires and Connectors 24MHz Crystal Oscillator 20pF 500V Capacitor 0.1uF 50V Capacitor 0.22uF 50V Capacitor 1k Resistor 1.5k Resistor 100 resistor RJ-12 Connector RJ-45 Connector USB Connector 3 Position Header 9 Position Header 6 Position Header Optical Encoder Power Supply Power Jack Circuit Board Fabrication Catalog Microchip Digi-Key Digi-Key Digi-Key Digi-Key Digi-Key Mouser Mouser Mouser Mouser Mouser Digi-Key Digi-Key Digi-Key Digi-Key Digi-Key Digi-Key Total Price Total Price Quantities Price/Unit w/o Labor with Labor Offered Catalog Part # Required $13.00 $13.00 13 2 1 PIC18F4455 $0.91 $0.91 0.91 100 1 ED3740-ND $12.00 $12.00 $0.57 $0.57 0.57 100 1 CTX026-ND $1.29 $1.29 0.65 100 338-1051-ND 2 $0.34 $0.34 0.11 100 399-2054-ND 3 $0.28 $0.28 0.28 100 399-2056-ND 1 $0.10 $0.10 0.01 1000 16 291-1k Xicon $0.01 $0.01 0.01 200 1 291-1.5k Xicon $0.18 $0.18 0.01 200 20 291-100 Xicon $0.55 $0.55 0.55 100 154-7623PCB 1 $0.65 $0.65 0.65 100 154-7641PCB 1 $0.72 $0.72 0.72 100 787780-1-ND 1 $0.46 $0.46 0.23 100 2 WM4201-ND 22-23-2031 $1.02 $1.02 0.51 100 2 WM4207-ND 22-23-2091 $0.35 $0.35 0.35 100 1 WM4204-ND 22-23-2061 $156.00 $156.00 39 100 4 US Digital S1-512 $5.38 $5.38 5.38 100 DPR050030-P6P T309-P6P-ND 1 CUI Inc. $0.26 $0.26 0.26 100 1 CP-002B-ND PJ-002B CUI Inc. $100.00 $100.00 $294.07 $294.07 Subtotal Table 11 - Final financial requirements Manuf. Manuf. Part # 40 Miscellaneous Resources Poster Project Plan Binding Design Document Binding Final Report Binding Subtotal Labor at $10.50/hour Dahlke, Samuel Fecteau, Peter Pates, Daniel Subido, Lorenzo Subtotal Total Total Price w/o Labor $60.00 $12.00 $12.00 $12.00 $96.00 Total Price with Labor $60.00 $12.00 $12.00 $12.00 $96.00 $0.00 $0.00 $0.00 $0.00 $0.00 $390.07 $871.50 $1,092.00 $1,008.00 $997.50 $3,969.00 $4,359.07 Table 12 - Final financial requirements (continued) 4.2 Schedules The following sub-section contains estimated schedules of work proposed by the team and course advisors. Figure 18 displays the original estimated time planned for each of the tasks outlined in the schedule of work in the Project Plan document and the revised estimates. Figure 19 shows the set of deliverables expected from the team over the course of the project. 41 ID 1 Task Name Problem Definition 2 Problem Definition Completion 3 End-User Identification 4 5 Constraint Identification Technology Consideration and Selection 6 Identification of Selection Criteria 7 Technology Research 8 9 Technology Selection End-Product Design 10 Identification of Design Requirements 11 Design Process 12 Documentation of Design 13 End-Product Prototype Implementation 14 Identification of Prototype Limitations and Substitutions 15 16 Implementation of Prototype End-Product Testing 17 Test Planning 18 Test Development 19 Test Execution 20 Test Evaluation 21 Test Documentation 22 End-Product Documentation 23 End-Product Demonstration 24 Demonstration Planning 25 Faculty Advisor Demonstration 26 27 September October November December January February March April 29 5 12 19 26 3 10 17 24 31 7 14 21 28 5 12 19 26 2 9 16 23 30 6 13 20 27 6 13 20 27 3 10 17 24 1 i Company Demonstration Project Reporting 28 Project Plan Development 29 Project Poster Development 30 End-Product Design Report Development 31 Project Final Report Development 32 Weekly Email Reporting Final - Task Revised Estimate - Task Original Estimate - Task Final - SubTask Revised Estimate - SubTask Original Estimate - SubTask Figure 18 – Gantt chart for project tasks 42 ID 1 2 3 4 5 6 7 8 9 10 Task Name September October November December January February March April 29 5 12 19 26 3 10 17 24 31 7 14 21 28 5 12 19 26 2 9 16 23 30 6 13 20 27 6 13 20 27 3 10 17 24 1 Project Deliverables Unbound Project Plan Bound Project Plan Project Poster Unbound Design Report Bound Design Report Unbound Final Report Demonstration Bound Final Report Weekly Email Reports Task Task Progress SubTask SubTask Progress Figure 19 – Gantt chart for deliverables 43 5 Closing Material Project team information is given in this section, followed by a brief summary of the project. 5.1 Project Evaluation This section describes the milestones for the project and the overall success of the project and end-product. Milestone Score Importance Problem definition 100% 5% Research 100% 10% Technology selection 100% 6% End-product design 100% 10% Prototype implementation 100% 15% End-product testing 60% 15% End-product documentation 85% 7% Project reviews 90% 7% Project reporting 95% 15% End-product demonstration 95% 10% Total 91% Table 13 - Project milestone evaluation This project has been a success, as measured against the client’s specifications. The client wanted a resolution of 1024 positions, and this group was able to double the desired resolution to 2048 at no extra cost. The upgraded PCB was required to be of the same dimensions as the original and it was designed as such. The new PCB has been installed in the prototype and directly replaces the previous PCB with no modifications. When the new circuit boards are manufactured in high volume they cost approximately $14, which is about half of the client’s requested cost (not including the cost of the optical encoders, as the client specified). The client also requested that the team maintain the ability to have at least 16 pushbutton inputs. This group was able to increase the number of pushbutton inputs to 23 by only adding some more resistors and header pins to the circuit board. It was necessary to add an external power supply that was not needed in the original design. The cost of the power supply is negligible compared to the total cost of the controller and is not considered a negative aspect of the design. In summary, this group far exceeded the client’s specifications at about half the expected cost. 44 5.2 Commercialization This product is an update of an existing commercial product, so commercialization is definite result of this project. The four original potentiometers cost $12 each, and the new optical encoders are $39 each, so the cost for the unit will be approximately $108 more. The client plans to offer these new components in new products that are sold, and also offered as an upgrade that customers can send to product to have the new components installed. It is not known how the client will price this upgrade. 5.3 Recommendations for Additional Work The prototype meets all specifications from the client at this time. The coding is independent of the type of encoder that is connected to the microcontroller, as long as it has a two-channel quadrature output. The current microcontroller can handle 16 bits of data, thus it could theoretically keep track of 216=65536 positions. Potentially, higher resolution encoders could be added without making any other changes. There are also many more pushbutton inputs possible than are currently being used. The team’s design has already given much room for more resolution and added functionality should the need arise. A possibility for future work could be to add some more electronics to the steering wheel housing. Possibilities include gauges to display RPM, fuel pressure, etc., or LEDs to indicate the status of various features of the race car used in the game. Another possibility would be to add forced feedback response to the steering wheel, but the client has stated that they do not wish to add this feature. 5.4 Lessons Learned The group was able to effectively split up the work on this project using the popular divide-and-conquer approach. Tasks were split up based the expertise of the group members. The group also took advantage of as much of the previous design work and the pre-written code from Microchip as possible. This made the new design much easier because there was a template from which to base the new design. The new microcontroller was so new that it was initially hard to locate from a vendor. It was also not supported on generic programmers. Although the new microcontroller was pin-for-pin compatible, most of the inner workings were redesigned. For example, the oscillator, USB, and memory were all redesigned. The initial datasheet was available, but other resources and support were not in existence. Interesting technical knowledge was gained during this project. The group learned about the use of quadrature encoding and how this scheme increases the resolution of the encoding. The group also received a refresher course in embedded programming by learning the assembly language used in the Microchip microcontrollers. The use of Eagle software, used to layout the circuit board was also learned. Some hands on skills were also developed in soldering and installing the new components on the prototype model. A very important non-technical lesson learned was to make use of previous work as much as possible. This of course does not mean plagiarizing or copying work that has not been authorized to be used. Making use of a previous design and pre-written code greatly simplifies design and saves enormous amounts of time. If following this approach 45 allows the client’s specifications to be met, exceeds expectations, is done on time, and under budget, then it is a great approach to follow. The most important thing to do, if the project could be done over, would be to start implementation and testing earlier. This is a popular statement about what to do over in senior design projects. Much of the first semester is focused on planning and reporting. Implementation and testing tend to get pushed into the second semester. This approach has a tendency for groups to end up with less than the ideal amount of time for debugging, should it prove necessary. 5.5 Risk and Risk Management This sub-section explains the forecasted risks, risks involved and how they were dealt with. 5.5.1 Anticipated Potential Risks and Planned Management Anticipated risks included the protection of all work, including hardware and software used. It was forecasted that most of the work would have taken place in the senior design lab, all PCB designs would have remained in the senior design lab, and any programming would be done in the lab. Components and materials were to be stored in the senior design lab in a secure storage locker. In the event of a team member leaving, it would be in good faith that that team member would not exploit any of the previous work. Though the team documented every team member’s progress, there would have been a chance that some work would not be recoverable. Having Mr. Bice as a resource (Mr. Bice is the original PCB designer), successful project completion should remain feasible. 5.5.2 Anticipated Risks Encountered Throughout the project, the team had not encountered any of the projected risks. The majority of the work was performed outside of the senior design lab and all essential material, both software and hardware, were kept in personal storage. The team maintains the original members with no such loss in productivity. Unanticipated Risks Encountered The unanticipated risks involved in this project included the meeting of deadlines. In particular, the part ordering was a complicated process that required paperwork to be signed; however, it proved to be inefficient and delayed any progress on the project. To keep on schedule, the team decided to have the faculty advisor purchase the necessary parts. Another unanticipated risk was the departure of Mr. Bice. Without his assistance, the team did not have access to an IC programmer made specifically for the model of microcontroller that was used. Since the microcontroller that was chosen was very new, it was not well-supported by generic programmers. However, the team had gotten all previous schematics and code from Mr. Bice before he left, so the team did not lose any work. It was not anticipated that the new microcontroller would not be well supported, because it was so new on the market. The team expected to have full support for simulations and also programming of the device. At the time of this draft of the report the group is still trying to resolve problems with programming the microcontroller. It should be noted that 46 the benefits of using the selected microcontroller outweigh any risks, because it simplified the design cycle so dramatically. 5.5.3 Resultant Changes in Risk Management Because of the unforeseen risk of time management, the team was forced to expedite the process for ordering parts. Additionally, the team increased the frequency of emails or phone calls to advisors, customer service, and technical support personnel, in order to meet deadlines. The group has also reached out to a wide variety of sources to obtain support for programming of the new microcontroller. These resources include Dataman Corporation, ISU CIRAS, faculty advisors, and the EE/CprE department. Seeking out assistance from these sources helped the group move forward when adequate support was not immediately available from the products manufacturer. 5.6 Project Team Information This sub-section includes client, faculty advisor, and team member contact information. 5.6.1 Client Information Thomas Enterprises David Thomas Sr., President David Thomas Jr., Vice President 13859 Buffalo Road Anamosa, IA 52205 319-462-3327 service@thomas-superwheel.com 5.6.2 Faculty Advisors Information Dr. James Davis 2550 Beardshear Ames, IA 50011 515-294-0323 davis@iastate.edu Dr. Douglas Jacobson 2419 Coover Ames, IA 50011-3060 515-294-8307 dougj@iastate.edu 47 5.6.3 May05-26 Team Members Information Samuel Dahlke, CprE 7312 Frederiksen Court Ames, IA 50010 515-572-7972 sdahlke@iastate.edu Peter Fecteau, CprE 6326 Frederiksen Court Ames, IA 50010 515-572-7844 pfecteau@iastate.edu Daniel Pates, EE 205 South 5th Street, Apt. 907 Ames, IA 50010 515-450-4380 dpates@iastate.edu Lorenzo Subido, EE 2355 Wallace Ames, IA 50013 515-572-2090 lsubido@iastate.edu 5.7 Summary Thomas Enterprises, a producer of top-of-the-line gaming and simulation steering wheel controllers, needs to keep their product line competitive. To this end, they wish to use optical encoders to increase the sensitivity in their controllers. The team’s design provides the upgrade that Thomas Enterprises wishes to incorporate into their product line. The end-product includes optical encoders that replace the old potentiometers and a new microprocessor that interfaces properly with the current hardware and software. The design is similar to the previous design and requires minimal, if any, change in the manufacturing process by Thomas Enterprises, allowing them to update the controller product line and existing controllers at low cost. 48