Week Five: Electronics Design

the eagle has (crash) landed...


Redraw the echo hello-world board, add a button and LED (with current-limiting resistor), check the design rules, and make it.



Here are images of my design from Eagle and the resulting board:


Here are the Eagle files for the board:


Board design

I created my board in Eagle on Windows. Eventually I got Eagle working on Ubuntu as well, though this took a few extra steps (described in Trials and Tribulations). To keep the board and the schematic linked in Eagle, I started a new board before adding anything to the schematic. Once these were open, I added the components for the board to the schematic using primarily the Fab and the Sparkfun libraries. This included the components named on the hello-world board, as well as a button, a green LED, and a 499 Ohm resistor. I then connected the components in the schematic using wire, added intersections when necessary, and used route to put down the traces in the board file. This required using the rotate and move tools to shuffle around the components. The information tool helped with component labeling, ratsnest helped simplify the connections, and escape got me out of some sticky situations.

Once everything was connected, I added the cut lines for the board by turning on the dimension layer, resizing it, and changing the line width to 0.032. I then verified the board using erc and drc in the Tools menu. After fixing a few disconnected components, I saved two image files to print--one with just the dimension layer and one with the traces (top, bottom, vias). The files must be saved at 1500 dpi in black and white as a png. Once the images were written out, I aligned and resized them in Gimp, making sure the background was black and the traces were white.

Thanks to Valentin Heun for the Eagle tutorial and the circuit design advice.

Making the board

I created the board using the MODELA milling machine. I followed the same process we used for creating the FabISP board a few weeks ago. I ran into a few minor issues that slowed me down a bit, but overall the process was fairly straight forward.

Programming the board (plus or minus)

After making the board I wanted some sort of confirmation that it worked! So I decided to try programming it using the hello.ftdi and the hello.blink files from last year. I began with the hello.ftdi files and I tried using David Mellis's tutorial to program the board through Arduino. After a few errors, I took Dan Novy's advice and went back to trying the program through command line. I created a folder with the .c and .make files for hello.ftdi, navigated to this folder, and ran make, make program-usbtiny-fuses, and make program-usbtiny. The output indicated that the program was uploaded successfully, so I assumed it worked, though I wasn't sure how to verify this particular program.

But this assumption felt a bit unsatisfying, so I decide to try the hello.blink program to see if my board could perform its intended function. My process got a bit derailed here--see Trials and Tribulations. Once I got back on track, I returned to hello.ftdi and used the serial port in Arduino to check that the board completed its programmed function--to echo the typed text. Note that the baud rate should be set at 115200 (as indicated in the make file), the board set to ATtiny44 (20 MHz external clock), and the programmer set to USBtinyISP. Not a blinking light, but it's something--thanks to Dan Novy for advising me throughout this process!

Trials and Tribulations

The Eagle install on Ubuntu 12.04 was not straight forward as the most recent Eagle install requires Ubuntu libraries that are not yet available in the Ubuntu repos. I mostly followed this tutorial to get it working while also referencing this one. I didn't manage to get myself a quick launch icon, but I running run_eagle.sh from command line does the job.

Eagle had a few quirks that took some getting use to. Though the list of components available in the libraries is extensive, the component search function seems very poor, so I really relied on the Fab and Sparkfun libraries to hunt down the parts I needed--making sure to get surface mount parts not the through hole parts (FTDI especially). I found that my components in the schematic were often not connected, though the seemed fine visually. Dragging parts around in the schematic helped debug this; also note that the connection "takes hold" on the outside edge of the pin indicated on the component. Remember that moving or rotating a component requires clicking the '+' on the component; F3 and F4 control zooming; connect with wires not lines in the board file; piece rotation and movement doesn't sync between the schematic and the board file; some things must be deleted in the schematic not on the board though tracks can be removed through "rip up routed tracks traces."

Milling the board took some minor debugging. I kept my traces quite wide and fairly close, so I ended up scraping up some copper with an X-Acto knife just to make sure to avoid bridges. On my first milling attempt, I realized my board design was slightly too wide for the available materials. After shuffling my parts around a bit and recreating the image files, I misaligned my traces and cut images and ended up cutting off my outside trace on one side of the board. All went well on attempt three.

Programming was another adventure. Arduino didn't seem to be recognizing the presence of my board causing me to worry that it or the FabISP had some issue. Dan Novy advised me that this approach was less reliable, so I went back to command line. Initially I maintained the downloaded file names, but running make returned "make: Nothing to be done." I changed the file name to "makefile" and ran make again with success. Adding the -f flag and the file name would have worked as well. Then, running "make program-usbtiny-fuses" returned "avrdude: error: usbtiny_transmit: error sending control message: Operation not permitted." Re-running this as root solved the problem; I also had to run make program-usbtiny as root.

Having successfully programmed my board, I proceeded to destroy it. I downloaded the hello.arduino.168.blink files to attempt to program my board. I realized it was intended for the ATMega168 so I adjusted many variables in the make file from m168 to t44. But I missed some necessary changes relevant to the fuses, so I managed to (which wasn't necessary to run as the fuses had been set during my hello.ftdi process!). This produced a bad looking error and un-did my past success with hello.ftdi. It also felt vaguely familiar, perhaps on the list of pitfalls Neil had mentioned in class...which Dan confirmed. Defeated, I used the heat gun to desolder and replace the ATTiny, went back to the hello.ftdi set-up and successfully uploaded and verified that program. So (hopefully) all is well!