Week 6

Week 6. Electronic design

During this week I designed, fabricated and tested a basic board for the ATtiny44 from scratch.

Tasks

  • Redraw the echo hello-world board, adding at least one button and a LED
  • Fabricate the board
  • Test the board
  • Measure its operation

Process explanation

Design a Hello-World board using Eagle

I decided to create a board utilizing the Hello World FTDI as an example (Figure 1). I decided to use Autodesk Eagle as a EDA (Electronic design automation) to design my board. It is one of the most utilized tool for the hobbyists all around the world. In the future I might try other alternatives. My board should include in addition to the previous components:

  • A Yellow LED programmable from the ATTiny
  • A button with a simple debouncing circuit (that is, to avoid glitches in the transitions)
  • A RED LED indicating the circuit is powered
  • A set of extra headers connected to free pins in order to connect external sensor and actuators. The TX and RX signals of the FDTI will be utilized when not in use (not programming/using serial port)
Eagle design 1
Figure 1. Hello World FDTI provided in the Fabacademy embedded programming lesson

The lists of components to use are:

  • Atmel ATtiny44 microcontroller
  • 20Mhz Crystal
  • SPI headers pins
  • FTDI header pins
  • Pull up resistor for RESET signal (10K)
  • Decoupling capacitor: 1uF
  • Omron switch
  • Debouncing circuit: two resistors of 49.9k and one Capacitor of 1nF (See Antti Mäntyniemi's page)
  • Yellow programmable LED + its current limiting resistor (499)
  • Red power LED + its current limiting resistor (499)
  • 6 pins header (SPI MISO, SPI MOSI, FTDI TX, FTDI RX, 2 pins free left from ATtiny)

I installed Autodesk Eagle 8.0.2 in my Linux machine. Next, I had to install the Fab Lab components library (fab.lbr) containing majority of components from the Fabinventory. I just downloaded the library and placed in the "library folder" of my Eagle installation. Actually, you can set where Eagle looks for your personal libraries in Options>Directories. Finally, in order to be able to to use the library, I should select it on the left menu, click with the right button and select Use. Other option is to click on the gray button located at the right of the library name.

Eagle design 1 Eagle design 1
Figure 2 Setting the adequate directory for the fab.lbrlibrary and activating it

After creating a new project File>New>Project, I need to create the schematics: Put the mouse on the new created project>Right button>New>SchematicA schematic diagram, is a representation of the components of a circuit using graphic symbols (simple shapes). It shows also the lines which connects the components and through which the electricity flow. Figure 4 shows the main buttons of the UI. When you press the button Add component you select a component from the libraries in use to be added to the schematics. In order to simplify the search of components (reduce the number of options) i marked as used just the fab.lbr and the supply1.lbr. I marked the rest as not used by clicking on the green button.

Eagle design 1
Figure 3 Creating a new schematics.
Eagle design 1
Figure 4 Main elements of the user interface.

When you add a component (using the Add component button) is very important that you choose adequate encapsulation. We are not using throughhole components but surface mounted ones, so we must be sure that we select that encapsulation. Usually, components in the fab inventory contains the FAB suffix somewhere. When you add a component (press Enter button when you have selected the correct component), the ADD window opens again. If you want to remove this window just press ESC button. If you cannot find the adequate component, you can use the Search button.

Eagle design 1
Figure 5 Choosing the right encapsulation for the ATtiny microcontroller.

If you want to move a component, just press the Move button from the Menu and click on the cross located inside the component you desire to move. If you want to rotate a component, select a component using the Move tool and press the right button of the mouse.

I added all the components and give them adequate Name and Value using the buttons on the Menu. The name is the reference name of the component (e.g. R1) while the value is the real value of the component. For the components that does not have a value (e.g. LED) you must add a significant characteristic (e.g. color of the LED).

Eagle design 1
Figure 6 Adding components, names and values to the schematics.

After that you must create the connections among the components. To that end, I used the Net tool and NOT the wire/linetool. In order to simplify the circuit I gave names to some of those Nets using the Name tool. Two nets with the same value will be linked in the board file (they belong to the same electrical line). In order to visualize the name of the nets use the Label button.

Eagle design 1
Figure 7 Final version of schematics

After creating all the connections, I run the ERC (Electrical Rule Check) to check that there are no problems with the signals. I got two warnings (Figure 8), but they were caused by the way I drew the circuit. After the schematics was correct I moved to the board view pressing the button Generate/switch to board view. This view permits drawing the traces for the circuit. The main tools I utilized are shown in Figure 9.

Eagle design 1
Figure 8. Checking the ERC. Important to check also the warnings!!!
Eagle design 1
Figure 9. Board view UI components

I made sure that the traces had the correct size. We are using a milling bit of 1/64. We have to be sure that the isolation lines are of the correct size. Considering that we are using several offsets of 50% we cannot choose a width for the line much smaller than the milling bit. Hence, I thougth that 0.015 mils was a good size. Go Settings>Width and be sure that it is marked 0.016. You can move the components using the Move button. I placed all the components in my candidate initial position before starting any traces. I had to move from the schematics to the board view several times in order to check the names of the components. I finally opted to print the schematics in paper to make my life easier.

I created manually all routes using the Route button. However, before starting the manual work I pressed the Ratnest button. This button calculate the shortest airwire for the current position of all the components. Once you are drawing a route you can select multiple wire bends (straight angle, non-straight angle, linear, round ... They are quite helpful in order to draw adequate lines. By default, Eagle use a snap grid to place the routes. You can define the grid size pressing the Grid button. In addition, by pressing Alt while creating the route you can define a finer position. You can also set up the Alt resolution in the Grid tool(Figure 10). For some routes I had to set the grid to 0.025 inches with an Alt resolution of 0.005 inches.

The whole process took me quite a lot of time. It was really difficult to imagine which was the best position to place the components initially to reduce the paths and do not have routes that cross each other. I could not manage to create a network without crossing so I had to use 1 0Ohm Resistor to overcome one line cross. Actually, I also realized that having the MISO and MOSI pins of the SPI available in the pin header for external connections (I called it GPIOT) was really problematic, so I finally decided to remove those connections. The new pin header GPIOT had only 4 connections: TXD, RXD, GPIO1, and GPIO2. The current version of the board is shwon in Figure 11.

Eagle design 1
Figure 10. My grid size.
Eagle design 1
Figure 11. Current version of the board

Once the board was ready I firs inspected visually, using the Show object button, that all the connections were correct. After that, I run the Design Rule Check to check if the clearances were correct. Before I had to configure those values in the Clearance tab of the DRC(Figure 12). I set all the values to 16mil (the size of the milling bit: 1/64 inches)

Eagle design 1
Figure 12. Clearances values

The clearance test return several errors, because some lines were really close one from each other (Figure 13), or very close to the pads. To solve the errors I had to move the lines, change the wire bend in some of them and use a finer position for the grid (0.01 inches) in order to position more accurately the traces.

Eagle design 1
Figure 13. Clearances errors

After I managed to remove all clearance errors, I removed all unnecessary layers using the Show/Edit/Hide layers button. I just left the Top layer (the one containing the lines and the Pads). In order to show again a hidden layer you must click on the layer number from the Menu (Figure 14)

Eagle design 1
Figure 14. Showing just top layer.

The final result is shown in the following figure:

Eagle design 1
Figure 15. Final board file. It is ready to mill.

Next we had to edit a little bit the files before being able to send it to Fabmodules so it creates the .rml. The process is as follows:

  1. Export the files from Eagle as .png. The resolution I used was 1500dpi. Be sure that you select Monochrome in the Export Menu.
  2. To create the cutout and the traces files
    1. Open the previous generated .png file in GIMP.
    2. Create a new layer using black as background
    3. Modify the size of the layer (Set Layer to Boundary Size). We want to make bigger the .png file so we take into account the material milled away by the CNC when cutting the board (1/32in=>0.8 mm). So, we extend the height and the width 1.6 mm. Center the layer in the canvas.
    4. Resize the canvas to the layer's size (Image>Fit Canvas to Layer)
    5. Fill the empty area of the bottom layer with black. The visible image is our traces image.
    6. Fill the traces layer with white. This is the cutout image.
    7. You can create new layers to add images / text. You can create it as an external file if you want to mill it with other settings.
Eagle design 1
Figure 16. The traces and cutout files.

After creating the .rml file I noticed that some of the traces were so close, that it could only do one offset, instead of 4 (Figure 17). Hence, I decided to go back to Eagle and reduce the width of some of the most problematics line from 0.016 to 0.012. Furthermore, I redo some of the bends to ensure more distance among tracks. The new .rml file managed to have at least 2 offsets in all the lines. Final version in Figure 18.

Eagle design 1
Figure 17. The .rml visualization shows areas that might produce problems in Production.
Eagle design 1
Figure 18. New version of the board.

Fabricate the board using the Roland CNC precision milling machine

I used the same method as in Week 4 assignment. I had some problems with the board, since it look like that the FSR1 was a little bit bent. Hence, I had to mill it twice, the second time with a depth of 0.25 instead of 0.15 that is the default one that we use for our machine setup. The final board is shown in the following figure

Board fabrication
Figure 19. Board after milling and cleaning.

The stuffing process took some time. I still need some practice with surface mounted soldering. However, although it is not a piece of art, I managed to create a working board.

Board fabrication
Figure 20. The board with all the components soldered.

A few months ago a built a a little bit simpler board. Then, I utilized a reflow oven instead of solder ironing and the results are better at least esthetically

Board fabrication
Figure 21. The board I built two months ago utilizing a reflow oven.

Test the board

I started checking visually the board with the help of a microscope in order to find possible visible shortcuts.

Board fabrication
Figure 22. Checking possible shorts with the help of a microscope.

After that I used the multimeter to check continuity and find possible shortcuts. Fortunately, i did not find any problem.

Board fabrication
Figure 23. Checking continuity with a multimeter

Next step, was to program the board. I downloaded the software from the Embedded programming week. Actually I downloaded the following files:

I utilized our instructor's FabISP programmer to upload the program to our board. This programmer powers also the board, so i do not need to connect the board directly to my computer.

Board fabrication
Figure 24. Programming the board with the Hello world.

I run the following commands to compile, program and test the board:

  • make -f hello.ftdi.44.echo.c.make: Compile the code
  • sudo make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses: Setting up the microcontroller for programming
  • sudo make -f hello.ftdi.44.echo.c.make program-usbtiny: Flash the microcontroller
  • Once the program was flashed, I removed the programmer and connected the FTDI cable to the board. Then I run the python application. python term.py /dev/ttyUSB0 115200: Run the python application app which connects with the serial port of the board.

For knowing the serial port in which the USB device is running in my computer I run the following command: dmesg | grep tty

It looks like everything is working as expected. I managed to write messages in the terminal and board returns the echo.

Board fabrication
Figure 25. My first program was flushed to the board!!!
Board fabrication
Figure 26. Python terminal application showing hello world application.

Measure board operation

Resources utilized

  • Eagle 8.0.2: DEA software to design the circuit and produce the board
  • GIMP: To create the .png files with the traces and cutout
  • Fabmodules: To create the .rml files
  • Roland SRM-20: milling machine to fabricate the board
  • Set of electronics components in the Fab inventory
  • Oscilloscope and multimeter to test the board.

Reflection

Summary

This week I got acquainted with Eagle software. Although I had used once before, it is the first time I face a design problem by myself.

Main difficulties

Creating the routes to connect different signals is, with difference, the most complex topic I dealt with during this week. It is very difficult to guess beforehand which the best position for the components to generate efficient routes. Furthermore, sometimes it was rather complex to create a route in which two signals does not cross with each other. I guess that with more training, I will improve my skills and manage to make this process quicker.

I still find also some difficulties soldering the surface mount components. This board was more challenging that the one we built two weeks ago. But, this time I felt more confident soldering.

Main learnings

I learned to use Eagle software. I think now I have better intuition on how to create the routes. I still need to practice a little bit more with the soldering. Although the board seems to work, it is still not "beautiful".

Models files