The assignment for this week is to redraw the echo hello-world board, add (at least) a button and LED (with current-limiting resistor), check the design rules, and make it. If possible, we could also simulate its operation.
I decided to use CadSoft EAGLE PCB design software since it has versions available for multiple operating systems and a freeware option.
- I downloaded and installed EAGLE 6.5.0 on three computers this week. I installed it on a 64-bit Windows 7 system, a 64-bit Ubuntu 12.04 system, and a 32-bit Ubuntu 12.04 system.
- The Windows installation was the easiest.
- At first, I was not able to install EAGLE on the 64-bit Ubuntu system. I used the internet to search the problem and discovered that EAGLE 6.5.0 for Linux was only available in a 32-bit version. The frequently asked questions section at CadSoft (http://www.cadsoftusa.com/training/faq/) identified some additional dependency files that would need to be installed. After installing the dependency files I was able to install EAGLE, but I could not get it to give me the option to run it in Freeware mode.
- I then installed the 32-bit version of Ubuntu 12.04 on another desktop computer. I was able to install EAGLE in freeware mode onto this computer without any problems.
- In the beginning of Fab Academy I almost installed Ubuntu v13.10. Now after six weeks of experience installing and testing many different software packages on Ubuntu systems, I have concluded that the 32-bit version of Ubuntu v12.04 is most compatible version to use for Fab Lab related applications at this point this point in time.
- Once the EAGLE PCB software was installed, I "installed" the fab lab specific component library.
- Download the latest version of fab.lbr file.
- Copy this file to the EAGLE-6.5.0/lbr/ directory.
- Then from EAGLE control console you can toggle on or off the use of selected component libraries. Find fab.lbr and make sure it is selected to be used (Library --> "Use..."). I think by default, every component library is selected for use. This can be a little overwhelming when looking for components. You may want to turn off all the libraries you don't want to use.
- I found an excellent tutorial by Anna Kaziunas France at http://academy.cba.mit.edu/2012/labs/providence/tutorials/07.html. However, instead of editing the example schematic and board provided in the tutorial, I started a new project and created mine completely from "scratch."
- Drawing the schematic was the easy part. All I had to do was find the "right" component from the fab.lbr library and then draw wires between the components by using NET from the Draw pull-down menu.
-
If wires were drawn between every component connection, the drawing would quickly become a scramble of wires. So I used LABEL from the Draw pull-down menu to label connections instead of drawing NETS (wires) between all of them. You need to change the name of the label from its default (e.g. N$4 to something meaningful e.g. BUTTON) and then all labels in the schematic will be connected to all other labels on the schematic with the same name.
-
Depending upon the type of component, there will be various attributes that can be edited. Select Value from the Edit pull-down menu and then select a component name (e.g. R2) to enter the value for the component (500). This will label device R2 as a 500(Ohm) resistor on the schematic and eventually on the board drawing. Note, for some reason this didn’t work on all devices (e.g. C1 or XTAL1).
-
I needed to determine the resistors specifications needed so that I could designate them properly on the schematic.
- According to the data sheet for our 160-1169-1-ND, Green Clear 1206 SMD LED:
DC Forward Current = 40 mA
Forward Voltage VF = 1.8 V (2.4V max) IF = 20mA
- Based upon this:
Supply 5V, Voltage drop across LED 1.8V, Desired LED current 20mA = 160 ohm (nearest higher is 180 ohm)
Supply 5V, Voltage drop across LED 1.8V, Desired LED current 40mA = 80 ohm (nearest higher is 82 ohm)
-
So I calculated that I need a 82 to 180 ohm current limiting resistor for the LED. But all we have is 500 ohm in fab inventory.
Supply 5V, Voltage drop across LED 1.8V, Desired LED current 6.4mA = 500 ohm
- According to http://learn.sparkfun.com/tutorials/pull-up-resistors, a 10k ohm resistor could be used as the input pull-up resistor or perhaps a resistor built into the ATTiny 44 could be enabled. With a pull-up resistor wired to between VCC and the input, the input pin will read a high state when the button is not pressed. When pressed, the button supplies a path from ground to the input pin. In this way, there are very clearly distinguishable high and low states for the input. The input does not just "float" to no connection when the button is not pressed.
-
When I thought I was finished, I used ERC (Electrical Rules Check) to error check the schematic.
Results of the first Electrical Rules Check of my schematic
-
I systematically went through and corrected all the issues identified by Electrical Rules Check until it stopped complaining.
Finished EAGLE schematic with pushbutton and LED added.
- Once I corrected the problems detected by the Electrical Rules Check, I then went to the board mode. To my surprise, all of my components were on top of each other in a pile off the board outline.
By default, none of the components were positioned on the board (the white outline in upper right corner).
- I manually moved all of my components onto the board and then used the autoroute to find the best path between connections. I think it did a terrible job. Autoroute would need about 8 jumper wires to make this layout work. I used undo and manually routed the wires myself.
Components moved onto the board. Notice all connections are shown as yellow lines that are the shorted path between the two points. These are called air wires.
After using the autoroute feature. I was surprised it didn't have an option to move the components to make the routes work. Note the blue lines represent jumper wires or connections on the opposite side of the board that would be needed to make this layout work.
- I move and rotate components to try to untangle the air wires (yellow wires) and give them a simple direct route between components. At first, I had a hard time selecting components to move them. It seemed no matter what I clicked on the software selected the closest wire. The trick is to click on the crosshairs in the middle of the component to select the component.
It wasn't hard to come up with a layout where most of the connections worked. In this example, I have only a few air wires.
- I then spent several hours in a quest to route all the needed connections between components without having to use any jumper wires or zero ohm bridge resistors. I really enjoyed the challenge; it was like a fun puzzle for me. However, this simple circuit took me a few hours of trial and error before finally finding the combination of component layout and routes that worked.
I am getting close. Only one air wire remains, but there are lot of things in between.
- Once I had a board that would work, I spent even more time moving all the components and redoing the traces to compact the placement of components so I could use a smaller circuit board. I found that if I used the ALT button when moving components and wires, I could jump to intermediary positions on the grid. This allowed me to fine tune the wires to make sure I would have adequate clearance between traces for the endmill to cut and to try to reduce the chances of solder bridges.
My board layout with no jumpers and the components moved closer together to better utilize board space.
-
When I thought my board was finished, I used DRC (Design Rules Check) to error check my circuit board layout. My board did not have any significant problems.
- I added an outline with chamfered corners to layer 20 to represent how I wanted the board cut out.
Board layout with outline.
-
I exported the circuit traces as a png.
- I then exported the circuit traces using monochrome, 500 dpi, window --- note the pixel size (e.g. 824x740)
This is what the exported file looked like that I used Fab Modules to cut the circuit traces.
- I then worked on exporting the outline of the circuit board.
- Do not resize the window, move the objects in the window, etc.
- Change the layer settings to turn off all but the dimension layer 20 (where I drew my board outline).
- I exported the board outline using the exact same settings as before – monochrome, 500 dpi, window. Make sure the window size is exactly the same (e.g. 824x740). If you resize the window between the circuit export and the outline export, the exported pngs will be different size files (pixels wide by pixels tall) and not lined up together (different origins).
This is what the exported file looked like for the outline.
- I imported board png file into GIMP or other paint program and use the bucket tool to white fill everything outside the outline. Otherwise, Fab Modules will cut on both the inside and the outside of the line. I noticed that the example Hello.echo board had a white board with a black outline. I believe the cutter diameter compensation would cause the resulting physical board sizes to differ slightly depending upon which approach is used. Note: I was not able to use Corel Photo-paint with the png file. I’ve read that Corel Photo-Paint assumes a transparent image with a black background, so the png is shown as a solid black rectangle.
This is what the exported file looked like that I used Fab Modules to cut the circuit board outline.
- Using the Modela MDX-15 with Fab Modules, I first cut the traces with a 1/64" endmill and the cut out the board outline using a 1/32" endmill.
Circuit board cut and ready to remove from the Modela mill.
- I soldered the board using a stereo microscope and a new Metcal MX-5211 soldering station.
Metcal MX-5211 microprocessor controlled advanced soldering system.
- After soldering several resistors and capacitors, I had a problem soldering the ATTiny IC chip legs. The solder seemed repelled by the IC legs. We dont have a hot air gun so I tried to remove the IC with desolder braid and ended up ripping off an important circuit trace. Since I had already cut a test circuit board without the fancy chamfered corners, I just used it.
Completed circuit board.
- When soldering, make sure to install the LED and IC chip in the correct orientation. Pin 1 on the IC indicates pin 1. There was a green line on the LED. I don't think the "polarity" of the resonator matters.
I interpreted the data sheet for the LED as indicating that the green line represents the cathode (negative side)
Programming my echo board.
- I download the hello.ftdi.44.echo files and put them in a directory on my desktop.. I opened a terminal window in Ubuntu and made that my active directory.
- Since my Fab ISP is not working I used our avrisp2. I connect my board to a USB port using the FTDI cable. I connected the avrisp2 to a USB port, and then I connected them together using the ribbon cable.
Programming my hello.echo board.
- Once everything was connected, I typed in the following commands, each time verifying success before continuing.
make -f hello.ftdi.44.echo.c.make (make the hex file)
sudo make -f hello.ftdi.44.echo.c.make program-avrisp2-fuses (set fuses for 20MHz)
sudo make -f hello.ftdi.44.echo.c.make program-avrisp2 (write program to ATtiny)
lsusb (list usb port usage)
The lsusb command shows that Future Technology Devices International, LTD FT232 USB-Serial (UART) IC is detected.
- I download term.py and put it in the current directory. term.py requires python-tk, so I installed it using the following command.
sudo apt-get install python-tk
- I then run term.py by entering sudo python term.py /dev/tty and then pressing the tab key a few times INSTEAD of the enter key. A list of ports should appear. I ended up guessing it was port ttyUSB0. We want a buad rate of 115200. So I typed the following command and pressed enter:
sudo python term.py /dev/ttyUSB0 115200
- I noticed a few errors in the terminal window but the term.py program appeared. Each time I pressed a key on the keyboard, term.py responded.
Success, my circuit board echoes back what I type.
Circuit simulation
For extra credit, we were asked to simulate the circuit that we built. I installed and tested LTSpice via EAGLE, 123D Circuit, and AVR Studio.
- I watched some EAGLE tutorials on how to use it. It appears that you need to use special component libraries made for LTSpice. These components contain additional information on how to simulate the components operation. I looked for the LTSpice ATTiny 44 component and could only find a user created one.
-
I downloaded LTSpice directly from the Linear Technologies website but received a warning when I tried to install it. I have been installing a lot of software for Fab Academy and this is the first time I have seen this particular warning. So I decided not to take my chances and continued looking for a better option.
I received this warning when I attempted to install LTSpice.
- 123D Circuit is an online application. It is designed to work best with Google Chrome browser. After going through the built in tutorial I learned enough to create a simple circuit. You basically use 123D circuit to virtually breadboard circuits and then simulate them. From there can work on a schematic, board layout, and generate a bill of materials. With a free account you have options to share finished design and have circuit boards produced. Besides being able to simulate a Arduino starter kit board with programming, the software seems fairly limited. For example, I could not find an ATTINY 44 in the main component library.
Simple simulation using the 123D Circuit virtual breadboard. In this example I am using a potentiometer to adjust the output intensity of an LED. When the simulation is running, I can rotate the pot and see the LED get brighter and dimmer accordingly. If a circuit puts too much current to the LED the simulation will show the LED break.
123D Circuit then can generate a schematic for what is on the virtual breadboard.
123D Circuit can also generate a circuit board, but I had to manually re-arrange the layout of the components on the board.
123D Circuit can also generate a Bill of Materials (BOM) for your circuit.
- With 123D Circuit I could easily simulate a simple circuit like an LED controlled by a pushbutton. I am really looking for something to simulate the entire hello.echo circuit including the ATtiny 44 program. I installed Atmel Studio (previously known as AVR Studio) which also required the installation of Microsoft Visual Studio 2010. From what I read online, it sounded like this Windows only software could simulate an ATtiny 44. However, with great power often comes great complexity. I could load some examples of circuits using newer Atmel processors but I was unable to find any examples using the ATtiny 44. I also could not figure out how to create a project from scratch that would simulate the ATtiny 44.
I could not find a board wizard in Atmel Studio for the ATTiny 44.
I did find the ATtiny 44 listed in Atmel Studio. Note that a Simulator is listed under supported tools.
I tried to create a new Atmel Studio project using the ATtiny 44 but got stuck when it asked to define a stimuli file.
Files
Back to index