18#549’embeddedsystem’design:’lab1’pcbdesign’ece549/docs/lab1/549-lab-1.pdf · •...
TRANSCRIPT
1
18-‐549 Embedded System Design: Lab 1 PCB Design Assigned: Monday 01/22 Due: Monday 02/02 AoE The purpose of this lab is to gain hands-‐on experience with PCB design so that you can create your own hardware modules for the project. The goal will be to design a simple embedded system with a sensor, microcontroller and actuator. In the following two labs, you will then assemble these boards by hand, add a bootloader and program them with your own firmware. You are free to choose your own sensor and actuator components (within reason <$20), so think in terms of a platform that will be easy to demonstrate to the course staff. For example, a board that sounds an alarm as the sun rises might use a light sensor and a piezo buzzer. Hand-‐in Procedure:
• This lab is to be done individually. Every student is responsible for handing in his or her own design. Each team will pick their favorite of the four designs to move on towards labs 2 and 3.
• You will be required to hand-‐in the following in your team’s folder on AFS (XX is your assigned team number):
o /afs/ece.cmu.edu/class/ece549/teams/teamXX/lab1 o /lab1/andrew-‐id/eagle (2 files) o /lab1/andrew-‐id/gerber (5+ files) o /lab1/andrew-‐id/bom.csv (1 file)
Grading:
• Your submissions will be graded based on correctness, effective use of space and aesthetics.
Item Points Score Schematic 6 Customization (voltage regulator) 2 Customization (sensor and actuator) 4 Layout 8 Gerber + Bill of Materials (BOM) 2 Total 22
2
Installing EAGLE Step 1. Download the EAGLE CAD software at http://www.cadsoftusa.com/download-‐eagle/ Step 2. Install EAGLE, choosing the “Run as Freeware” option during install. PCBs designed with the freeware version are limited to two layers and have a size restriction. The freeware version is, however, more than adequate for most designs. Step 3. We’ll need to download some libraries of parts to use in our design. SparkFun has a good collection at https://github.com/sparkfun/SparkFun-‐Eagle-‐Libraries. Click “Download ZIP” and unzip the archive. Copy all of the *.lbr library files into the EAGLE-‐7.1.0/lbr/ directory. Step 4. Open EAGLE! Expanding the Libraries list, you should be able to see the SparkFun libraries that you just added. For this project, we’ll want to have access to all the libraries, so right-‐click on Libraries and select “Use all”.
Step 5. Open up Projects >> examples >> arduino to explore an example of what can be designed with EAGLE. Two windows should open up, a Schematic window and a Board window. These two windows are interconnected, so an edit made in one window is immediately reflected in the other. Move and zoom into various parts of the design by scrolling and clicking the scroll wheel.
3
Part 1(a): The Schematic (6 points) Step 6. We’re now ready to create a new project. Every PCB project starts with a schematic first, where you wire up your components, and is then followed by board layout, where you will place your components. Right-‐click on Projects >> eagle and create a new project. Name it 549-‐[andrewid], using your andrewid. Right-‐click on your project and create a new schematic. Save it with the 549-‐[andrewid].sch file name.
Step 7. Let’s add our first parts. In your schematic window, click the Add tool to open up the Parts Menu. We’ll first add a frame, which will put an easthetic border around our schematic. Enter “frame*” in the Parts Menu search bar and double click the FRAME-‐LETTER part. Drop the frame into your schematic and hit ESC. Next, search “atmega*” and add a ATMEGA328_PDIP part into the middle of your frame. Now save the schematic, and remember to save periodically! Your schematic should now look something like this…
Step 8. The Atmega328 microcontroller isn’t very interesting by itself, so let’s add some LEDs for it to actuate. Use the Add tool to drop an LED1206, then a RESISTOR1206, and finally a GND. Use right-‐click to turn the parts before placing them.
4
Step 9. Use the Copy and Move tools to create a duplicate of each part. You should end up with something that look like the following…
Note: To move a group of parts, use the Group tool to select a group, click the Move tool, then Ctrl-‐right-‐click (⌘-‐right-‐click).
Step 10. It’s time to connect the components. This is done using the Net tool. Draw connections between the components to wire them up.
Use the Value tool to assign values of 330 to the resistors. This will serve as documentation later, reminding us to use 330 Ohm resistors.
Note: There is a tool called the Wire tool which also draws wires, but is not useful for connecting components. Avoid this tool, and don’t confuse it for the Net tool!
5
Step 11: Next, let’s add some headers. These will be very useful for prototyping and interfacing with other boards. Drop two M08 and connect them to the pins of the chip. Making VCC and GND easily accessible is always a good idea, so let’s put those in as well.
Step 12: The microcontroller will need power to drive it and an oscillator to keep it ticking. Bypass capacitors will help mitigate electrical noise. The RESET line has to be connected to Vcc, otherwise the micro will be in a state of constant reset. Build the following additions using: CRYSTALTXC-‐7A, CAP1206, RESISTOR1206, VCC, GND. Assign the two bypass capacitors values of 0.1uF, the two clock capacitors values of 18pF, and the pull-‐up resistor a value 10K.
6
Step 14: The board needs two types of headers that will later be used for programming. Let’s also add a reset button and some mounting holes while we’re at it. You’ll notice that, in the image, we’re not directly connecting the parts to anything. This will be covered in the next step. Build the circuit out of: AVR_SPI_PRG_6PTH, SWITCH-‐MOMENTARY-‐2SMD-‐REDUNDANT, ARDUINO_SERIAL_PROGRAMPTH, STAND-‐OFF, VCC, GND
Step 15: In many instances, it might be inconvenient to draw explicit connections between components. That is why EAGLE has a feature that allows us to connect wires by labeling them.
Use the Label tool to assign a label to a wire and then use the Name tool to change the label’s name. Wires are implicitly connected when they are labeled with the same name. When connecting two separate wires, EAGLE will prompt you about the new connection. Connect the following, and make sure to double check once you’re done. Every non-‐terminating wire should now be connected to something.
7
Note: Pay special attention to the DTR and RESET labels. DTR should be connected to RESET through a CAP1206, which has to be added. Give the capacitor a value of 0.1uF.
Step 16: Your schematic should now looks something like this. Don’t forget to save!
Important: EAGLE has a built-‐in Electrical Rule Check which will notify you of any obvious electrical issues. Make sure to run this! The ERC will be run during the grading process. ("...has no value" warnings are probably okay, just make sure your resistors and caps have values.)
8
Part 1(b): High Voltage (2 points) Step 17. So far, we’ve been taking for granted that Vcc is going to supply power to the board. But where is Vcc going to come from? You may find yourself in a situation where the only power source available is a 12.0 V source, such as a car battery or an AC adapter. You will need to ensure that your system incorporates a voltage regulator to lower the high voltage to a Vcc usable by the microcontroller (between 1.8 V and 5.0 V for the ATmega328). Add a voltage-‐regulating circuit to your schematic (no visual help for this step). Build it using one POWER_JACKPTH, one V_REG_MIC2920, one VCC, one GND, and one or two mystery components which are almost always found hanging out near voltage regulators. Assume the DC power jack will have a 12.0 V source plugged in.
Hint: Even though the part name for the voltage regulator contains “MIC2920”, we will be buying a close substitute, the MIC5209. It is well-‐documented online. Hint: The top connection on POWER_JACKPTH is the positive voltage. The bottom two should both be connected to GND. Hint: You will likely get "OUTPUT and SUPPLY pins mixed..." ERC errors after connecting the voltage regulator. You can safely ignore these.
9
Part 1(c): Sense/Actuate (4 points) Step 18: Time to customize your design! For this part of the lab, you must integrate sensing and actuation into your PCB. Spend some time looking at various types of sensors and browsing resources such as Digikey, Sparkfun, and EAGLE’s list of parts. Sensors and actuators will almost always fall into one of two categories: analog or digital. Most analog sensors report their values as a voltage that can be measured by the microcontroller’s ADC. Digital sensors send values to the microcontroller over a digital communication interface such as I2C, SPI, or UART. You are required to add one or more multi-‐bit sensor and actuator. At the end of lab 3, we want you to show that the sensor and actuator are functional, so spend some time thinking about a configuration that is easy to demonstrate. Most classes of sensors are available in both analog and digital variants, including various types of sensors for audio, light, temperature, humidity, barometric pressure, acceleration, orientation, and many other phenomena. There also exist a multitude of actuators that enable you to control these same phenomena. All sensors and actuators have their own specifications and unique characteristics, so always read the datasheet carefully! (Three concrete examples of devices to get started: HIH6130 Humidity Sensor, ACS712 Hall-‐Effect Current Sensor, MCP4725 DAC)
10
Part 2: Layout (8 points)
Step 17: To begin laying out the components on the PCB, click Switch to Board to open up a new Board window. This will create a new layout environment from your schematic.
Note: EAGLE expects that when you are working on a project you will keep both the Schematic and Board windows open at all times. Any changes made in one window when the other window is closed are not transferred over to the other window. Losing consistency between windows is a common and very silly way of ruining a perfectly good design! EAGLE will tell you that one of your windows is closed with the following warning…
11
Step 18: Having a grid will make layout a lot easier. Open the Grid options, turn on the grid, and set it to the following options:
Step 19: The rectangular outline represents the dimensions of your PCB. Use the Move tool to change the PCB dimensions to 2.0 inches x 2.0 inches (top-‐left corner of the screen shows measurement information). Then, move the mounting holes so that they are situated in the corners of the board. You can make the board slightly larger to accommodate your custom components, but be warned that unnecessarily large board will lose points.
12
Step 20: Move the ATMEGA328_PDIP microcontroller into the middle of the PCB, rotating it (right-‐click), so that the groove on the chip points up. Place the appropriate M08 header on the right side of the PCB. Also, place the AVR_SPI_PRG_6PTH header, SWITCH-‐MOMENTARY-‐2SMD-‐REDUNDANT button, and one of the CAP1206 bypass capacitors. To precisely position components between grid lines, hold down the Alt key.
When moving components, periodically use the Ratsnest tool to recalculate the shortest airwires between parts. Airwires are the floating lines which serve as useful guides during routing. Airwires show what connections have yet to be completed, and they dissappear as the connections are completed. When placing components, avoid long airwires and airwires that cross; this will make your life a lot easier during the routing process.
Step 21: Use the Route tool to manually route the connections between the microcontroller and the header. Before drawing routes, select the Top Layer (red), change the routing Width to 0.01 inches, select Via Round as your via type, and choose a Drill size of 0.27559 inches. (It's recommended that you stick with Wire bend style 1 during routing.) To switch between the top and bottom layers of your board while you're routing, click the scroll wheel. This will automatically put down a via for you. In a clean layout, most traces should not have to traverse both layers. A majority of the routes on your board should occupy the top layer (red). Too many bottom layer (blue) routes and too many vias might be a sign that you should reconsider the placement of your components.
13
While the image below can be used as a starting point, it is a good idea to finish placing all of your components before you start routing. You will at some point find yourself wanting to move an already-‐routed component; for this, use the Ripup
tool to "rip up" your routes. Finally, use the Text tool to leave your team signature in the format "teamXX" somewhere on the Top (red) copper layer. Change the Ratio to at least 14% and set the Font to vector.
Note: EAGLE has an Autorouting feature. While the Autorouter is interesting to play with, it pretty much only generates examples of how NOT to route your board. This is because the Autorouter is only good at connecting A to B; it has no understanding of the components being connected. It is strongly recommended that you do NOT use the autorouter, assuming you value your honor and your grade on this lab.
Separate from the Electrical Rule Check, EAGLE also has a Design Rule Check, which will check your board for layout errors. Make sure you use this feature! You now have everything you need to place and route the rest of your components and
complete your design! Good luck!
14
Part 3: Generating Gerber Files and BOM (2 points) Step 22: The Gerber format is an open vector image file specification that is used by most PCB fabrication houses to generate your boards. Each layer of the board (copper, solder mask, silkscreen, etc) is stored in a different Gerber file. In order to generate a gerber file, first go to the CAM processor (File-‐>CAM processor) in eagle.
Next, go to the File menu, then go Open > Job…. In the file browser that opens, select the 18549-‐274x.cam file that you just downloaded from the 549 website. The CAM processor window should have a series of tabs: “Top Copper”, “Bottom Copper”, “Top Silkscreen”, etc. Each of these tabs define how to create one of the gerber files. Now all you have to do is click Process Job. If you haven’t saved recently, it’ll prompt you to. The gerber generation process should be pretty quick. Once it’s run its course, have a look in your project directory, which should have loads of new files in it. In addition to the board (BRD) and schematic (SCH) files, there should now be a .dri, .GBL, .GBO, .GBS, .GML, .gpi, .GTO, .GTP, .GTS, and a .TXT.
Gerber File Extension Bottom Copper GBL Bottom Silkscreen GBO Bottom Soldermask GBS Top Copper GTL Top Silkscreen GTO Top Soldermask GTS Drill File TXT Drill Station Info File dri Photoplotter Info File gpi Mill Layer GML Top Paste GTP
15
Step 23: You should sanity check the Gerber files by opening them in a gerber view program. In OS X and Linux gerbv is a good option. For Windows, you can download Pentalogix. These programs will be able to open the copper layers, but will not know how to read the tool list and drilling data. Make sure to check that the gerber files look correct before submitting! Step 24: For any of your custom sensor parts, please also submit a “Bill of Materials” files commonly called a BOM. Use the template spreadsheet file from the website as a reference. Step 25: Upload everything into your directory to your team’s space on AFS.
• /afs/ece.cmu.edu/class/ece549/teams/teamXX/lab1 • ../lab1/andrew-‐id/eagle/ (.sch,.brd) • ../lab1/andrew-‐id/gerbers/ (.GTL, .GBL, .GTS, .GBS, .GTO, .TXT, .DRI) • ../lab1/andrew-‐id/bom.csv
The End!
16
Revision History (01/27/15):
• page 4, step 10: Use of the Value tool • page 5, step 11: M081X08 deprecated, replaced with M08 • page 5, step 12: Use of the Value tool (again) • page 6, step 15: Use of the Value tool (once more) • page 7, step 16: ERC clarification • page 8, step 17: Additional hints • page 9, step 18: "must integrate sensing AND actuation" • page 11, step 19: Change in recommended board dimensions • page 12, step 20: Expanded step, part placement clarifications • page 12, step 21: Expanded step, routing clarifications • page 15, step 25: Updated list of gerber files