Skip to content
Snippets Groups Projects
Electronics Production.md 14.6 KiB
Newer Older
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
#Electronics Production
Mitalee Parikh's avatar
Mitalee Parikh committed
This week is about learning how to fabricate a PCB.  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed

### Page Summary
1. Summary  
2. PCB fabrication   
3. Assembling the board   
4. Testing and programming  
5. Important and interesting links   
---

1. Summary  
---
There a some different options of in-system programmers in the [FabAcademy notes](http://academy.cba.mit.edu/classes/embedded_programming/index.html#programmers). In the AVR family, there are boards based on the the ATtiny45, ATtiny44 and ATmega16U2.  
I review all options, and decide to make the ISP based on [Brian's design](http://fab.cba.mit.edu/classes/863.16/doc/projects/ftsmin/index.html#check) because it seemed simple and straight-forward, and a good one to start with because it has ample documentation. It is called the FabTinyISP.

I used the facilities in FabLab UAE to fabricate the ISP with a Roland SRM-20 milling machine.
![Roland SRM-20](./images/ep/srm20.jpg)  
I use a double sided FR1 board to mill the ISP, because the lab is out of stock of single-sided ones that are not locally available.
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
An in-system programmer is basically serial programming that allows programming and reprogramming of microcontrollers, soldered on a target Printed Circuit Board.  This week is about learning both, making the PCB from scratch and programming the microcontroller on it to become a programmer itself.
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
2. PCB fabrication Workflow
---
The PCB workflow basically consists of making png traces/outlines from a design file, or using existing ones > creating toolpaths > prepping a milling machine > loading a copper sheet and endmill > setting origin on machine > milling and then cleaning to solder components before stuffing and testing the board.  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
### Create toolpaths
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
First step is to download the design files for the traces and the outline of FabTinyISP from [Brian's documentation page](http://fab.cba.mit.edu/classes/863.16/doc/projects/ftsmin/index.html#check).
The traces are the thin pipelines that connect the footprints of components.  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
[Traces (1000dpi)](http://fab.cba.mit.edu/classes/863.16/doc/projects/ftsmin/index.html)  
Mitalee Parikh's avatar
Mitalee Parikh committed
<img src="http://fab.cba.mit.edu/classes/863.16/doc/projects/ftsmin/fts_mini_traces.png" alt="traces" width="400"/>
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
The outline is the outer boundary to be cut. Sometimes it also includes through-holes to be made in the PCBs.  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
[Outline (1000dpi)](http://pub.fabcloud.io/tutorials/week04_electronic_production/fabtinyisp/fts_mini_cut.png)   
Mitalee Parikh's avatar
Mitalee Parikh committed
<img src="http://fab.cba.mit.edu/classes/863.16/doc/projects/ftsmin/fts_mini_cut.png" alt="outlines" width="400"/>

Mitalee Parikh's avatar
Mitalee Parikh committed
It is important to note that both these images are at 1000 dpi resolution in png format.
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Next, these png images need to be converted to tool-paths for CNC machines to follow. [Fabmodules](http://fabmodules.org/) and [Mods](http://mods.cba.mit.edu/) both, developed by the Fab community can be used to make the tool-paths. They run in the browser.
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
I first use Mods.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/mods.traces.jpg)
![](./images/ep/mods.outlines.jpg)
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
But it shows me unclear toolpaths with default settings, for both the traces and the outlines. With random dots being detected arounf the traces.  
![mods.traces](./images/ep/mods.traces.error.jpg)  
![mods.outline](./images/ep/mods.outlines.error.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
I'm not sure why these errors occured. I try using FabModules with the same files and same settings. And it works perfectly. So I guess Mods has a different way to read these files.  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
### Characterising design rules for your PCB production process
Mitalee Parikh's avatar
Mitalee Parikh committed
- Select **input format: png** (same as the file downloaded)  
Mitalee Parikh's avatar
Mitalee Parikh committed
- Select the traces file from your directory  
- The input section on the rights shows the meta info of the image. Check the resolution is **1000 dpi** and the overall size. The - image is 1:1 so the PCB will be the same size as mentioned here.  
- Select **output format: rml** (depends on the machine you use; Roland machines use rml)  
- Select **machine** from the dropdown: **SRM-20** (I'm using this at the lab)  
- **Speed: 4 mm/s** Standard speed used with a 1/64in endmill  
- **x0, y0, z0** all **0** this makes the cutting start exactly where you set the origin on the machine  
- **zjog: 2 mm** is the distance the endmill travels in z direction when it lifts up to move in the air to another xy coordinate  
- **xhome, yhome, zhome** are the coordinates the endmill moves to at the end of the job, i leave this empty so it take the default - value of the machine.  
- Select **process: PCB traces (1/64)** this basically fills in default values for the standard trace milling process  
- **Direction: climb** here is a diagram that explains climb vs conventional cutting  
- **Cut depth: 0.1mm** to cut through the upper layer of the FR1 boards  
- **Tool diameter: 0.4 mm** (=1/64 in)  
- **Number of offsets: 4** this is the number of paths around the traces, if its too little soldering components is difficult, if it - too much, it takes a long time to mill, 4 is just enough (-1 to remove everything completely)  
- **Offset overlap: 50%** The overlap between two paths, to ensure no material is left with error  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
![fabmodules](./images/ep/fabmodules.gif)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
With these settings, I **calculate** the toolpaths for the traces and **save** the rml file.  
Making the outline has the same process except the following changes:
Mitalee Parikh's avatar
Mitalee Parikh committed
- Select the outline file from your directory
- Select **process: PCB outline (1/32)** because outline is milled with a different endmill
- **Cut depth: 0.6mm** keep this a bit smaller than the tool diameter, so it doesn't break the bit
- **Tool diameter: 0.8 mm** (=1/32 in)
- **Stock thickness: 1.7 mm** Thickness of the FR1 stock measured with a calliper
- **Number of offsets: 1** The outline can be cut with just 1 path around the board
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Since the cut depth is 0.6, to  cut through the 1.7 mm stock, it will run the path 3 times till it cuts through the entire thickness of the stock.  This can be seen when you **calculate** the toolpath.
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
![outline.toolpath](./images/ep/toolpath.outline.jpg)
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
Here are the toolpath files for [traces](./images/ep/mitalee-fts_mini_cut.rml) and [outline](./images/ep/mitalee-fts_mini_traces.rml).  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
### Milling the board
Mitalee Parikh's avatar
Mitalee Parikh committed
After saving the toolpaths, next step is to prep the machine for milling.
On the left bottom corner, fix the FR1 board with a double-sided adhesive tape.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![stock](./images/ep/stock.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
SRM-20 can be controlled with a V-panel.
Mitalee Parikh's avatar
Mitalee Parikh committed
![v-panel](./images/ep/vpanel.PNG)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Using the XY and Z settings in the centre of the panel, move the Z to maximum to make space for fixing an endmill manually. Loosen the collet with a hex-key, insert the 1/64in endmill and tighten it snugly.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![endmill](./images/ep/164bit.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Next move the XY to where you want to define the origin point. The origin is at the left bottom of the file. So pick a spot close to the left bottom corner of the board. Bring Z close to the surface using 100x and 10x steps. When it is just above the stock but not touching it, loosen the collet while holding the bit, lit it gently fall on the stock and still while holding the bit in one hand tighten it with the other. This is one way to ensure a proper Z origin on the top of the stock surface.  
Mitalee Parikh's avatar
Mitalee Parikh committed

Now, on the v-panel set the XY origin and the Z origin here. Since we've adjusted the feeds and speeds in FabModules already, we do not change them here. Select **cut** and then on the pop-up window clear all files in the output file list before adding the traces rml.  
Select the traces file and hit **output** after closing the lid of the machine.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![output file](./images/ep/outputfilelist.PNG)  
Mitalee Parikh's avatar
Mitalee Parikh committed

The spindle will now start and run the toolpaths. The v-panl allows to **pause** the file, **view** to check if the cutting is alright, and then **resume** after. Doing this in the beginning of the cutting helps save time in case of improper settings.  

Here is how the machine should sound while cutting correctly.
Mitalee Parikh's avatar
Mitalee Parikh committed
<iframe
  src="http://academany.fabcloud.io/fabacademy/2020/labs/barcelona/students/mitalee-parikh/ed-continuity.mp4">
</iframe>  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/cut.traces.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

After the job finishes, move the Z maximum again and change the endmill to a 1/32in for cutting the outline. Use the same process as above and set a new Z origin. Do not change the XY origin this time, as it needs to match the previous job. Upload the outline rml to the output file list and start cutting.
This is how the cut result looks at the end of both jobs.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/cut.outline.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

I used a slotted screwdriver to remove the ISP from the machine bed.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/removeboard.jpg)  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
Next, I removed the copper layer near the usb side of the board with a cutting knife and cleaned up small bits and pieces of copper.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/removecopper.jpg)  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed

3. Assembling the board   
---
Mitalee Parikh's avatar
Mitalee Parikh committed
### Soldering Components
Mitalee Parikh's avatar
Mitalee Parikh committed
I make a list of components according to the Brian's documentation, and gather all components from the FabLab stocking shelves.
![shopping list](./images/ep/shoppinglist.jpg)
Mitalee Parikh's avatar
Mitalee Parikh committed
Next, I prep the workbench at the lab with a soldering iron, solder wire, fume extractor, tweezers, desolder braid, soldering stand, and a vacuum pen.
![soldering setup](./images/ep/solderingsetup.jpg)
![tools](./images/ep/tools.jpg)
Mitalee Parikh's avatar
Mitalee Parikh committed
Next, using the reference image and the schematic to locate where each component goes.
![](./images/ep/schematic.jpg)  

I start soldering from left to right top to bottom - starting from the microcontroller > diodes > resistors > capacitor > LEDs and finally the header.

Mitalee Parikh's avatar
Mitalee Parikh committed
This is how the board looks like:
![soldering setup](./images/ep/soldered.board.jpg)
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
4. Testing and programming  
---
Mitalee Parikh's avatar
Mitalee Parikh committed
### Checking the board
Mitalee Parikh's avatar
Mitalee Parikh committed
First I inspected the board visually to check if all the traces were clear from solder bits and all the connections were clean. I also checked if all components were soldered on the correct footprints and in the correct orientation.
![](./images/ep/tested.jpg)
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
Next, I use a multimeter to check the resistance across resistors and voltage across VCC and GND. Everything seems alright.
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/multimeter.test.jpg)
Mitalee Parikh's avatar
Mitalee Parikh committed
Next, I make assemble a ribbon cable, 6 thin cables connected side by side with female headers at both ends. Trick is to keep booth ends in the same orientation to correct and quickly attach the headers. After presseing them lightly, I used a mallet to fix them properly.
![](./images/ep/ribboncable.jpg)
Mitalee Parikh's avatar
Mitalee Parikh committed
### Installing software packages
Mitalee Parikh's avatar
Mitalee Parikh committed
To program the board, there are steps you need to follow to install the development environment first. I follow them from [this tutorial](http://fab.academany.org/2020/labs/uae/students/fatima-alhashmi/week5/week5.html) and [this guide](./images/ep/avr_steps.pdf).  
Mitalee Parikh's avatar
Mitalee Parikh committed
Installed [homebrew](https://brew.sh/) package manager. In a terminal window pasted this from the website:  
Mitalee Parikh's avatar
Mitalee Parikh committed
    <code>
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    </code>  

Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/homebrew.jpg)  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
It asked for sudo access, I typed in my computer password.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/password.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed
It started installing  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/installing.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed
But half way through I got an error:  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/error.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed
I typed in the command that the error suggested:    
Mitalee Parikh's avatar
Mitalee Parikh committed
    <code>
    git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
    </code>

Mitalee Parikh's avatar
Mitalee Parikh committed
This solved the error. I reinstalled Homebrew.  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/reinstalling.jpg)   
![](./images/ep/installing.again.jpg)   
Mitalee Parikh's avatar
Mitalee Parikh committed
Next, install brew tap   
Mitalee Parikh's avatar
Mitalee Parikh committed
    <code>
    brew tap osx-cross/avr
Mitalee Parikh's avatar
Mitalee Parikh committed
    </code>  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/brew.tap.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed
Install- brew install binutils   
    <code>
    brew install binutils
Mitalee Parikh's avatar
Mitalee Parikh committed
    </code>  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/binutils.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed
brew install gcc  
    <code>
    brew install gcc  
Mitalee Parikh's avatar
Mitalee Parikh committed
    </code>  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/gcc.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

    <code>
    brew tap osx-cross/avr && brew install avr-gcc
Mitalee Parikh's avatar
Mitalee Parikh committed
    </code>  
Mitalee Parikh's avatar
Mitalee Parikh committed

    <code>
    Brew install avrdude
Mitalee Parikh's avatar
Mitalee Parikh committed
    </code>  
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/avrdude.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Quit terminal, reopen a new window and check the version
    <code>
    avr-gcc --version
Mitalee Parikh's avatar
Mitalee Parikh committed
    </code>  
Mitalee Parikh's avatar
Mitalee Parikh committed
    <code>
    make -v
Mitalee Parikh's avatar
Mitalee Parikh committed
    </code> to ensure that make command is working  
![](./images/ep/version.make.jpg)   

###Firmware source code:  
Extract the zip, and then using terminal  
change directory to where the file needs to be saved and run  
<code>make</code>  
![](./images/ep/file.png)   
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/cd.make.png)  

Mitalee Parikh's avatar
Mitalee Parikh committed
A file called *fts_firmware.hex* will be created  
![](./images/ep/hexfile.png)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
### Steps to activate the programmer:  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Plug in a programmer using a compatible USB adaptor port and the ribbon cable like so  
![](./images/ep/connection.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Making sure, the ribbon cable is in the correct orientation  
![](./images/ep/ribbon.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Run <code>make flash</code>  
![](./images/ep/make.flash.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Run <code>make fuses</code>  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Now, I need ensure that my Mac recognizes my FabISP. In About this Mac > System Report > Hardware > USB, check that the ISP is visible  
![](./images/ep/system.report.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Run <code>make rstdisbl</code> to disable reset, It will blow the rest fuse. After Doing this step I will not be able to program my FabISP with another ISP programmer once the rest fuse is burned.  
![](./images/ep/rstdisbl.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Now the FabISP is a programmer.  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
### Steps to burn bootloader:  
Before using the programmer, the board needs to be prepared using Arduino IDE.  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
1. Update Arduino IDE to the latest version [from the website](https://www.arduino.cc/en/software).  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
2. Connect my board with FabISP using a ribbon connecter. Make sure the laptop recognizes USBtinyISP.  
Mitalee Parikh's avatar
Mitalee Parikh committed

3. In Arduino IDE preferences > settings > additional board managers URLs, add *https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json*, click OK
Mitalee Parikh's avatar
Mitalee Parikh committed
![](./images/ep/additional.boards.manager.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
4. Open tools > board > boards manager, and search for ATTInyCore library and install.  
![](./images/ep/attinycore.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
5. Now in tools > board:, options of ATTiny Microcontrollers should be visible  
![](./images/ep/board.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
6. Again in Tools > Processor: select ATtiny44  
![](./images/ep/processor.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
7. Select clock > external 20 MHz  
![](./images/ep/clock.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
8. And Programmer: USBtinyISP  
![](./images/ep/programmer.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
9. Then Sketch > Upload using programmer  
![](./images/ep/upload.jpg)  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
10. Tools > Burn bootloader  
Mitalee Parikh's avatar
Mitalee Parikh committed

Mitalee Parikh's avatar
Mitalee Parikh committed
Now the board is ready to use as a programmer.  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed


Mitalee Parikh's avatar
Mitalee Parikh committed
4. Important and interesting links  
Mitalee Parikh's avatar
ep  
Mitalee Parikh committed
---
Electronics Production class [notes](http://academy.cba.mit.edu/classes/electronics_production/index.html) + [video](https://vimeo.com/513517157)  
Mitalee Parikh's avatar
Mitalee Parikh committed
FabAcademy Tutorial pages for [Building the FabTinyISP](http://pub.fabcloud.io/tutorials/week04_electronic_production/fabtinyisp_english.html) and [using a SRM-20 for milling PCBs](http://pub.fabcloud.io/tutorials/week04_electronic_production/srm20_windows.html)  
[FabTinyISP by Brian Mayton](http://fab.cba.mit.edu/classes/863.16/doc/projects/ftsmin/index.html)