# Electronic Production¶

• Characterize the design rules for your in-house PCB production process
• Make an in-circuit programmer that includes a microcontroller

This week is all about mastering the worflow to create your own PCBs. This is a new area to me, and I am so excited to begin! I did two boards during the students bootcamp but was guided by my instructor. This time I have to master the process and the tools.

## Board production process¶

### Characterization of Roland SRM 20¶

The machine we have at the lab is a Roland SRM 20. You can see our working spot on the picture above, with the SRM 20 on the right, the computer and the microscope.

We first need to characterize the machine and the milling tools we’ll use. After that we will manufacture two programmers: SWD and UPDI.

#### Prepare the machine¶

The SRM 20 is a CNC machine controlled by a software called VPanel. Before starting anything, you need to install the mill and calibrate the machine.

Instructions
Open the front cover and place the copper on the sacrificial bord (make sure to use double-side tape and that everything is flat)
Insert the mill on the collet
The mill must be inserted untill its plastic ring
Operate the machine to place the mill above the copper plank and place the Z axis near the plank (be careful during the descent!)
With your fingers, drag the mill to make it touch gently the copper
Don’t forget to zero the Z axis on VPanel
Drag the mill up with VPanel and tighten it (not like a brute, but it must be tight enough to not let the mill go up during the operation)
With VPanel, approach the mill near zero. First with cursor step to continue, then x100, then x10.
Once you’re close to zero, take a multimeter and connect the mill to it. With one hand, touch the copper plank with the multimeter, and with the other, take the mill down with the cursor step at x1.
When you hear the bip, you can calibrate the Z axis on VPanel, it’s done.
You just have to place your X/Y axis now: drag up the mill by 2 millimeters on the Z axis, then place it at your origin point before clicking on the X/Y button on VPanel.
Before milling, start the spindle for five minutes at least to warm up the machine. You are now ready!

#### Depth test¶

We did some tests to check the best parameters for the milling tools we own at the lab.

For the tracks, we use a 0.2mm mill that you can see under the microscope on the left. My instructor taught me how to design a few experiments to determine which parameters were the best depending on the tools we have.

We first designed in FlatCAM a few tracks with different depth parameters. This way we can determine which depth corresponds to the exact diameter of our tool, which is of 0.2mm.

Tracks parameters in FlatCAM
Cut Z From 0.02 to 0.09mm (testing value)
Feedrate X/Y 180
Feedrate Z 100
Spindle 8000

After milling we cut the copper plank with a 2mm mill and it worked perfectly (no need to change the standard parameters we had in this case).

Cutting parameters in FlatCAM
Cut Z -1.8
Feedrate X/Y 180
Feedrate Z 100
Spindle 8000

We then removed the test from the machine and tested the isolation of each track with a multimeter. We determined that under 0.04mm, tracks were not isolated at all.

After that we put the test under our microscope and turned on the camera on the computer to be able to capture some pictures.

We observed that the track that was closest to our wanted parameters were the one with 0.06mm depth.

We helped ourselves with a handy little calibration ruler, as you can see on the right. Below are the tracks observed under the microscope.

Pictures using AmScope

The quality of the pictures taken is not that good, I must go a little deeper in the parameters for better results. I converted the .dng pictures into .jpg as described here.

#### Stepover tests¶

Now that we have an ideal parameter that correspond to our tool diameter, we need to find the best stepover value for our tracks.

For that we can test different values from 10% stepover to 30% and check with the microscope if there were any copper leftovers between the board and the track.

We realized quickly that 30% was the best parameter so we decided to expand our experiment to 40%. We finally determined that the minimum stepover value for this 0.2mm mill is of 35%.

#### Neil’s test¶

I also tried Neil’s test files using Mods. I describe in details how to use mods in the Mods section below.

### Communicate with the machine¶

To communicate our designs to the CNC, we need to use a converter: I tested FlatCAM and Mods and started to learn how to use KiCad to help me during the process (the BOM files are marvelous!).

#### FlatCAM¶

I made myself a cheatsheet to centralize everything I learned about the FlatCAM installation on my Ubuntu 20.04 laptop. I won’t detail it on this page as it is already a busy week.

First you need to import the gerber files of your board into the software and place it near the origin (be careful of the position of the origin, it will impact the set up of the machine).

Then you need to characterize your tools for every operation. We need three tools, so three sets of parameters. When a tool is set up, a geometry object is created and appears in red.

After all geometry objects are created, we need to generate the files for the machine itself. We can visualize the result in blue: it corresponds to the real path of the mills. It is really handy to check your work and can avoid making some mistakes about the tool diameter or stepover path.

Once everything is set up, you can visualize the paths (hit Space to hide a path when selected).

#### Mods¶

A little help from Finland

To help me started, I watched the very helpful video Kris made for the fablab Aalto last year. Thank you!

First I opened mods and selected the Roland > mill > SRM-20 > PCB png program (I wanted to test the file Neil showed us in class on Wednesday).

I was granted by the familiar view of the nodes Neil showed us during the lecture. I suppressed my urge to unravel the whole thing and dived into the parameters.

Mods step by step
I first uploaded the PNG file of the test I wanted to make in the read png node.
I then deleted the WebSocket device node and chose module > open server module > file > save instead. I then connected the input to the Roland SRM-20 milling machine output.
I initialized the parameters of the machine in the Roland SRM-20 milling machine node. It’s important to put the Z origin above zero to protect the mill.
I changed the parameters of the mill raster 2D node to match the first task I wanted to do: trace the tracks with our 0.2mm mill. I put the same parameters than in FlatCAM earlier and hit calculate.
I obtained a first visualization of the job and saved it in an RML file.
I changed the parameters to make the negative of the board. That corresponds to our 0.8mm mill.
I saved the result in another file.
I uploaded the other file for the edges and changed the parameters one last time.
And saved the result: notice there is two passes this time for the 2mm mill.

VPanel setup

In VPanel you need to specify the type of file to read. For mods files (.RML files) you need to precise in the Setup what you want.

Otherwise you’ll have this sort of error (and strange behaviour of the machine!)

### Milling the boards¶

I made two boards during the Student Bootcamp with the help of my instructor: I learned then that even if you think you thought of everything, there is still details to be corrected… Lesson learned.

For milling the board, we use the same procedure described above, except for a new process: the removal of the copper where it is not needeed. For that we use a 0.8mm mill with the following parameters.

NCC parameters in FlatCAM
Tool diameter 0.8mm
Cut Z -0.05mm
Seed-based X

Unfortunately I didn’t took so much pictures of the UPDI than from the SWD, but you can assume I did the same steps for the two boards (but with a new copper plank for the UPDI). I however took a video during the UPDI milling process.

Milling SWD and UPDI boards
We use the 0.2mm mill to cut the tracks with 0.06mm of depth and 40% stepover.
Then we use the 0.8mm mill to remove the copper from the board in a circular pattern(seed-based parameter)
Time to cut with the 2mm mill.
We can now remove the board from the sacrificial plank
And check under the microscope if everything is all right: you can see that the NCC procedure didn’t remove everything

PCB Trimmer

When we need a new copper plank we use our PCB trimmer, as you can see in the picture below.

### Varnishing the boards¶

We are lucky in our lab because we can push a little deeper into the PCB fabrication process. Manuel showed me how to varnish my boards in exchange of a detailed documentation of the process: here it comes

#### Applying the varnish¶

First you need to clean the board: use a polivit gum to deoxidize the PCB and isopropyl alcohol to clean the gum residue.

Then it’s time to apply the varnish: a few drops is enough, as you can see on the video below.

Then you have to distribute the varnish fairly on the all board, preferably without making bubbles. We use pieces of transparent sheets made for splatten the varnish onto the boards, and a little piece of vynil to spread everything evenly.

It worked well with the green varnish but the red one was less easy to apply (the varnish was older).

Then it’s time for the UV light to shine! To make the varnish permanent you need to put the UV light on for at least five minutes.

After that you need to clean the sides of the boards where the varnish solidified: it’s easy to clean with a little ethanol (even your fingers can have that special treatment afterwards, they will need it…)

Then it’s time to make room for the components: all the board has been varnished so it means that we don’t have access to the pins anymore. We are going to remove a thin layer of varnish thanks to the laser cutter. On KiCad, we can plot the two layers we are interested into: the mask and the edges (File > Plot > SVG).

Now we can prepare our files for the laser cutter (for a full discovery of the machine, see the work done during Computer Controlled Cutting week).

We need to place our board precisely on the honeycomb. For that, we use the edges to cut a piece of material (whatever it is, in this case it was plywood) and insert our board into the hole made, as shown in the picture below. Don’t forget to set up the focus again after putting the board into the laser cutter and to mark the job before cutting the material (to save the origin).

Then you can get the board and clean it with a little acetone to get rid of the last bit of varnish on the boards (be careful with it and use a brush).

You can admire the result on the picture below: the important thing to remember is to keep everything aligned (it took us a few tries to insert the SWD board because for some reason, the SRM milled with a 2mm margin around the board and we couldn’t manage to insert it into the laser cutted plywood hole).

For the UPDI board we decided to test the oven soldering technique: we then cut a mask into a piece of paper of 120g (Manuel did a lot of testing and it appears this is the best paper weight to suit our needs).

Laser parameters

Power Speed Frequency
Varnish x2 40 20 1000
Paper (edges) 32 5 1000

### Soldering¶

I had a little experience soldering because we did some exercises during the Student Bootcamp. Nevertheless, I need to practice more because my hand soldering is not very balanced: I have a tendency to put too much solder on the pins and I had to use a desoldering braid a lot more than expected. Manuel also showed me how to use soldering paste and the oven: much quicker and easier, but I can’t expect to use this technique for my final project: I want the satisfaction to be able to say: I soldered everything in there !

#### Oven: solder paste¶

I first started by collecting every components I needed for the UPDI. I helped myself with the BOM file generated by KiCad: this is gold, I love this feature!

I then fixed the mask onto the board with a piece of tape (you need to anticipate the removing of the tape when you place it!) and applied solder paste with Manuel’s help.

Then I placed carefully all the components in place and put the board into the oven.

This is an infrared oven with some pre-existing programs. Manuel told me the first one (F1) was sufficient for our need: it heats the oven to 150 degrees and stays there for a bit, then goes up to 250 degrees before going down. The all program lasts seven minutes.

You can admire the result: very precise and quick technique !

#### Hand: tips and tricks¶

Soldering day: don’t drink coffee.

We have a nice soldering station at the lab, with a device to keep away the hazardous fumes. I used mainly two irons and get from one to another according to the components I was soldering.

The easy way to solder a microcontroller is to place a little solder on one pin, then keep the component in place with a small clip: you just have to put the iron on the pin and the component will stick on the solder. Then you can solder the other pins and go back to the first one when everything is soldered correctly.

I take the soldering exercise as a meditation: deep breath, keep calm and enjoy the process

### Bonus: Chemicals¶

We are very lucky in our lab because we are located in a university: that means we have access to a lot of equipments, including a chemical studio where we can make our boards. We decided to make the Hello Board ATtiny412.

Warning

We can use these techniques because we have the right equipment for it. Wear protection glasses, gloves and lab coat all the time. Use a ventilated area if needed.

#### Circuit transfer¶

The first step is to print on two transparent sheets the circuit we need. Two sheets because if the printing is not of excellent quality on one page, the other can correct it: you minimize the risks of errors. Once you have everything out of the printer, you can tape them together (take your time, you don’t want any mismatch between your two sheets).

Now it’s time to transfer your board image to the PCB: we use a copper plank with a thin polymer layer which is sensitive to light. You need to be quick for this as the polymer layer will react to the light immediatly. Place everything in the UV lamp for three minutes.

#### Sodium hydroxyde¶

Once the light had transfer the circuit on the copper plank, we need to remove the polymer layer we don’t need: this is a quick step again. Remove the tape and place the board into a recipient. Cover the board with sodium hydroxyde ( Don’t touch it with your bare hands, gloves and glasses are mandatory!). Then you need to make waves movement for five minutes to reveal the circuit on the board.

This is a video of the process: it’s accelerated four times, but you can see it does not take long for the circuit to appear. The all process lasted four minutes.

Once it’s done, you need to clean the board with oxygenated water. you can relax for a bit, the quick operation steps are over!

#### Iron perchloride¶

Now it’s time to remove the copper from the board where we don’t need it: we use iron perchloride, which is also very dangerous for your skin and eyes, don’t put away your equipment.

You will need to heat the iron perchloride to accelerate the process. The process lasts about 30 minutes. The movement is the same than before, illustrated in the video below.

During the process you will observe the copper be removed from the board. You need to wait until there is no copper visible: you don’t want a short-circuit because you were impatient!

Once it’s done, you can clean the board with oxigenated water again, then remove the protective layer of polymer with acetone to reveal your circuit: you’re mostly done!

Be careful to ventilate when using acetone: you can see on the picture I am manipulating it behing a glass, it’s because we have a ventilation system that is very secure. Don’t mess with your lungs.

#### Tinning¶

We tested tinning one of the board (we made two with the same technique) with a in-house solution made by Simon, our chemist.

It’s a mix of solide solder and thiourea that makes the chemical reaction of the copper tranforming. You don’t need to understand every component of the mix, just remember to be careful, it’s very abrasive.

You need to heat the solution for at least 20 minutes and use a magnet as a catalyst: I loved the beauty of the process, so here is a short video of it:

The process is very quick, a blink of the eye and you missed it: we made a video where you can see the copper turning instantly silver.

You can now clean your board and enjoy: it’s done!

#### Waste disposal¶

You need to take care of your waste: in the university we have procedures to do this securely: test the acidity of your liquid with PH paper to identify in which recipient you will throw away your liquid. For the gloves and papers, we have a dedicated bin. And for the dishes, wash everything with hot water.

#### Result¶

I soldered the two boards afterwards: I can see that the tinned one make soldering easier.

And here are some pictures of the result once everything is soldered! I used our PCB trimmer to cut the board excess and sanded everything.

When to use this technique?

I don’t think this is a very efficient technique when prototyping: you can’t make mistakes because it’s harder to fix than on a milled board. But if you have a board that you want to make multiples times, it can be very efficient to make every boards in one process.

## Programmers¶

It’s time to test if everything works correctly. We tried to program my SWD with my instructor’s programmer. All the indications about programmig the boards are on the fabcloud.

### SWD¶

1. First download edbg sources.
2. Install the package libudev-dev
3. make all
ejoz@ejoz-xps-13:~/Applications/edbg-master$make all gcc -W -Wall -Wextra -O3 -std=gnu11 dap.c edbg.c target.c target_atmel_cm0p.c target_atmel_cm3.c target_atmel_cm4.c target_atmel_cm7.c target_atmel_cm4v2.c target_mchp_cm23.c target_st_stm32g0.c target_gd_gd32f4xx.c target_nu_m480.c target_lattice_lcmxo2.c dbg_lin.c -ludev -o edbg  4. Change permissions chmod a+x edbg  5. Move edbg to binary folder sudo mv edbg /usr/bin/  6. Verify edbg is in the path command -v edbg  7. Download free dap binary 8. Flash the board in the same folder as the binary previously downloaded edbg -ebpv -t samd11 -f free_dap_d11c_mini.bin  Fail Sadly, in the lab we don’t have the same version of 3.3V regulators: we realized the pin was ordered differently when checking the current on the board. They must arrive on Thursday, fingers crossed! Update: We received the regulators and changed them, it worked perfectly (what a relief!) I just add to add a litle solder to the USB connectors to make a perfect connnection (later on I did other boards where I did not need to do that). When typing the command for the first time I had a Permission denied error, so I used sudo. ejoz@ejoz-xps-13:~/Desktop/programmer-swd-d11c$ edbg -ebpv -t samd11 -f free_dap_d11c_mini.bin
Error: unable to open device /dev/hidraw1: Permission denied

ejoz@ejoz-xps-13:~/Desktop/programmer-swd-d11c$sudo edbg -ebpv -t samd11 -f free_dap_d11c_mini.bin [sudo] password for ejoz: Debugger: Alex Taradov Generic CMSIS-DAP Adapter F2C7C5F2 v0.1 (S) Clock frequency: 16.0 MHz Target: SAM D11C14A (Rev B) Erasing... done. Programming.... done. Verification.... done.  9. Check if your device is recognized by your computer with edbg --list ejoz@ejoz-xps-13:~$ edbg --list
Attached debuggers:


Everything is working as intended

### UPDI¶

Once the SWD was programmed, I used it to flash my UPDI programmer.

Download the sam BA bootloader binary and flash the board (you can also do it via the Arduino IDE with Burn bootloader)

bash
edbg -ebpv -t samd11 -f sam_ba_SAMD11C14A.bin


Everything is fine
bash

Clock frequency: 16.0 MHz
Target: SAM D11C14A (Rev B)
Erasing... done.
Programming.... done.
Verification.... done.



After that I unplugged the SWD and plugged the UPDI only to upload the firmware via the Arduino IDE.

1. Download the Fab Sam Core by adding https://raw.githubusercontent.com/qbolsee/ArduinoCore-fab-sam/master/json/package_Fab_SAM_index.json to the Additional Boards Manager URLs in Arduino IDE.

2. Select the right board in Tools > Board

3. Change some of the settings

• USB config: CDC_only
• Serial config: TWO_UART_NO_WIRE_NO_SPI

4. Select the right port

5. Copy the SAMD11C_serial.ino sketch and upload it to the board

You should be granted by this message:

Atmel SMART device 0x10030006 found
Device       : ATSAMD11C14A
Chip ID      : 10030006
Version      : v2.0 Aug 31 2021 14:06:56
Pages        : 192
Page Size    : 64 bytes
Total Size   : 12KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : true
BOR          : true
Erase flash
done in 0.210 seconds

Write 10512 bytes to flash (165 pages)
[==============================] 100% (165/165 pages)
done in 2.131 seconds

Verify 10512 bytes of flash
[==============================] 100% (165/165 pages)
Verify successful
done in 0.053 seconds
CPU reset.


### Tests with Hello Board¶

To make us a little cheerful (we didn’t have the right regulators yet), we tested the Hello boards with an Atmel ICE programmer. Stephane had to update the Atmel firmware but it eventually worked: my board blinked!

Atmel ICE and hello boards

When connected to an Atmel ICE programmer, the Hello board must be powered by an outer source: here we used an Arduino.

After receiving the right regulators and flashing the SWD and UPDI programmers, we tried to upload a blink test with the UPDI: it worked, we have a working programmer!

## Files¶

### BOM files¶

This was an exciting week! I learned so much. I hope my documentation isn’t too long to read, I tried to keep things simple but there were so much going on that I couldn’t make it shorter than this (it could have been longer, be relieved!).

I am not afraid of the board milling process anymore and I’m glad, I wanted to be able to make boards without fearing it during the rest of the Fab Academy. I’m much more afraid of the components however: they all look so alike, one letter can change everything: I’m still amazed that the 3.3V regulators are not the good ones and that it stopped me for achieving my assignement! I will update this page when we receive the good ones and hopefully, when the programmers will work

A lot of pictures were taken this week, thankfully my python script is very helpful to take care of that! I always check with ncdu before commiting.

# Before resizing
--- ../images -------------------------------
122,6 MiB [##########] /week05

# After resizing
--- ../images -------------------------------
3,6 MiB [##########] /week05


I decided to communicate about my experience on social media, so I will add my posts on my documentation: it’s all part of one process, getting everyone to know about the Fab Academy and how amazing it is!

I was lucky enough to present the various techniques I discovered this week to Neil during class: it’s available online, as all Fab Academy classes.

You can watch it at 1:17:20

Last update: March 13, 2022