Okay, so, I didn't document this realtime even though I did this assignment many weeks ago (whoops!) and had to come back to this section to fill in what I learned. It's extremely humbling to see how far I've come from week 4 in this class to the end of the semester. It's even more astonishing when given the context that one year ago, I was so terrible at soldering that I thought I'd invent a new way to solder using molding clay. Spoiler alert, that was a terrible idea (although, it made for a cool painting and a funny story - see image below). All that being said, I had never used eagle before this week and over the course of the semester, I fell in love with designing, milling and soldering PCBs in eagle and photoshop.
I've learned a lot!
This semester was my first semester using Eagle, so as a first step, I downloaded the software along with some useful libraries recommended by students who previously took the class including the sparkfun, fab, and ng libraries. Eagle can be extremely intimidating for first time users. The start menu is unintuitive, plus there aren't many similar paradigms in terms of design software. What other program requires you to work off two synchronized files? Anyway, I created a new project, schematic and board, and got to work replicating the example board to the best of my abilities. Pro-tip, there's a command line in Eagle that makes things much easier. The commands I use the most are add (which opens the library to add new components) and ripup ; (which removes all the traces on your board).
Figure 1: My Eagle Schematic
The eagle schematic tab is where you layout the components and connections of your board (without having to route any of the traces). In this particular board, we had several components that needed to be connected to the microcontroller. I thought it might be useful to document what each of these things are and why it's important to connect them correctly on this page.
A microcontroller is a tiny computer packaged into a single integrated circuit. It's typically programmed to perform one (or maybe a few) tasks and execute one specific application. It contains memory, programmable input/output pins as well a processor. Some microcontrollers have reprogrammable pins while others have pins that are meant to perform specific tasks like pulse width modulation or serial communication. The microcontroller for this board is an ATtiny44. By reading the datasheet, I learned things like how to orient the microcontroller on my circuit and which pins are best for specific tasks. In this case, I made sure to connect Tx, Rx, MOSI, MISO, RST and SCK to the appropriately labeled pins. In the case of the latter four pins, those are used to program the board using an ISP header and the microcontroller will not be able to be programmed without those pins being connected in the correct positions. In the case of Tx and Rx, those are used for serial communication through the FTDI cable. Those need to be connected in the correct place to be able to communcate serially with other boards or the computer.
In-system programming (ISP) is used on this board so we can program the ATtiny44 after it's been connected to the milled circuit board. This is a fantastic header because it means we don't require the chip to be programmed prior to installing it into the system. Again, it's extremely important that the ISP header pins are connected to the correct pins on the microcontroller. On the ATtiny44, MOSI is connected to PA6, MISO to PA5, SCK to PA4 and RST to PB3. Additionally, there needs to be a 10K resistor between RST and VCC. To program the board, you could make your own programmer or turn an arduino into a program, following this tutorial.
The FTDI header exists for serial-usb communication. Interestingly, Future Technology Devices International (FTDI) is actually a Scottish privately held semiconductor device company, specializing in Universal Serial Bus (USB) technology. Their devices allow for a microcontroller to communicate with a computer or other microcontrollers. You can make your own FabFTDI cable here or you can buy one. Again, in this specific board, it's important that TX/RX be connected to the correct pins (PA0 and PA1 respectively) for serial communication to work.
A resonator is a device that exhibits resonance or resonant behavior, that is, it naturally oscillates at some frequencies, called its resonant frequencies, with greater amplitude than at others. The oscillations in a resonator can be either electromagnetic or mechanical (including acoustic). For the ATtiny44, there are two internal resonances - 1MHz (by default) and 8MHz. However, for better accuracy or a higher clock rate, you can add an external oscillator at up to 20MHz. The pins again are specific to the resonator. The resonator needs to be connected to CLKI and XTAL.
A capacitor is a little like a battery. Although they work in completely different ways, capacitors and batteries both store electrical energy, however, a capacitor can't produce new electrons, it only stores them. This is useful however, because sometimes VCC isn't constantly supplying power. If it drops out momentarily, the capacitor ensures that power keeps being supplied to the microcontroller. The capacitor needs to be connected to VCC and GND. Orientation doesn't matter, unless you're using a polarized capacitor and then, orientation does matter. Polarized capacitors are clearly labeled.
The push button is exactly what it sounds like... it's a button that can be pressed. Once pressed, the signal on the microcontroller pin changes and that change can be used to trigger events on the microcontroller (or anything it's networked to). Sometimes push buttons need to be debounced. That ensures that there aren't any false triggers on account of the microcontroller continuing to think that there is a new button press if the button has been held down for too long. The button needs a 10K resistor between it's pin on the microcontroller and it's pads.
Lastly, for this board, is the LED. LEDs emit light at a variety of frequencies and can be combined to create full spectrum LEDs. There are even LEDs that you can't visibly see operate as they're in the IR or UV spectrum. LEDs need to be connected in a specific orientation because they are diodes. Additionally, for each LED, the resistor value needs to be calculated as a white LED has different power requirements than a blue LED or a red LED. On this board, I used a red LED, so I added a 1K resistor between it's pin on the microcontroller and it's input pin.
Figure 2: My Original Eagle Board
Figure 3: Routing New Traces
Figure 4: My New Board
Also in eagle, there is a page where you lay out the traces for your board. It can be pretty scary the first time, but it totally gets easier with practice. Since I came back to document this later, I thought it would be fun to retrace my board in the style I acquired over the course of the semester (see above video). I think it's kindof like solving puzzles, trying to plan to use space most effectively to connect all the components appropriately. I think the biggest tips here are to be sure the traces are wide enough to be milled by the endmill and wide enough for the power/current requirements. Additionally, make sure none of the traces are too close together or that could be problematic when you assemble and try to power the circuit. I enjoyed exporting my boards to photoshop this semester and adding custon flair, vias, and outlines to my designs. Additionally, photoshop was super useful for designing/verifying two-sided pcbs. Oh, also, if you mess up and want to rage quit and start over, the command to use is 'ripup ;''. Looking back at my original board and the changes I made, I think it's good to avoid running too many traces under the microcontroller. Additionally, if the board is just impossible to trace, it's totally cool to add a 0 ohm resistor to jump traces. In my new board, I do that to jump VCC over GND.
Figure 5: I like to think of the circuit board in regions
Figure 6: Board from under the bits
Woo! PCB milling is pretty entertaining!
Figure 7: So Shiny and Smooth
Figure 8: My Assembled Board
I cover soldering in another section of my website, but the key here is for everything to flow! You want shiny and smooth joints. Over the course of the semester, I developed a strategy that involved using the tip of the solder to hold my components in place as I waited for the solder joints to cool. Additionally, I found it helpful to lay out my components before soldering (see below), but eventually, I became pretty acclimated to the resources in the CBA electronics lab and no longer needed to lay out components before soldering.
Figure 9: Laying out and Labeling Components