Week 4

Week 4. Electronics Production.

I have fabricated and programmed a PCB programmer during this week.

Tasks

  • Fabricate a PCB using the CNC milling machine.
  • Solder the components to create a programmer.
  • Upload the firmware of the programmer in the micro-controller.

Process explanation

Milling the PCB using the CNC machine and soldering the components.

Figure 1. Our CNC milling machine. A Roland SRM-20.

During this week the goal was to learn how to fabricate a PCB from scratch using just FabLab devices. In concrete we utilized our CNC milling machine (a Roland SRM-20) to mill the PCB in a FR-1 board. The target was to built a micro-controller programmer that will be useful for us in future weeks, when we have to upload code to our own Fabduino.

We did not have to worry about the design. It was already given to us. I started first with Brian's version of the programmer provided in Fab Academy lecture pages. From Brian's page I downloaded the .png files containing the traces and the board external cutout.

Creating the .rml files

Before working with the CNC machine I had to create three different rml files: one to cut the traces, one to cut the board itself from the FR-1 and a third one to test that the size of the board and the milling bit utilized is the appropriate one. rml format is a Roland's proprietary format for its CNC milling machines based on G-code. I utilized fabmodules to transform Brian's png files into rml files.

  • For the Test file: I selected Brian's cutout .pngfile as an input, .rml (Roland mill) as an output and PCB outline (1/32) as a process (Figure 2). Note, that my goal was to slightly mark the outline of the board and check that the size was correct. I will utilize the 1/64 milling bit to that end, although this fabmodule process is thought to be used the 1/32 bit. Hence, I changed the cut depth and stock thickness to 0.1mm while the tool diameter was set to 0.36mm. I also chose the SRM-20 as a machine. In addition, Origin x0, y0, z0 was set to 0. The rest of the parameters utilized default values (Figure 2). After pressing the Calculate button I obtained the output shown on Figure 3. Notice that the milling bit will only move once on the board. I obtained the test.rml after pressing the Save button
  • Fab modules screenshot
    Figure 1. Starting the test file using FabModules
    Fab modules screenshot
    Figure 2. Modifying the default values. I do not want to cut the board, but just mark it.
    Fab modules screenshot
    Figure 3. Fab Modules output.
  • For the Cutout file: I followed same steps as before. However, in this case I wanted to cut completely the board with the 1/32 milling bit. Hence, I utilized a cut depth of 0.5 mm and a stock thickness of 1.6 mm (the thickness of the FR-1). After pressing the calculate button, I obtained the results in Figure 4. In this case, the drill will go 4 times on the outline in order to have it cut.
  • Fab modules screenshot
    Figure 4. Output and settings of the cutout.rml file
  • For the Traces file. For this case, I changed the process to PCB traces (1/64). In this case, I utilized the default values shown after selecting SRM-20as a machine namely: cut depth: 0.1mm; tool diameter: 0.36mm(1/64 inches); Number of offsets: 4; offset-overlap :50%. After pressing the calculate button, I obtained the results in Figure 5.
  • Fab modules screenshot
    Figure 5. Output and settings of the traces.rml file

I made a quick inspection of the traces.rml files (Figure 5) to check that none of the traces connect with each other.

Milling the PCB

In the computer connected to the SRM-20 I opened the software provided by Roland to operate the machine (V-Panel for SRM-20). This application allows setting up the origin of coordinates and upload the .rml file to start the milling.

Before starting the milling it is necessary a set of preparatory steps:

  1. Check if the FR1 board is bent in any of axis: we made a visual inspection using a ruler to check if the board was bent in x, y axis as well as in the diagonals. To do that, we approach the ruler to board, moved through the axis and checked if there was any visible hole between the ruler and the board. We found that it was slightly bent. We gently bend it back the other way, with our hands, until it looked straight. The board should be as flat as possible. A small bent, might ruin the milling.
  2. Fix the FR-1 to the sacrificial board: (FIXTURING): The sacrificial board is utilized in situations when the milling bit go further than the actual thickness of the board. Without the sacrificial board the bit might break when contacting the metallic surface at the bottom of the CNC. In our case we had a wooden particle board of around 10cm as sacrificial board. To attach the FR-1 to the sacrificial board we utilized several strips of double-sided tape across the back of the board. We utilized Scotch Permanent Double-Sided Tape but it turned out not to be the best solution since it produced several bubbles difficult to remove later. After that, the board is inserted in the CNC milling machine.
  3. CNC milling machine operation
    Figure 6. FR1 board fixed to the CNC milling machine. The wood at the bottom is the sacrificial board.
  4. Change the milling bit: I had to remove the old bit an insert a 1/64 bit in the head of the CNC milling machine. You can loosen the head to extract the old bit using a hex key. With the same tool you can attach the new bit. Some recommendations: (1) do not insert the bit too much, does not need to go all through the head cavity; (2) be careful while handling the bits. They are very fragile. If they fall down, they will break quite likely.
  5. CNC milling machine operation
    Figure 7. Changing the milling bit using a hex key.
  6. Setting up the origin of coordinates:Once the correct bit was set up, we had to set the origin of coordinates. The origin of coordinates will indicate the bottom-left corner of the milling. The head, can be moved using the arrows at the center of the Roland V-Panel UI (Figure 8). The labels indicate the movement of direction. Cursor step defines the amount of movement in each axis the head perform while a button is pressed. Continuous means that the head is moving while the button is pressed, x100 will move the bit 1 mm, x10 0.1 mm and x1 0.01mm. In order to set the origin of the z-axis, move the head down till is almost touching the board. Then, loose the milling bit and gently let it fall on the board. Tighten again the milling bit using the hex key. Pressing the buttons Set Origin Point X/Y and Z (Figure 8) will record the origin point at the current position of the head.
  7. CNC milling machine operation
    Figure 8. Roland V-Panel UI.
    CNC milling machine operation
    Figure 9. Milling bit in the origin of coordinates.
  8. Mill the board: Next step is to mill the three different files. First the test part (using the 1/64 bit). After that the traces (1/64 bit). And finally, the cutout (using the 1/32 bit). To select the file to mill you must press the button Cut. In the next screen, Delete all the old files in order to avoid errors, and Add the desired one. Please, note that when changing the milling bit to mill the cutout, you need to reset the Z origin. However, you cannot touch the X/Y Origin. Final results are shown in Figure 11 (right)
  9. CNC milling machine operation
    Figure 10. Selecting the file to mill.
    CNC milling machine operation
    Figure 11. Test file after milling (left), milling the traces (center) and PCB ready (right).
  10. Remove the dust: I did it after I end milling each one of the three files.
  11. CNC milling machine operation
    Figure 12. Removing the dust using a vacuum cleaner.
  12. Extract the PCB from the FR1: First it is necessary to check visually that the piece has been cut out. After that, using a screwdriver as lever, unstick slowly the piece from the double side tape. If you apply too much force, is quite likely that you break the PCB.
  13. CNC milling machine operation
    Figure 13. Using a screwdriver to detach the PCB from the double side tape.
  14. Clean and remove defects and photo sensible layer.: Once the piece is extracted, using water and a metal sponge I removed all dust and other foreign bodies. In addition I removed the photo sensible layer at the top of the FR1
  15. CNC milling machine operation
    Figure 14. Cleaning the PCB with water.

Finally, and as Brian indicates in his instructions, I had to remove part of copper placed next to the USB plug with a sharpen knife.

Soldering the components

This was actually the most challenging part of the whole week. I have previously soldered with iron simple through-hole components. I have also soldered surface mounted components using soldering paste and a reflow oven. However, it was the the first time I use the solder iron to solder surface mounted components. Hence, and to practice a bit, before soldering the components in the final board I decided to practice a little bit utilizing surface mounted resistors and a non-functional PCB that Jari Pakarinen had in his workshop. After a few attempts I felt "brave" enough to try to solder in the real board.

I collected all components, and in order to make my life easier I attached them to a tape and labeled them in a sheet of paper (Figure 15). The necessary components according to Brian's instructions are:

  • 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

The board image is obtained from Brian's webpage:

CNC milling machine Soldering
Figure 15. Board image
Soldering
Figure 16. Board components ready to be soldered.

I used the soldering iron shown in Figure 17 and lead-free solder of xx mm. The soldering iron temperature was of 350 ¤C. However, for soldering the microcontroller I used a much thinner soldering tip.

  • Put some solder on the iron tip before each soldering.
  • Be sure to clean the tip after each soldering using a brass sponge. It facilitates the joint.
  • For soldering the component's first leg, first put some solder in the board's pad. With the help of a tweezer, put the component in the right position (being sure that the legs touch the board's pads). Without adding any extra solder, heat the tinned pad till the leg is fixed. After that solder the rest of the legs.
  • Do not put too much solder.
Soldering
Figure 17. The iron I used to solder the components.

After soldering all components I checked with the help of a microscope (Figure 18) that there were not short circuits and that the solder did not went out of the right traces. Furthermore, I checked that all the joints looked more or less good. I re-solder some joints that did not look very smooth. After that, and using a multimeter (Figure 19) I checked for continuity (that is, that there were not undesired short circuits). I paid special attention to check that the ground and power did have a short circuit and that the pin headers connected correctly with the traces. Everything looked good and I finally had my programmer board ready (Figure 20).

Soldering
Figure 18. Checking the connections using a microscope
Soldering
Figure 19. Checking for continuity using a multimeter.
Soldering
Figure 20. Final result!!!

Programming the programmer

I wanted to program the programmer. I am aware that Linux causes less conflicts when programming microcontrollers, so I decided to use Ubuntu instead of Windows to upload the firmware to my board. I utilized Jani's programmer (USBTiny) to install the software in the microcontroller. I followed carefully Brian's software installation instructions and I did not found any big difficulties:

  • Open linux command line shell
  • Install avrdude toolchain:
  • sudo apt install avrdude gcc-avr avr-libc make
  • Download the programmer's firmware source code from this link and extract the zip file. I made a copy of the firmware in the resources section
  • unzip fts_firmware_bdm_v1.zip
  • Access the root of the folder that has been previously unzipped
  • cd fts_firmware_bdm_v1
  • Build and compile the firmware. This will generate a binary (.hex) file
  • make
  • Now we need to upload the firmware to the board. We are using usbtiny, so we do not need to do any modifications in the Makefile. If it is not the case, you must change the name of the programmer with the correct one. Near the top of the file, find the line that says:
    PROGRAMMER ?= usbtiny
    and add there the correct programmer
  • Now we need to (a) power the board and (b) connect a programmer to upload the firmware to the board. We will use the computer USB port to power the board. To that end, connect the board to the USB port of the computer using an USB cable extensor. After that I connected Jani's programmer to the ISP header of the board. I checked twice that the Ground in the programmer was the same as the ISP pin in the board
  • Programming the programmer
    Figure 21. Connecting Jani's programmer to my board
  • After everything is connected is time to write the firmware in the microcontroller
  • make flash
  • Set the configuration fuses that control where the microcontroller gets its clock source from.
  • make fuses
  • Remove the programmer and the board from the computer. Insert again the board in the computer's usb port. Check that it is recognized (after executing lsusb you should read "Multiple Vendors USBtiny".
  • lsusb
  • Once everything is working blow the reset fuse, so the microcontroller cannot be reprogrammed.
  • make rstdisbl

When I tried to run the make flash to move the software to my board, I got an error: "Cannot find USBTiny". The reason was that I did not connect the programmer to my computer (so the programmer did not receive power). After I did everything, it worked OK.

Programming the programmer
Figure 22. Programming the programmer in Ubuntu.

Finally, we need to remove the solder jumper. I used solder wick for that. I placed the solder wick in the jumper and applied heat with the iron (Figure 23). Everything should be working now. I just need to check that the programmer is really working, but for that I need another microcontroller to program.

Programming the programmer
Figure 23. Removing the bridge on the solder jumper

Resources utilized

  • Roland MonoFab SRM-20 Compact Milling Machine
  • FR-1 circuit board
  • Soldering station
  • Set of electronics components in the Fab inventory

Reflection

Summary

In this week I learnt how to fabricate a PCB by using the CNC milling machine, how to solder surface mount components on it using the soldering iron and how to program the ATTiny to create a microcontroller programmer.

Main difficulties

This week it was a quite guide processes so I did not find big difficulties. The main issue has been soldering the surface mount components on the board. It took me quite a lot of time because it was the first time I did it. However, in the end, the board seems to work correctly and it has been the first produced board.

Main learnings

Learning how to solder surface mount components on a PCB board using the soldering iron. Before, I have solder through hole components. I have also understood why I need a programmer to write software on microcontrollers. Moreover, I learnt how to operate the CNC milling machine.

Models files