Skip to content

Week 05. Electronics Production

This week we began to learn the electronics production. I have visited PCB plants several times and witnessed the complex process of PCB manufacturing, and yet I seldom saw in-house PCB production except once when my colleague etched a PCB board with acid etching. And now it’s time that we made a PCB on a milling machine.

This week, we also have a group assignment and an individual assignment.

  • Group Assignment:
    characterize the design rules for your PCB production process

  • Individual Assignment:
    make an in-circuit programmer by milling the PCB, program it (optionally try other PCB processes)

Group Assignment

We came to SZOIL today to work on our assignment for Week 05. First of all, we need to get familiar with the Roland milling machine. After the first trial, there was an error - the PCB was not milled well, part of it was not cut well (as shown on the picture below) because the wood under the copper was tilted (maybe due to the humid environment), so we need to replace it.


(failed PCB milling)

Since almost all the woods are in the same condition in the lab, we considered putting an acrylic board (LxWxH:200mm140mm?) as the base and then a thin plywood on top. In this way the milling dip won’t be affected by the acrylic. (If we use acrylic board as the base directly, in the process of production, the dill dip will get heated and the “melted” acrylic will be attached to the dip.)

And yet, it still did not work after a few hours of calibration. So we worked on sorting out the components needed for this week’s project. After identifying each component and check out its specific vendors from Taobao, we finalize the following list. Our local instructor will order the components and we are looking forward to continuing our electronic production - PCB milling!
(component list)

We finally got the Roland CNC working and began the process of milling our first PCB! We chose the hello.ISP.44.res.cad version and worked on milling the PCB by the following steps:

  1. download the png file of traces

  2. download the png file of interior

  3. work on the settings on FabModules

  4. For the traces, follow this procedure:
    input format => image (.png), select the traces png file => output format => Roland mill (.rml) => process => PCB traces (1/64)

  5. On the right side of the page, make the following settings (see in the following screenshot)

  6. For the outline (interior), follow this procedure:
    input format => image (.png), select the interior png file => output format => Roland mill (.rml) => process => PCB outline(1/32)

  7. On the right side of the page, make the following settings (see in the following screenshot)

Now we have the .rml files of the traces and the outline. It’s time to use the Roland CNC to mill the PCB boards.

For milling the traces, we use 0.4mm milling dip and for the outline, we use 0.8mm milling dip, see the picture below.

And when the PCB board ware first taken out from the milling machine, the edges were rough, so we used sand paper to remove the rough edges. See the contrast below.

After the PCB was fabricated, we sit together to learn about the components, what are they, where will they be soldered on the ISP board. And then we started soldering them onto the board.

It took quite a while for me to solder all those tiny little components onto the board! Even with some experience in soldering in the past years, this is a challenging task. Because the previous soldering were mainly soldering the simple components (LEDs, Battery Holder, Switch) with long pins onto badges. And this time, we have new mission - to solder tiny SMD components onto the ATtiny44 board!

Some tips that I learnt during the soldering:

  1. The blue/greenish mat that we usually used in hands-on workshop is not very useful when it comes to soldering, especially soldering tiny SMD components. My components got heated up and part of the green mat was melted & attached to the parts, making it even more difficult to solder.

  2. Since the components are very small, it will be helpful if I put a little solder on the dip of the soldering iron in advance, and when the iron dip touches the board, the solder will connect the board with the component quickly. In this way, I do not have to put the soldering dip at the soldering pad for a long time, preventing the board and components from getting burned.

After all the components were soldered onto the board, I followed this instruction to test it on my MacOs. According to the instruction, I had to solder a 0 ohm resistor to connect these two parts as shown at location A below, and use a solder bridge to connect the other part, as shown at location B below.

When the board is ready, I began working on my laptop to install the software to get ready for testing the board.

  1. Download the Crosspack AVR

  2. Install it

  3. Download XCode - I skipped this part because I already have XCode installed when doing the assignment in Week 03.

  4. Download the FabISP Firmware

  5. In the downloaded fabISP_mac.0.8.2_firmware, edit the Makefile as shown in the image below and save it.

And then I installed the Crosspack AVR, as shown in the image below, it was successfully installed.

With the Crosspack AVR sucessfully installed, I started program the FabISP.
At the terminal, type the following code:

cd Desktop/fabISP_mac.0.8.2_firmware

And then began program the FabISP

(1) Type the following code “make clean”

make clean

and then press “enter/return”, it showed the following code:

rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s

(2) Type the following code “make hex”

make hex

and then press “enter/return”, it showed the following code:

avr-gcc -Wall -Os -DF_CPU=20000000  -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny44 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=20000000  -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny44 -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=20000000  -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny44 -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-gcc -Wall -Os -DF_CPU=20000000  -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny44 -c main.c -o main.o
main.c:88:13: warning: always_inline function might not be inlinable [-Wattributes]
 static void delay ( void )
             ^
avr-gcc -Wall -Os -DF_CPU=20000000  -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny44 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size main.hex
   text    data     bss     dec     hex filename
      0    2002       0    2002     7d2 main.hex

(3) Type the following code “make fuse”

make fuse

and press “enter/return”, it showed the following code:

avrdude -c usbtiny -p attiny44  -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9207
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK (H:FF, E:DF, L:FF)

avrdude done.  Thank you.

(4) Type

make program

and press “enter/return”, it showed the following code:

avrdude -c usbtiny -p attiny44  -U flash:w:main.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9207
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: writing flash (2002 bytes):

Writing | ################################################## | 100% 2.60s

avrdude: 2002 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex contains 2002 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.55s

avrdude: verifying ...
avrdude: 2002 bytes of flash verified

avrdude: safemode: Fuses OK (H:FF, E:DF, L:FF)

avrdude done.  Thank you.

avrdude -c usbtiny -p attiny44  -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9207
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK (H:FF, E:DF, L:FF)

avrdude done.  Thank you.


Hooray! It worked. I am so happy that it worked with one go. I was quite worried that it did not work and I’ll have to go through a lengthy debug process to find out the reason and redo the whole process!

Now it’s time to verify that my ISP is working correctly. I removed the 0 ohm resistor and the solder bridge in part A & B (as mentioned above) and connect the ISP with my MacBook Air with the cable through the USB port.

Following the following path:

  • About this Mac => System Report => USB

to see whether I could find FabISP listed there. However, it was not! And I brought the board from SZOIL back to our office at Chaihuo x.factory and find another time to figure out the source of the problem.

However, when I took out the ISP and tried to reconnect it with my laptop, I noticed that 2x03 header has fallen apart from the ISP. :( I will need to remake another ISP. Will update when there is progress!

I milled a new FabISP. Please see the picture below. (The one one the left is the broken FabISP, and the one on the right is the new one to be soldered.)

And then I soldered the components onto the board, now I have a new FabISP at hand.

However, there was an error in the process of programming the board. It went well with “make clean”, and “make hex”, but the following error popped up when “make fuse”.

avrdude -c usbtiny -p attiny44  -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

make: *** [fuse] Error 1
VioletdeMacBook-Air-2776:fabISP_mac.0.8.2_firmware violet$ make program
avrdude -c usbtiny -p attiny44  -U flash:w:main.hex:i

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

make: *** [flash] Error 1
VioletdeMacBook-Air-2776:fabISP_mac.0.8.2_firmware violet$

I tried to replaced the board with a new ATtiny44, still not working. When I used the oscilloscope to check the board, it shows the resonator shows “15mhz” instead of “20mhz”. So I decided to order new resonators and replace it.


(testing result on oscilloscope)

With the new resonator arrived. I replaced the board with a new 20mhz resonator. Besides, my colleague Song Zhao at Seeed suggested that I added two 15pf capacitors to the resonator. What’s more, one line on the corner of the board is broken, so I added some iron to connect it. see the image below.


(broken line fixed)

So here is the updated version, with new resonator, two 15pf capacitors and a fixed line.


(new FabISP)

I tried to use the same method I used previously to program the FabISP. But the error still occurred. So I think about switching to a different computer and have a look.

I used my colleague’s windows desktop to program the FabISP. I used Atmel ICE as the programmer.


(Atmel ICE)

And I copied the main.hex file from the “fabISP_mac.0.8.2_firmware” folder into this desktop for making fuse & program.


(copy this main.hex file into the desktop)

Now it worked!

I connected the FabISP onto my MacBook with a mini-USB, following this path “About this Mac => System Report => USB”, now I can see FabISP listed here. Horray!!


(FabISP is recognized on MacBook)

And then I removed the two 0Ω resistors (as shown in the two circles below). In this way, FabISP can be used as a programmer.

And then I tested whether the FabISP can be used as a programmer.

I connected my light sensor (from Input Device week) with the FabISP and connected to my MacBook, and then made settings on Arduino IDE for the board, processor, clock, and upload the following code.

#include "SoftwareSerial.h"

const int analogInPin = PB3;  
int sensorValue = 0;        
int outputValue = 0;       

const int Rx = 1;
const int Tx = 2;
SoftwareSerial mySerial(Rx, Tx);

void setup() {
  pinMode(PB3, INPUT);
  pinMode(Rx, INPUT);
  pinMode(Tx, OUTPUT);
  mySerial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  outputValue = map(sensorValue, 0, 1023, 0, 255);
  mySerial.println(outputValue);

  delay(1000);
}


(connection between FabISP, Light Sensor & MacBook)

Click “upload”, and after seconds, it should “done uploading”.

Now I have a working ISP!!!

And here is the video showing the connection.