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 Green 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 it for 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
  • 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.6.3 in my mac 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 library Eagle fab.lbr activation
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 componentyou 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.

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

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 theNet 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 netswith 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>Widthand 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 .rmlfile 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

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.

I used the ULP command in EAGLE to export BOD

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

2021 Fabacademy and moving to Kicad and new Hello board

One of the advantages of being a continuing Fabacademy student is being able learn new and effective trends. With the help of the Videos my instructor Krisjanis Rijnieks developped on how to get started with kicad, I was able to cut the learning curve of this amazing open source circuit designing software. Kris has also developed the fab inventory component library which make designing much more fun.

Taking Kicad as my new tool I moved to complete this weeks assignment by taking the challege of modifing a double sided version of the Hello-ATtiny412_Board from Neil and programming it with the new uopdi programmer I made 2 weeks ago

Hello.t412.blink Png

Individual Assignment: PCB Design Project - ATtiny 412 Double-Sided Board

PCB_board.png

Materials

# Digi-Key Part No. Name Value * Pieces KiCad Footprint(Package)
1 ATtiny 412-SSFRCT-ND ATtiny 412 w/ Single-pin UPDI ( Datasheet ) tinyAVR™ 1 Microcontroller IC 8-Bit 20MHz 4KB FLASH 8-SOIC * 1 Package_SO: SOIC-8_3.9x4.9mm_P1.27mm
2 B3SN-3112P B3SN Tactile Switch, SMD * 1 self-designed footprint: TACTILE_SW_B3S
3
  • 160-1889-1-ND
  • 160-1403-1-ND
LED 1206 SMD
  • BLUE CLEAR * 1
  • YELLOW ORANGE * 1
LED_SMD: LED_1206_3216Metric_Pad1.42x1.75mm_HandSolder
4
  • 311-499FRCT-ND
  • 311-10.0KFRCT-ND
RES SMD 1% 1/4W 1206
  • 499 Ω * 2
  • 10k Ω * 1
Resistor_SMD: R_1206_3216Metric_Pad1.42x1.75mm_HandSolder
5 445-1423-1-ND CAP CER 1UF 50V X7R 1206 1 uF * 1 Capacitor_SMD: C_1206_3216Metric_Pad1.42x1.75mm_HandSolder
6 445-1423-1-ND Male 1 Row Horizontal SMD Header 2.54MM
  • Conn_01x06_Male * 1
  • Conn_01x02_Male * 1
self-designed footprint:
  • FTDI_Header_1x06_P2.54mm_Horizontal
  • UPDI_Header_1x02_P2.54mm_Horizontal

Design Tool: KiCad EDA

KiCad EDA is a cross platform and open source electronics design automation suite with lots of predefined symbol and footprint libraries provided by industrial companies such as Digi-Key and Teensy . I used it to design my PCB by redrawing the original hello.t412.echo board and adding two extra LEDS (a power LED and a programmable LED) as well as a push-button.

Original hello.t412.echo Board

hello.t412.echo.png

My Board

hello.t412.LED.Button.png

Schematic Design

Sch_mode.png

I added the following components and a current limiting resistor between the I/O pin of the ATtiny 412 chip or Vcc (input power) and the component added:

Current-Limiting Resistor for LED

Ohm's law states that the current through a conductor between two points is directly proportional to the voltage across the two points. Introducing the constant of proportionality, the resistance,[one arrives at the usual mathematical equation that describes this relationship: R=V/I,

From the Data sheet of the LED we Know that the typical Forward Voltage is 2.4V and the forward current is 20mA. So Our resistor of choice Should hepe us drop 3V from the 5V Vcc supplied to the Board and saves our led from Burning out.

Datasheet summary of the led

online Ohm's law calculator

As can be seen from the calculation the Min required resistor is 130 Ohms but since they don't make that the next prefered one is 150Ohms. Ans in our lab the closest we have to 150Ohms is the 499Ohms and Hence that will be used.

Sch_LEDs.png

ATtiny 412 Pinouts

In order to program the board, one need to understand the function of each pin of the ATtiny 412 chip . Since ATtiny 412 has an Unified Program Debug Interface (UPDI) pin which is PA0 pin, it is easier to program it with a 1x2 male pin header (J1: Conn_01x02_Male) using the programmer board we milled and soldered two weeks ago.

ATtiny_412.gif

The other 1x6 male pin header (J2: Conn_01x06_Male) is connected to a FTDI cable or FTDI programmer board to power on and read data from the ATtiny 412 board by communicating through RX (PA1) and TX (PA2) pins.

Sch_ATtiny412.png

For the other three remaining port pins, I used two of them as IO pins to control the programmable LED (PA3) and the push-button (PA6) respectively. Since I am not going to use PA7 and the other two pins of the FTDI male connector, I placed a no connection flag to it to make sure it does not work against the electrical rules while I check the performance by clicking btn_debug.jpg button.

Besides, it is also a good habit to put a bypass capacitor between Vcc and GND pins (power pins) of the chip.

Sch_LED_button_IO.png

Annotate Schematic Symbols

In order to specify different components, I then opend the Annotate Schematic dialogue by clicking btn_annotate.png button to lable them with non-repetitive numbers.

Sch_annotate.png

Assign Footprint

Before layouting the printed circuit board, I need to assign which footprint belongs to which symbol (component) in the Assign Footprint dialogue by clicking btn_assign_footprint.png button to open it.

Sch_assign_footprint.png

The name of each correspondent footprint is also arrranged in the material table shown on top of the page.

Generate Netlist

The final step of the schematic design is to generate the netlist file which will then be imported to the PCB layout mode. I did this by clicking btn_generate_netlist.png button to open the Generate Netlist dialogue to generate and save the netlist file.

Sch_generate_netlist.png

Complete Schematic

Sch_board.png

Footprint Layout

After finishing the schematic design, I then switched to the PCB layout mode via btn_PCB.png button.

PCB_mode.png

Import Netlist File

In the PCB mode, I clicked btn_generate_netlist.png again to load the netlist file I saved.

PCB_load_netlist.png

These are some messy nets which I am going to layout:

PCB_messy_net.png

PCB_after_layout.png

Define Trace Clearance, Trace Width & Via Size

Before starting to connecting components with traces, I clicked Board setup button btn_board_setup.png to define the size of trace clearance, different groups of trace width and via size. I followed the rules below to set the corresponding values:

PCB_trace_clearance.png

THT Settings

In order to mill THT components, I need to first adjust the hole size of certain components in the footprint library by clicking Open footprint editor button btn_footprint_editor.png

I double clicked its pin holes to open Pad Properties dialogue, typed the correspondent size (here, 1.5mm for Hole size X) and made sure that the pad size of this hole is big enough for soldering by adjusting Size X and Y.

PCB_Pad_Properties.png

Separate Layers

After layouting all the components, I started to create traces between them by using btn_add_wires.png or typing its shortcut W.

If there is not enough space for routing tracks, I then created vias which are conductive holes by using btn_add_vias.png or typing its shortcut V to make traces first go to the other side then come back to the original side for its connection:

PCB_add_wires.png

PCB_add_vias.png

Since there are many pins connect to GND, it is also useful to create a ground plane on the other side by switching to B.Cu layer and using btn_add_fill_zone.png Add fill zones tool to first frame the area then assign it as a GND plane.

PCB_copper_zone.png

PCB_add_fill_zone.png

The final step of the PCB layout is to define its outline for mods to generate its interior toolpath. To do that, I first switched to the Edge.Cuts layer and used btn_add_lines.png Add graphic lines tool to draw a rectangle area and then switched to the Dwgs.User layer to fill the field with btn_add_polygon.png Add graphic polygon tool.

PCB_layer_Edge.Cuts.png

PCB_layer_Dwgs.User.png

Finally, I added a pink rectangular outline to the Margin layer which is reserved for the drawing of circuit board outline. Any element (graphic, texts…) placed on this layer appears on all the other layers. It also defines the board area for exporting the image for each layer.

Complete PCB View & Final Check

Below I listed some notes according to different layers:

PCB_Line_Segment_Properties.png

PCB_board.png

Export PCB SVG

Before starting milling the board, we need to generate the image files for its front-side traces, back-side traces, drilling and outline. I did this with the following steps and settings:

PCB_export_svg.png

PCB_export_F.Cu.png

PCB_export_B.Cu.png

For the drilling svg, I filtered out the vias from the F.Cu.svg and infilled them with black color in Inkscape :

Inkscape_fill_color.png

Fabrication: SRM-20 Milling Machine

The fabrication of the PCB is almost the same as the process of Week 4: Electronics Production except the server module used to generate the cutting toolpath in mods is:

p.s. MDX-40 milling machine uses the follwing same svg mods server module.

mods_PCB_svg.png

mods Toolpath Setting Comparison (MDX-40)

tool diameter cut depth max depth offset number speed color
0.2mm (new) 0.125mm 0.125mm 4 20.0mm/s
  • Traces: white
  • Background: black
0.4mm 0.125mm 0.125mm 4 1.5mm/s
  • Traces: white
  • Background: black
0.8mm (Outline) 0.6mm 1.8mm 1 2.0mm/s
  • Inside: white
  • Outside: black
0.73mm (Drill) 0.6mm 1.8mm 1 2.0mm/s
  • Holes: black
  • Background: white

Front Side: &

F_cu.jpg

Back side

Soldered hello 412 Board

Soldered hello 412 Board

This is the video showing pyupdi progrmming and the board blinking according to the code.



Link to the testing with lab equipments: Group assignment

DOWNLOAD FILE

Eagle File - Eagle File
RX-TX board Trace- RX-TX board Trace
RX-TX board cutout- RX-TX board cutout
8 PIN INPUT board Trace- Trace
8 PIN INPUT board cutout- cutout
8 STRIPE CAPACITIVE SENSOR - Trace cutout