Redesigning the Board
I started by watching some Eagle tutorials online: I found this and this specially complete, as well as this, full of small videos. For the actual board I went through the "official" tutorial, more tuned to the week's assignment.
Before that I had a fantastic review of basic electronics with Emma, hopefully the last one I will need to go through after all the Arduino crash courses I have done before. Very good to refresh all this concepts again, complemented withe the book Getting Started with Electronics, a classic from the 80's available online here.
As for the electronics design workflow in Eagle, I found it quite easy to grasp. Summarized:
1. Create new project: File > New > Project (directory can be changed under Options > Directories).
2. Create new schematic: File > New > Schematic.
3. Use libraries of components. They can be found online, often from suppliers like SparkFun or Adafruit, so they not only make sure you have the correct footprint for their products but they also make it as easy as possible for you to purchase their product. In this case we will be using 1206 components (0.126 inches × 0.063 inches) from ng.lbr, fab.lbr and FAB_Hello.lbr. respectively.
In order to install the libraries, just paste them in the folder Applications > EAGLE > lbr. Once there, go to Eagle's toolbar Library > Use > Select them all > Open. Libraries are now ready to be accessed and its content available.4. Add components: drop all the components you need before start arranging. Components can be copied and pasted. Using the integrated search engine can speed up a lot the process unless you know exactly in which library the components are. For this specific exercise the required components (BOM) are:
- Included in the original design:
- Pin Header 2X3: powers the board and let the computer talk (program) it.
- Microcontroller: ATTINY44A. Once the microcontroller is installed, the program stored is non-volatile memory, so it will be remembered.
- FTDI header: powers the board and allows it to talk back to the computer.
- Resonator (20MHz): external clock. The ATTINY has an internal 8MHz resonator but this one is faster (increase the clock speed of the processor) and more accurate. It has no orientation!
For the board to work, the resonator is not necessary. However, it is necessary for a proper communication and debugging. If the only thing one needs to do is calibrate the sensor, using the internal 8Mhz clock and the Zaerc's script is enough to have proper serial communication for the purpose. - Capacitor (1µF): filters and stores power. Although in the schematic looks like polarized, the SMD capacitors that we are using have no orientation. Every board with a microcontroller includes this component.
- Resistor 3 (10KΩ): helps hold or pull down current of the reset pin of the microcontroller. Every board with a microcontroller includes this component.
- Added to the design:
- Resistor 2 (10KΩ): pull up resistor. Here you can find everything you need to know what a pull-up resistor is and how to calculate the necessary resistance value.
- Resistor 1 (499Ω): typical current limiting resistor that prevents the LED from burning. You can calculate the necessary value for this resistor with this simple LED calculator.
- Button (OMERON Switch): to do something with it eventually.
- LED: to be controlled with the switch. The Cathode was supposed to be indicated with a double line, but I could not see it so I needed to check the orientation with the multimeter.
5. Rename and add values to components. Necessary to be able to see what is what and not make mistakes in the arrangement of things. Parts can be renumbered and renamed after in a more logical way based on their location thanks to scripts. File > Run ULP... > rename/renumber.ulp.
6. Position and make rough connections using nets.
7. Clean schematics (reposition, align, make junctions with dots...). By giving the nets the same names virtual connections can be made, avoiding the need of a very messy schematic full of lines. Eagle will ask if you want them to be connect them. Label them after so the name is visible in the schematic.
Dear me (note from the future): when dealing with Tx and Rx, it is better to make the connections visible in the schematics rather than tagging the net. As it turns out, Tx (transmitter) from the FTDI cable (find picture bellow) goes to receiver (Rx) of the board, and vice versa; which means that the schematic above, although perfect in design terms, is confusing in the naming. It gives to pin 12 the name Rx when actually, from the perspective of the micro controller (the important one for the code afterwards), pin 12 is actually a transmitter (Tx). A better version of the schematic would be instead the following, where pin 12 is Tx (connected to Rx) and pin 13 is Rx (connected to Tx). Unfortunately it is not possible to assign different names to the pins that are physically connected.
8. Verify using ERC (Electrical Rules Check) before you move on to the PCB layout: Tools > ERC. This will help corroborate that there are no lost connections. I had a few warnings (different than errors) related to the isolation of the CTS and RTS pins in the FTDI header, but they are not used in this case so this situation is normal. There was also a warning related to the lack of value of part S1, which is a button and thus has no value itself. Just approve them and move on.
9. Make and adjust board layout: switch to board layout mode and move and rotate (right click) components inside the grey rectangle (board maximum dimensions). The yellow lines represent the connections defined in the schematic and they are referred to as airwaves. Every time you successfully route a connection the airwire disappears. I strongly recommend using the command Ratsnest as you go on with the rearrangement to recalculate the connections and clean up the airwaves.
10. Route the traces: you can try the Autoroute command and change what you don't like or go directly for the manual routing using the command Route. On the menu above you can choose the kind of bend, radius and width of the trace. THIS IS VERY IMPORTANT!
- Firstly because the size of the traces will define the current that can flow through it (not so important for simple circuits like this).
- Secondly, because if they are very thick and the clearance (space among them) is very small, the end mill won't be able to go there and the traces will remain connected, generating a short in our circuit.
- Thirdly, because it is important to avoid straight angles in you board design. The electrons have more problems to travel through sharp edges, especially if the traces are thin.
The way to avoid it is by eye, setting a grid of 0.4 mm (ø of the end mill) to be able to see if the space between traces is enough; and by verifying the design rules (see point 12).
Note: if there is no way to arrange the traces so they don't cross and we don't want to make a 2 sides board, we can hop over traces by making use of 0Ω resistors.
11. Clean and finish design: place holes for screws, adjust size and corners of PCB outline (radius can be made with the command Miter), and add text. Although text can be easily added in Photoshop when editing the png for fabmodules, text can be also added in Eagle, ideally using the typeface Vector that is rounder (friendlier to mill) and can be scaled by percentage.
If you are going to to outsource the production of the PCB you can also arrange the location of the names and values to make sure the silkscreen print is nice and clean. For it you first have to detach the name from the component with the command Smash.
12. Verify using DRC (Design Rules Check): this allows you to check the "manufacturability" of the board based on a set of rules you want the layout to respect. In every case will be different (depending on the manufacturer) but the settings the check up is based on can be changed. Tools > DRC. In our case, we want to check the design rules based on the Modela, and adjusting the settings is as easy as loading the MODELA_CORRECT.dru file and running the check with these design rules. However I loaded a different one that seemed not to be well adjusted (fab.dru) and therefore... (scroll down to see the mistake).
13. Run a GND plane (optional): this helps you preview (and therefore make decisions beforehand about) the amount of copper that will be removed from the board, although this can be adjusted in the Fabmodule for the Modela through the setting offsets. In my case I did the last.
If you still want to do it, create a Polygon (make sure your are in the right layer, Top or Bottom) slightly bigger than the outline of the board, name it GND and run Ratsnest (remember that you have to redo this last bit every time you reopen the board layout). Make sure you Keep Orphans and Thermals on, as well as the Width, Spacing and Isolation are the adequate for the Modela to be able to reproduce it.
14. Renumber components (in case you want the labeling to be based on the actual layout distribution instead of the schematics): you can File > Run ULP again.
15. Export the traces layout to be milled with the Modela: make sure all the important layers are on (Top, Bottom, Pads and Vias for the traces. Dimensions, Pads, Drills and Holes for the layout). File > Export > Image > PNG > Monochrome > 1000 dpi (the higher the resolution the finer the job can be).
Very important!: in order to make sure that the outline shows up in our png when we export, we have to "extend the canvas" by making a bigger square around the board layout and keeping it hidden in layer 51 tDocu p.e. This way we make sure the program "broadens" its view and the outline is included in the export.
Remember: the Modela cuts out black and leaves white.
16. Generate BOM (optional): using the command run bom.ulp.
17. Edit board files: clean unwanted copper with the Paint Bucket Tool, add text, and specially invert the color of the inner part of the cutout file. Holes will be made just by leaving them black. Make sure you didn't change the size by toggling between the preview of both the images of the traces and the layout to see if they differ.
Milling and stuffing the board
I proceed to run the milling job following the instructions I have collected in the previous exercise.
The process went well and the result seemed excellent at first sight, so I went on for the stuffing. However, I didn't check for shortcuts with the multimeter (BIG MISTAKE) and only when all the components were soldered I found the shorts (well, Emma found them). I had also soldered a FTDI header that was too short for the FTDI - USB cable, so I had to substitute it for one with bigger pins.
Always check with the multimeter (at least) that:
- There is no short between VCC and GND.
- There is no short between the different pins of the headers (try all possible combinations!).
Mistake
What happened is that, as it looks like, I checked the design rules with the wrong settings (loaded fab.dru) instead of MODELA_CORRECT.dru and so the little clearances didn't show as an error (clearance was set at 0.3 mm when the end mill is 0.4mm). The Modella didn't cut there and the traces that weren't supposed to be connected were, in fact, connected.
I had to remove the micro controller, cut the traces with a cutter (hein!?), check with the multimeter wether or not they were still connected and solder the micro controller again. But before I had to flatten the tin that remained in the footprint of the micro controller using a bit of the copper braid.
I checked again with the proper design rules and indeed all the errors were there, ready to be found before I milled the board. Well, I corrected the layout by leaving more clearance and checked again (for next time).
Workfiles
Añadir un comentario