Skip to content

5. Electronics production

In this week, I made an in-circuit programmer, milled a PCB and programmed it. In the group task, we characterised the design rules for the PCB production process by trying different milling bit diameter sizes and cutting depths.

Assignment

Group assignment

  • Characterise the design rules for your PCB production process

Individual assignment

  • Make an in-circuit programmer by milling the PCB
  • Program the PCB
  • Try other PCB processes (optional)

Group assignment

PCB Fabrication

Like last week, our group included Alok, Arash and I. We downloaded two PNG files:

We uploaded them to mods in order to convert them into mill-able files with the correct settings. We started with the traces file (the first one) and the process is described below.

You go to mods, as shown in picture 1 in the image below, right click and select programs. Then select open server program and choose Roland/mill/SRM-20/PCB. After this, the default program which wants to communicate with the milling machine over sockets opens. Since, in our case, Roland is not connected, instead of sending the output to a socket connected to the milling machine, we send it to a file. So as shown in image 4, we delete the web sockets module and right click to add a new server module called file/save. The input port for this module is then connected to the output port of “Roland SRM-20 milling machine”.

We used the mods program to generate the .rml files needed by the milling machine. In the below image we have marked with red all the places where changes for the milling settings were done. The settings differ depending on whether it is traces or the outline file being milled. In the top left corner, we had to put in the png file name. In the right corner we have the tool settings. In the middle “mill traces” is selected as we are milling the traces and not cutting the outline. Under Roland SRM-20 milling machine, you set the origin settings (x, y, z) to 0.

Milling Process

Before milling, two-sided tape should be placed on the back of the board that is to be milled. This is to ensure that the board is firmly attached to the surface of the milling machine and will not move during the milling process. Also, it is important to make sure the surface the board is placed on is flat or as even as possible for a smooth cut and that the right milling bit is put in the machine.

We used a Roland SRM-20 milling machine. To mill files, you open the front cover (the part with SRM-20 written on the bottom right) by lifting it up and placing the board. You close the front cover and to operate the machine, you press the power button on the top right corner. A LED light that stays lit indicates that the machine is on.

For milling, you have to put the desired milling bit into the machine. When the PCB is in place, you open the front cover and using your fingers, put the milling bit into its head and tighten it using a hex key. The bits are fragile and should be carefully inserted as they easily break if they fall. The process for inserting the bit into its head in the machine is shown below

When the rml files are in place, you start the VPanel program from the computer. VPanel’s interface with its core functions is shown below.

The main process for milling involves positioning the milling bit along the X, Y and Z axes. This moves the bit along the length and width of the board and vertically (defining the starting point for milling). Save the X/Y origin settings when ready. Then position it vertically and when the bit is near the board, you should loosen the head with your fingers and lower it gently onto the surface of the board. Save the Z origin settings, retighten the bit and upload the file to be milled. In Vpanel, to open the rml file, you need to press the Cut button (#12 in image above), from the resulting dialog box, delete all files, select the correct file (first the traces then later outline) and press Output to initiate the milling process.

This process is displayed below.

Below are images of the milling process.

We used 3 different parameters (shown in the table below) for the milling bits. We first milled the board with a flat bit of diameter 0.4 mm and a cutting depth of 0.1 mmm. Then for the other two we defined the diameter settings in the software of the program.

Tool Cutting Depth Settings Diameter settings
Flat 0.4mm 0.1 mm 0.4 mm
V shape 0.2 to 0.5 mm 0.1 mm 0.2 mm
V shape 0.2 to 0.5 mm 0.06 mm 0.1 mm

For the first setting we got the image below:

  • It’s not possible to mill tiny spacing between two traces (left side), however large amounts of copper can be removed and thin traces can be created.

For the second setting the image below:

  • With this setting, it is possible to have small spacing between two traces, however, it is not possible to remove large amount of copper and create very thin traces.

And for the third, the image below:

  • With this setting, it is possible to make finer spacing between two traces but it’s not possible to remove plenty of copper and create very thin traces.

0.020 is obscured in the third image because we mistakenly set the cutting depth setting with a larger number than we intended. We paused the milling process to correct the mistake and then continued.

After milling is done, the milling surface and the board should be vacuumed and if necessary, the board cleaned.

Individual assignment

PCB Fabrication

For the individual assignment, I followed the instructions for ATtiny45 by Brian. I downloaded the traces and cutout (the board’s outline) PNG files and converted them to rml files. The process is described below.

First, I went to fab modules, uploaded the trace file (image (png)). It is important to ensure that when the PNG files are uploaded, they are at least 1000 dpi. After this, I selected the output format (Roland mill (rml)), selected the process (PCB traces), the machine (SRM-20), changed the output settings (x, y, z from 10 - 0), left the other default values and pressed calculate. After pressing calculate, the lower image in the figure below which is the file to be downloaded is displayed. The highlighted areas to the right of the image below are the important configurations and should be as displayed in the image.

For the cutout file, you basically repeat the same process but instead of choosing PCB traces 1/64 for the process, you choose PCB outline 1/32. This means that the outer border of the board will be cut. The important configurations are highlighted in the image below. The output is the same as for traces, but the tool diameter and number of offsets are different.

For the traces, I used 0.4 mm diameter bit and for the cutouts I used a 1 mm diameter bit. An image of the milled board is shown below.

Assembling the PCB

All the following instructions are from Brian’s website.

I collected all components and using two-sided tape, I attached them to a labeled A4 paper so that I could easily tell them apart when soldering.

For assembly, these were the components used:

  • 1x ATtiny45 or ATtiny85
  • 2x 1kΩ resistors
  • 2x 499Ω resistors
  • 2x 49Ω resistors
  • 2x 3.3v zener diodes
  • 1x red LED
  • 1x green LED
  • 1x 100nF capacitor
  • 1x 2x3 pin header

Brian’s instructions had the schematic and board image for soldering the components. With a bit of help from Arash and Mikko, a previous Fab Academy graduate and one of the local instructors, I managed to successfully solder the components to the board. To ensure the PCB had a good connection to USB ports, I added a bit more thickness to it by sticking strips of thin post-it notes to the back of the board. I will later build a casing for the board.

Below is an image of the assembled PCB and a view of the back with the strips of post-it notes.

Programming the ATtiny45

Software installation

Before you can build and program the firmware onto your board, you need to set up your development environment. I did the set up in both a Linux environment and in Mac.

For Ubuntu and other Debian-based distributions, you enter the following command to install AVRDUDE (command line program for programming Microcontrollers):

sudo apt install avrdude gcc-avr avr-libc make

For Mac, I downloaded and installed CrossPack.

Program the ATtiny45

Before starting to program, you should get and build the firmware by downloading the firmware source code, extract the zip, open the terminal and change directory into the code directory and run make. This builds the hex file that is programmed onto the ATtiny45.

Update the Makefile for the type of programmer you’re going to use to program your board if needed. As we were using the same programmer as the one defined in the file, there was no need to change anything.

Using a USB hub I connected to the Mac, plugged the board into a USB port and the red LED lit up. This is an initial test showing the board is ok.

Then, I connected the programmer to the ISP header on the board.

From the command line I ran make flash. This erases the target chip, and programs its flash memory with the contents of the .hex file built earlier.

After the flash memory was successfully programmed, I set the configuration fuses using the make fuses command. This set up all of the fuses except the one that disables the reset pin.

Next, I checked to see that the USB was working correctly by disconnecting it from the programmer and unplugging the board from the USB port. I plugged it into a PC > Device Manager (Start → Control Panel → System → Device Manager) and saw that it was working. I used a PC because the initial check on the Mac did not work. Later, the USB was recognised on my MAC so the initial problem was probably because it was not placed well into the hub’s USB slot (I use a USB hub and don’t plug the board directly into my MAC’s usb slot).

For the final step of turning the board into a programmer that can program other boards, I first changed the bit that turns the ATtiny45’s reset pin into a GPIO pin. I connected the ISP programmer to the board again, and ran make rstdisbl. This does the same thing as the make fuses command above, but includes the reset disable bit as well. After this, avrdude will never be able to talk to this chip again through the ISP header.

The image below shows these commands and their outputs.

Then, I used soldering wick to remove the solder jumper by heating the connected part in order to separate the connection. I disconnected VCC from the Vprog pin on the ISP header by removing the bridge on the solder jumper as shown in the highlighted part in the second image below.

Original Files

Click on the links to download the .rml files:

Reflection

In this week I learnt how to fabricate a PCB by using a milling machine, how to solder (this is still a work in progress) components on the PCB and how to program the ATtiny45 and turn it into a programmer.

The milling part of the work was the easier task as we were working on available files and all we needed to do was follow the instructions for converting the files to rml before milling. The week became interesting during the assembly part. I have soldered before, but it was a while ago and I never seem to get it right. I made the mistake of starting to solder on the board without at least a practice round. Luckily, when starting, Arash who is more familiar with soldering helped and gave me tips on how do solder well. It took multiple corrections, another helping hand and plenty of time to solder the components onto the board.

Apart from a minor mistake, the programming of the board went well. The LED on the board lit up when I inserted the assembled PCB on the USB port, as it should have, but when I initially tried to program the board I got the error shown below:

When I first saw this, the first thought that came to my mind was a problem with placement of the components on the board and I searched for potential solutions but didn’t find any. I slept on it and went to the lab the following morning and Jari, another of our local instructors, said that I should insert the programmer rather than the board into the USB slot of the computer. And the problem was solved! Below is an image of the programmer board being used for the Electronics design task.

Even though the task for this week was not too complicated, for someone with zero background in electronics, even reading from schematics can be a problem. Without the initial help from Arash, it is pretty likely I would have soldered the components incorrectly.