Week 6: Micro-controller and Programming

Step 1: Design the Board

David Cranor gave us a very helpful introduction to Ohm's Law. Using the free version of Eagle, I modified the board design to accomodate a button and a LED 1206. I added a resistor for each of these components, though I understand that it wasn't absolutely required for the button. Learning how to use Eagle was not so bad. We loaded Neil's components library for the additional parts. I ran "ERC" and "DRC" on the schematic and board drawings, respectively, and corrected as required. In general I like Eagle so far, because it automatically coorindates between the schematic and the board design, and because RATSNEST is helpful. We exported to PNG at 600 dpi:

PNG of board design

Step 2: Mill the Board

Given my track record with Modela, I was nervous about getting my board milled smoothly. The Modela in the architecture lab was acting badly during my sign-up time, so I went to the CBA shop instead and milled my board there. I used speed:3 and depth: -.125 because I am paranoid about not getting the Z axis zero'ed well. And amazingly, my board was milled successfully on first try, without me breaking any bits! I did have to use an exacto blade to trim out a portion at the processor.

Milling at CBA shop

Step 3: Stuff the Board

I wasn't sure how to figure out the values for the resistors I added. For the button I used the standard 10K, and for the LED I used 1K. Also, the tiny LED did not have any arrows on it, but had one end that was colored versus not. Colored is Cathode and not is Anode, and energy flows from A to C, so the green part had to be away from the power source.

Stuffing is fun!

Step 4: Programming

Now the moment of truth... I used the FabISP I made a few weeks ago and connected that to the new board. David Carr gave us an excellent introduction to the anatomy of the processor, how it thinks, and the relationship between the C language and the complier, and the various libraries that expand on that language. We went through how to make the MAKE program and the program file itself. I noted how to adjust the example to my specific board.

It is kind of crazy to me that everything is basically done in simple text editor programs and terminal. I was nervous because I wasn't sure if my board was stuffed properly, or if there were any shorts or defective parts. At first I just connected the FabISP to my computer, and then my microcontroller to the FabISP, and unlike Akito's, my LED didn't automatically turn on, which made me nervous. So I re-flowed all the lines again on my board, then in terminal I went to the folder with the make program and the programming file, and typed in "MAKE." The computer did some stuff and read "Error 1" : not connected to mini USB. So I connected again, but with the microcontroller connected back to my computer, and typed in "MAKE PROGRAM." That seemed to work.

Then I went into the program file and checked the port names (I had some typos) and after some fiddling IT WORKED!!

Chronicle of me "programming."

Light turns on when button is pushed!!! AMAZING.

Step 5: Customize!

I programmed my board to blink to a famous melody (don't know what it's called) when the putton is pushed. Here's my program: