8. Electronics design¶
Designing a PCB in Eagle (Fusion)¶
I decided to use Eagle first because it has an easier interface to use, in my opinion. In addition, I already had Fusion 360 installed on my laptop, so it was easier to get started with.
Importing Fab library¶
To start off with PCB design in Fusion, I downloaded the Eagle fab library and opened the fab.lbr
file in Fusion with the File -> Open -> Open from my computer
dialog. This added the library to my Fusion 360 project, which let me access it in other designs in Fusion.
This is part of the library’s component listing shown after I opened it in Fusion:
Trying out Eagle¶
My first goal was to try creating an ATTiny412 PCB first with a button and LEDs. The PCB design process in Eagle involves a schematic (which lists the components and has the electrical connections between them) and the PCB itself (which has the components and traces physically arranged).
To start with an electronics design, I went into the File -> New Electronics Design
dialog in Fusion, then I created the Schematic and PCB using the Create -> New Schematic
and Create -> New PCB
buttons. The Electronics Design essentially links the PCB and Schematic so that they update together.
To place components in, I first searched for the component in the library on the left, then I dragged them from the library into the schematic. This brought up an “Add” dialog in Fusion which allowed changing the orientation of the component within the schematic, and clicking inside the schematic while the Add dialog was active added the component to the schematic. After it was added, I had to close the Add dialog to prevent adding the component again.
One problem I had to watch out for when adding components was that the fab library contains a few different variants for many components which represent different footprints on the PCB board. Initially I had added the 5MM
variant of the LED (which is for through-hole LEDs) when I should have added the FAB1206
for surface mount components.
To generate connections between components, I used the Connect -> Net
tool and selected the pins I wanted to connect on each component. This created a “Net”; this represents an electric signal, and more than two components can be connected to the same net even after it is created.
Another way to generate connections is to use the Connect -> Net Breakout
tool, which creates a net between two components based on a provided label or pin name. I liked this better, since comparing the two designs I made this week, the second design (which uses more Net Breakout) is generally more organized.
Creating a schematic and PCB: first design¶
Eventually, I created a schematic connecting all the components I wanted in my first PCB. This included:
- an ATTiny412 MCU
- a capacitor between power and ground near the ATTiny412
- an LED controllable from the ATTiny412 MCU
- an LED which turned on whenever the board was powered, in order to make it clear when the board is powered
- a resistor connecting on one side to ground and on the other side to these two LEDs, in order to limit the current and make sure these LEDs didn’t burn out
- note: because I only used a single resistor here, and not two separate resistors, the resistor resists the combined current flow of both LEDs, and the resulting effect was that if the ATTiny412-connected LED was turned on then the brightness of the power-connected LED would decrease. I would probably fix this if I decided to mill a board again.
- a button (a tactile switch) between a pin on the ATTiny412 and the aforementioned resistor
- So the idea here was to use the pull-up resistor built-in to the ATTiny412, so that the pin would read as 5 V if the button was not pressed and 0 V if the button was pressed. This would have worked if I connected the button to ground directly, but since I connected it to the resistor after the LEDs, there was still voltage when the button was pressed, although not as high as 5 V. Because of this I had to use analogRead
while reading the button state instead of digitalRead
- Two 3x1 pin headers to expose the other pins, including 3 pins for the UPDI programming interface (UPDI/GND/VCC) and 3 pins for the other pins (PA1/PA2/PA3) on the ATTiny412.
- I decided to change this in my second iteration of the design
Creating a 3x1 pin header component¶
The fab library for Eagle didn’t include the type of 3-pin header which I wanted (for 1206 SMD parts; the one in the library was for through holes mounting) so I had to create a component myself for it. To do this, I mostly just modified the 3x2 component.
The components in Fusion 360 consist of two parts, a footprint (which goes onto the PCB) and a symbol (which goes onto the schematic) along with connections between these two parts. I duplicated the footprint from the 2X03SMD footprint and removed the left three pins, and I did the same for the symbol.
To create the component itself, I went to Create -> New Component
, added the symbol via Device -> Add
, and linked the footprint via New -> Add Local Package
at the right. Finally, I clicked on Connect
on the right and connected each pin on the symbol to a corresponding pin on the footprint; this would make sure that my schematic matches with the PCB.
Routing the PCB¶
To create the PCB, my first step was to switch to the PCB from the schematic (using the clearly named Switch
dialog at the top left of Fusion 360) and start moving the components into desired locations. Initially, they were all bunched together in the bottom left of the board, so I had to move them around to their desired locations. After that, I used the automatic router (Quick Route -> Autorouter
) to route most of my pins. This was slightly annoying, as often the autorouter would generate vias, so I un-routed everything (Unroute -> Unroute All
) and retried. One way to get the autorouter to generate less vias was to move components farther apart (and then later move them closer after the autorouter had completed). Eventually, this is how my board looked after both autorouting it and making a few manual adjustments to it:
Design revision¶
I decided that my previous design could have used more headers so that it would be easier to interface with external peripherals. One major problem with my initial design was that it included only one pin for external 5V / GND power, so it couldn’t actually get and receive power at the same time without another board. Therefore, I added a few other headers. The top header contains 3 pins for a 3-pin UPDI connection; the middle header has six pins (and an integrated resistor) in order to be used with the Quentorres and SerialUPDI without needing another board; the bottom header contains four pins for creating an I2C connection with another peripheral (if I can manage to get I2C working)
I also decided to use the Net Breakout tool while creating the nets, so that my schematic looked better and more organized.
Some things that I would do differently if I designed this again: - I forgot to expose pin PA3, whoops! - I also could have exposed some of the other pins externally, such as the button or LED pin, this would be useful especially because the button pin is not actually connected to anything else but the ATTiny412 while the button is not pressed - The switch and both LEDs could have been connected to different resistors - see above - I probably could have designed my name or another image on the board
Routing the PCB¶
One thing I noticed between designing the previous board and this one was that my traces were too thin to mill on our lab’s Othermill PCB machines. I looked at week 4’s work on testing the design rules for our lab Othermills, and decided to change the choices of clearance and trace size to make the board reasonably certain to correctly mill. To fix this before routing this design, in Fusion, I went to the menu in RULES DRC/ERC -> DRC -> DRC
, changed everything in Clearance
to 20 mil
, and changed Minimum Width
to 15 mil
. The Autorouter automatically follows the rules set in DRC. I could have also downloaded the DRC files from the fab library or the Othermill website
The board looked like this sometime after using Autoroute and moving around the traces a bit.
To make the board smaller I decided to rearrange a few components and traces:
Creating an outline for the PCB¶
Before I milled the board, I realized that the board did not have an outline. To create an outline, I used Board Shape -> Outline Polyline
and created a rectangle around the PCB. However, I initially had an issue where this outline was not getting recognized by the Bantam Tools software. I realized the problem I had was that Fusion had automatically created an outline already, so I had to delete the larger outline so that it could detect the smaller outline. I found this issue described on the Bantam Tools website documenting how to use Eagle.
Milling the PCB¶
The Bantam Tools software allows for importing brd files directly and generating the toolpath there, so I exported my work with File -> Export
in Fusion 360 as a brd file. Then, I milled the board.