Optical Encoder for a Game Steering Wheel



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, May 02, 2005

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 5

3.3.1 Electrical Design Approach 5

3.3.1.1 Optical Encoders 6

3.3.1.2 Power Supply 6

3.3.2 Microcontroller Design Approach 6

3.3.2.3 Microcontroller 6

3.3.2.4 Microcontroller Program 7

3.4 Detailed Design 8

3.4.1 Detailed Electrical Design 8

3.4.1.5 Optical Encoders 8

3.4.1.6 Encoder Background Information 8

3.4.1.7 Optical Encoder Operation 8

3.4.1.8 Encoder Selection and Installation 10

3.4.2 Power Supply 12

3.4.3 Circuit Board Design 15

3.4.3.1 Schematic layout 15

3.4.3.2 Component placement 17

3.4.4 Microcontroller Program Design 17

3.5 Implementation Process Description 19

3.5.1 Electrical Design Implementation 19

3.5.1.3 Optical Encoder Implementation 19

3.5.1.4 Power Supply Implementation 19

3.5.1.5 Board fabrication 19

3.5.2 Microcontroller Implementation 20

3.5.2.6 Microcontroller 20

3.5.2.7 Microcontroller Program 20

3.6 End-Product Testing Description 20

3.7 Project End Results 21

4 Resources and Schedules 21

4.1 Resource Requirements 21

4.1.1 Personnel Effort Requirements 21

4.1.2 Other Resource Requirements 28

4.1.3 Financial Resource Requirements 32

4.2 Schedules 37

5 Closing Material 40

5.1 Project Evaluation 40

5.2 Commercialization 41

5.3 Recommendations for Additional Work 41

5.4 Lessons Learned 41

5.5 Risk and Risk Management 42

5.5.1 Anticipated Potential Risks and Planned Management 42

5.5.2 Anticipated Risks Encountered 42

5.5.3 Resultant Changes in Risk Management 43

5.6 Project Team Information 43

5.6.1 Client Information 43

5.6.2 Faculty Advisors Information 43

5.6.3 May05-26 Team Members Information 43

5.7 Summary 44

2 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 11

Figure 5 – Steering wheel components 12

Figure 6 – Mechanical drawing of the power supply 13

Figure 7 - Schematic of the power jack 14

Figure 8 - Photo of the power jack 15

Figure 9 - A view of Eagle's schematic editor 16

Figure 10 - Board layout 17

Figure 11 – Data flow for microcontroller 18

Figure 12 – Original personnel efforts requirement estimate 23

Figure 13 - Revised personnel effort requirements estimate 25

Figure 14 - Final personnel effort requirements 27

Figure 15 – Original other resource requirements estimate 28

Figure 16 - Revised other resource requirements estimate 30

Figure 17 - Final other resource requirements 32

Figure 18 – Gantt chart for project tasks 38

Figure 19 – Gantt chart for deliverables 39

4 List of Tables

Table 1 - Transitions of the encoder output and how they are interpreted 10

Table 2 – Original personnel effort requirements estimate 22

Table 3 – Revised personnel effort requirements estimate 24

Table 4 – Final personnel effort requirements 26

Table 5 – Original other resource requirements estimate 28

Table 6 - Revised other resource requirements estimate 29

Table 7 - Final other resource requirements 31

Table 8 – Original financial requirements estimate 33

Table 9 - Revised financial requirements estimate 34

Table 10 - Revised financial requirements estimate (continued) 35

Table 11 - Final financial requirements 36

Table 12 - Final financial requirements (continued) 37

6 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.

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.

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 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.

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.

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

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.

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.

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.

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.

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. 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.

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.

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.

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.

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.

Project Approach and Results

The approach used to complete the project and the teams results are discussed in this section.

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.

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 Approaches Considered and One Used

This section discusses the approaches considered and used for the various aspects of the video game controller system.

2 Electrical Design Approach

This section describes the approach which was used in considering the design of the electrical components.

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.

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 Microcontroller Design Approach

This section describes the approaches considered when choosing the microcontroller and designing the program for it.

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.

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 40-pin 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.

[pic]

Figure 1 - Pin diagram of the PIC18F4455

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, 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.

1 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.

4 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.

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.

5 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.

6 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.

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.

[pic]

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.

[pic]

Table 1 - Transitions of the encoder output and how they are interpreted

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.

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.

[pic]

Figure 3 – Optical encoder

[pic]

Figure 4 - Mechanical drawing of the optical encoder

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.

[pic]

Figure 5 – Steering wheel components

7 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.

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 Digi-Key. 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.

[pic] [pic]

[pic]

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.

[pic]

Figure 7 - Schematic of the power jack

[pic]

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.

8 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.

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.

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.

[pic]

Figure 9 - A view of Eagle's schematic editor

7. 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.

[pic]

Figure 10 - Board layout

9 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 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.

[pic]

Figure 11 – Data flow for microcontroller

1 Implementation Process Description

The implementation process for the various aspects of the system is discussed in this section.

10 Electrical Design Implementation

This section describes the implementation procedure used for the electrical components when assembling the prototype model.

8. 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 cat-5 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.

9. 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.

10. Board fabrication

Using the contained files generated from Eagle, the board was fabricated by Advanced Circuits (). 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.

11 Microcontroller Implementation

This section describes how the microcontroller and its program is implemented in the prototype.

11. 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.

12. 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.

1 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.

2 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.

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.

1 Resource Requirements

The following sub-section covers the time and money required for the project to be completed successfully.

2 Personnel Effort Requirements

The team members have estimated the required effort needed to complete the project tasks successfully. 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. Table 3 and Figure 13 show the revised estimates and Figure and Table 4 show the final requirements.

[pic]Table 2 – Original personnel effort requirements estimate

Figure 12 – Original personnel efforts requirement estimate

[pic]Table 3 – Revised personnel effort requirements estimate

Figure 13 - Revised personnel effort requirements estimate

[pic]Table 4 – Final personnel effort requirements

[pic]

Figure 14 - Final personnel effort requirements

4 Other Resource Requirements

The team has estimated the cost of the required resources needed in order to complete the project successfully. 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 16 show the revised estimates and Table 7 and Figure 17

[pic]

Table 5 – Original other resource requirements estimate

Figure 15 – Original other resource requirements estimate

Table 6 - Revised other resource requirements estimate

[pic]

Figure 16 - Revised other resource requirements estimate

[pic]

Table 7 - Final other resource requirements

[pic]

Figure 17 - Final other resource requirements

5 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-world sense. Table 8 displays the original estimated cost of the project with and without labor costs and Table 9 and Table 10 show the revised estimates. Table 11 and Table 12 show the final requirements.

[pic]

Table 8 – Original financial requirements estimate

Table 9 - Revised financial requirements estimate

[pic]Table 10 - Revised financial requirements estimate (continued)

[pic]Table 11 - Final financial requirements

[pic]Table 12 - Final financial requirements (continued)

1 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.

Figure 18 – Gantt chart for project tasks

[pic]

Figure 19 – Gantt chart for deliverables

Closing Material

Project team information is given in this section, followed by a brief summary of the project.

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.

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.

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.

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 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 Risk and Risk Management

This sub-section explains the forecasted risks, risks involved and how they were dealt with.

2 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.

3 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 the benefits of using the selected microcontroller outweigh any risks, because it simplified the design cycle so dramatically.

4 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.

1 Project Team Information

This sub-section includes client, faculty advisor, and team member contact information.

5 Client Information

Thomas Enterprises

David Thomas Sr., President

David Thomas Jr., Vice President

13859 Buffalo Road

Anamosa, IA 52205

319-462-3327

service@thomas-

6 Faculty Advisors Information

Dr. James Davis Dr. Douglas Jacobson

2550 Beardshear 2419 Coover

Ames, IA 50011 Ames, IA 50011-3060

515-294-0323 515-294-8307

davis@iastate.edu dougj@iastate.edu

7 May05-26 Team Members Information

Samuel Dahlke, CprE Peter Fecteau, CprE

7312 Frederiksen Court 6326 Frederiksen Court

Ames, IA 50010 Ames, IA 50010

515-572-7972 515-572-7844

sdahlke@iastate.edu pfecteau@iastate.edu

Daniel Pates, EE Lorenzo Subido, EE

205 South 5th Street, Apt. 907 2355 Wallace

Ames, IA 50010 Ames, IA 50013

515-450-4380 515-572-2090

dpates@iastate.edu lsubido@iastate.edu

1 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.

-----------------------

Previous State

Update Position

Update State

Microcontroller

USB

[pic]

Optical Encoder 4

[pic]

[pic]

PCB

Potentiometer

[pic]

Optical Encoder 1

Optical Encoder 3

Optical Encoder 2

Buttons 1-16

Current State

Determine Direction

USB Encoder

Driver Software

Microcontroller

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches