ECE 477 Digital Systems Senior Design Project Rev 9/12 Homework 6: Printed Circuit Board Layout Design Narrative

Team Code Name: _COST Robot______Group No. __7___ Team Member Completing This Homework: __Andrew Loveless______E-mail Address of Team Member:_aloveles@ purdue.edu______

Evaluation:

SEC DESCRIPTION MAX SCORE 1.0 Introduction 5 2.0 PCB Layout Design Considerations - Overall 20 3.0 PCB Layout Design Considerations - Microcontroller 10 4.0 PCB Layout Design Considerations - Power Supply 10 5.0 Summary 5 6.0 List of References 10 App A PCB Layout Top & Bottom Copper Screenshot 20 App B PCB Layout To-Scale Component Side Layout 20 TOTAL 100

Comments: ECE 477 Digital Systems Senior Design Project Rev 9/12

1.0 Introduction The purpose of this project is to design a small robot to completely traverse a maze before returning to the maze entrance. The robot will store the configuration of the maze, along with the location of various colored LEDs along the maze walls. The robot will then revisit these lights in a predetermined order entered by the user. Upon completion of this task, the robot will again return to the starting location where it can be retrieved. The user will be able access a file containing the format of the maze by connecting the robot to a Windows PC with a USB cable. The robot uses 3 general LEDs, 1 RGB LED, 3 ultrasonic range finders, 1 long range laser sensor, 2 motors/wheels, a color sensor, and 2 pushbuttons to realize this functionality. In order to accurately detect the maze configuration, the distance sensors must have unobstructed paths to the walls in front of and beside the robot. To accomplish this, the sensors will be mounted along the side of the robot, on a layer of plastic directly under the PCB. An 8-pin header on the PCB returns the analog voltages sent from each sensor. These analog lines are as isolated as possible to prevent noise from impacting the signals. The 7.4V battery also plugs into a header on the circuit board. The voltage is regulated to 5V and is distributed to the rest of the PCB components. Due to the extremely small size of our circuit board, approximately 4 inches across diagonally, the placement of components around the MCU was of great concern. This careful placement was the most time consuming aspect of the PCB design.

2.0 PCB Layout Design Considerations - Overall The most pressing PCB design constraint is the small surface area of the PCB. The outline of the PCB will sit flush with the edge of the robot. The robot must be small enough that a sufficiently complicated maze can be built for it to traverse without exceeding approximately 6 feet in maze width or length. The initial goal of the PCB was to separate the circuit into several partitions pertaining to each subsystem of the PCB. One purpose of this is to isolate sensitive sensor outputs from high frequency digital lines that might introduce noise to the analog traces, causing inaccurate distance and color light measurements. If the robot was unable to read accurate measurements from these sensors, it would be impossible for it to avoid collisions and accurately record LED locations within the maze. To prevent this issue, the analog input header was placed as closely as possible to the microcontroller. This keeps these traces from passing over or under fast switching, high current digital lines. Though it is generally good practice to

-2- ECE 477 Digital Systems Senior Design Project Rev 9/12 route power traces directly to each section of the PCB over the shortest path available, it was not realistically possible in this design because of the analog trace constraints explained above. A U- shaped path was used to direct power and ground traces to the PCB components, with a branch extending to each major subsystem. In addition to these specific considerations, many general PCB layout guidelines were considered. 16 mil traces were used for all analog and general logic traces on the PCB. 40 mil traces were used for the main 7.4V and 5V power and ground rails. The 5V grounds of each PCB section (USB, sensors, pushbuttons, oscillator, MCU) were tied together at a single node. This node was then tied to the 7.4V ground at the 5V linear regulator. Separate ground planes were used for each subsystem (analog, motor control etc.). These planes were tied together at a single location. Finally to save space, surface mount components were used to whenever possible and decoupling capacitors were placed on the underside of the PCB.

3.0 PCB Layout Design Considerations - Microcontroller The Microchip PIC18F4550 was the microcontroller chosen for the PCB design. It is capable of running at a maximum speed of 8MHz using the internal oscillator. Though this speed may be adequate for the normal operations of the robot, an external oscillator of at least 20MHz is required to use the onboard USB functionality. The CTS CB3 oscillator requires a simple configuration circuit, consisting of a .01µF capacitor and 10KΩ resistor [1]. It requires only one microcontroller port pin to operate properly, and it was connected to pin 30 (Oscillator 1) for this design. .According to the PIC18F4550 datasheet, 0.1µF bypass capacitors must be placed between the power and ground pins of the microcontroller [2]. In order to position the capacitors as close as possible to the 18F4550 power and ground pins, they were placed on the underside of the board, under the microcontroller. This keeps the capacitors from disrupting the traces of the rest of the microcontroller pins. The PIC18F4550 has only two 5V/GND pin pairs, so only two bypass capacitors were needed. The placement of programming and debugging headers were also important considerations in the PCB design. In order to program the microcontroller, a standard female 5-pin PICkit 2 header is required. Since the PICkit connector is sensitive to transmission length, a maximum cable length of 6 inches is recommended [2]. To be conservative, the programming header was

-3- ECE 477 Digital Systems Senior Design Project Rev 9/12 placed as close to the microcontroller as possible, sharing the reset (MCLR) trace with the reset button. For debugging, the microcontroller’s USART will be used to print messages to a terminal and thus it was connected to a 4-pin header. Through testing, the MCU was determined capable of printing messages to the workstation PC reliably over cable lengths as long as 8 feet at a baud rate of 9800 Bd. Because of the protocols robust nature, its placement on the PCB was not of large concern. In order to reach necessary subsystems on the PCB, the microcontroller was placed near the center of the board. This allows the MCU to access all necessary components using relatively short traces. To facilitate easier debugging, four 11-pin female headers were placed around the perimeter of the microcontroller. This allows jumper wires to access any of the PIC18F4550’s 44 pins, and will allow for easy fly-wiring if necessary. Traces radiate outward from the microcontroller headers and pin assignments were changed to prevent overlapping traces where possible. A 16 mil trace width was used for almost all logic traces.

4.0 PCB Layout Design Considerations - Power Supply The robot’s components all run off of one of two supply voltages – 7.4V and 5V. A 2-cell 7.4V Lithium-ion battery will be used to power the robot, and must directly run the L293D H- bridge driver chip and motors [3]. A 3-pin “idiot-proof” connector will be used to plug the battery output into a 3-pin header on the board. The connector, with power in the middle and ground on each side, will function properly no matter which direction it is plugged in. The loss of battery capacity is calculated using a Linear Technology LTC4150 fuel gauge chip. The 7.4V line passes through a 10mΩ “sense” resistor and is decoupled by a 4.7µF capacitor as specified in the fuel gauge data sheet [4]. Immediately afterwards, a fast 0.1µF capacitor and 10µF “bulk” capacitor are encountered. The purpose of this “bulk” capacitor is to recharge the many decoupling capacitors on the PCB. The voltage is then regulated to 5V using a MIC29150 low- dropout regulator. The MIC29150 regulator requires a 0.5 µF capacitor at the input, and a large 10µF capacitor at the output [5]. Voltage from the 5V node is then dispersed, as directly as possible, to all of the other PCB components. The 5V subsystems and 7.4V motor components are placed separately from each other on the circuit board, and their grounds are tied together only at the regulator. Great care was taken to avoid analog signal traces when routing power lines, so very few crossings of the two occur.

-4- ECE 477 Digital Systems Senior Design Project Rev 9/12

In the final PCB design, ground planes were used for each logical subsection of the circuit (analog, motor etc.). These ground planes were tied together at the regulator, providing a direct low impedance path to common ground.

5.0 Summary The COST robot has many PCB requirements that must be carefully considered when completing the circuit board layout. The small 11 square inch surface area of the PCB makes separating analog and digital signals difficult. Noise on the analog lines could greatly impact the robots ability to traverse the maze, so avoiding this was a very high priority objective. The Microchip PIC18F4550 was chosen as the microcontroller for the project. To ensure proper functionality of the MCU, two 0.1µF bypass capacitors are placed between the 5V and GND pins, in accordance to the datasheet guidelines. A 5-pin PICkit header was placed near the microcontroller for in-circuit programming. A 4-pin header was connected to the USART, allowing the MCU to print messages to a computer terminal while debugging. Headers were placed around the MCU, allowing for easy debugging and fly-wiring in the future. A 7.4V 2-cell Lithium-ion battery will be used to power the robot. It directly powers the DC motors, and is regulated to 5V in order to power the majority of the components on the board. All main 5V rails terminate at one main node, and 7.4V and 5V ground traces meet only at the regulator. Ground planes were tied together only at the regulator, maintaining proper isolation of the various subsystems. Decoupling capacitors were used as necessary between all power and ground rails. Two 10µF “bulk’ capacitors were placed near the entrance of power into the PCB, and are used to recharge the rest of the bypass capacitors.

-5- ECE 477 Digital Systems Senior Design Project Rev 9/12

6.0 List of References

[1] CTS Electronic Components. “Model CB3 Oscillator Data Sheet”, [Online], Available: http://www.mouser.com/ds/2/96/008-0256-0_F-26202.pdf . [Accessed February 21, 2012]

[2] Microchip, “28/40/44-Pin, High-Performance, Enhanced Flash, USB Microcontrollers with nanoWatt Technology,” PIC18F2455/2550/4455/4550 Data Sheet, Mar. 2009.

[3] Texas Instruments. “L293 Quadruple Half-H Driver”, [Online], Available: http://www.ti.com/lit/ds/symlink/l293d.pdf . [Accessed February 21, 2012]

[4] Linear Technology. “LTC4150 Battery Gas Gauge Data Sheet”, [Online], Available: http://cds.linear.com/docs/en/datasheet/4150fc.pdf . [Accessed February 21, 2012]

[5] MICREL. “MIC29150 Low-Dropout Regulator Data Sheet”, [Online], Available: http://www.micrel.com/_PDF/mic29150.pdf . [Accessed February 21, 2012]

-6- ECE 477 Digital Systems Senior Design Project Rev 9/12

Appendix A: PCB Layout Top & Bottom Copper

Figure 1: PCB – Top Layer .

Figure 2: PCB – Bottom Layer

-7- ECE 477 Digital Systems Senior Design Project Rev 9/12

Figure 3: PCB – Both Layers

-8- ECE 477 Digital Systems Senior Design Project Rev 9/12

Appendix B: PCB Layout To-Scale Component Side Layout

Figure 4: PCB – Both Layers (approximately to scale)

-9-