Week #4 Electronics Production

What I’ve done this week

  • learning how to use CNC for cutting a circuit board
  • learning how to solder surface mount parts on a circuit
  • learning how to write programs on the ATTINY45
  • creating an actual in-circuit programmer

Weekly Assignment Requirement

Group assignment
- characterize the design rules for your PCB production process

Individual assignments
- make an in-circuit programmer by milling the PCB,check if you can program it,then optionally try other PCB processes

Kamakura Group assignment

I was in charge of surfacing the sacrificial board for Roland SRM-20.

Description of Assignment Work

To make in-circuit programmer (which is a kind of writer of program to a micro controller), I chose FabTinyISP shown on the Brian’s web page.
Basically, I followed the tutorial below this week. but it was not an easy way cause I got massive amount of trouble though I just did the tutorial…
Building the FabTinyISP

cutting the PCB board

This is a sample image of what I made. I cut this PCB (stands for Printed Circuit Board) using two png files which draw the design of the board. set them to the milling machine via software. then cut it. After doing it, I would solder electronic parts on it. This time, for cutting, I could use the data already designed and uploaded on the internet.

credit

cutting data

circuit design of the board (called traces) credit


outline of the PCB credit


set these png files to the milling machine for cutting.

mods setting

to set the png files, needed to use software called mods. mods is online based application developed by MIT.
checked the tutorial of mods setting for SRM-20 here


right click on the mods page > PROGRAMS > OPEN SERVER PROGRAM > ROLAND - MILL - SMR20 - PCB png
then whole module of the program showed up.


selected the png file


chose the mill. for traces, 1/64. for outline, 1/32.


added [save file] module and connected it to SRM-20 part.
and set parameter in the SRM-20.


checked all the condition. then pressed calculate button.


3D toolpath image had been shown up. it would be used in SRM-20 in the next procedure. (outline data being processed in the same way later)

srm20 setting


used SRM-20 for the PCB cutting.


used the endmill properly. 1/32 inch’s one for outline cutting. 1/64 inch’s one for traces cutting.


set the origins of XYZ. then pressed cut button.


set the .rml file(binay file) created by mods. pressed the output button then machine started to cut.

cutting

fail 1
moved to Unexpected direction and broke its tip
Need to take more space to the z direction when moving the endmill

fail 2
Too shallow engraved trace


ok part
recut and it was ok! broken part would be repaired by solder later.

soldering

parts collection


ordered neatly to avoid mistaking the parts.

caution!

  • polarity

    LED parts have to be checked its polarity. anode on the vcc side and cathode on the gnd side. cathode usually has sign. for example zener diode used this time has engraved line on its side.

  • nano or micro

    nano(n) and micro(μ) looked similar. it made confusion…

soldering

soldered from small(short) parts first to big(tall) parts later. and also used masking tape like adhesive tape for fixing the board to the bigger underlaying board while soldering.


checking circuit conductivity





worked!

programming

preparation

installing CrossPack


get firmware

build it

$ make

.hex is created


edit the Makefile change usbtiny to avrisp2


Programming(writing program)

setting


set arrow mark on miso pin

run make flash code

$ make flash

fail
Usb error..?

avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

debugging
I heard that CrossPack seems not working on my laptop(OSX 10.14 called Mojabe) smoothly

uninstall it

$ sudo /usr/local/CrossPack-AVR/uninstall


tried Homebrew AVR Toolchain from GitHub.
Toolchain for avr programing

$ brew tap osx-cross/avr
$ brew install avr-gcc

fail again
Anton Pchelkin mentioned last year about downloading avrdude in addition to the Homebrew AVR Toolchain. I didn’t have avrdude because I uninstalled the CrossPack which included one.

install avrdude

$ brew install avrdude

avr dude is the software loading program on the attiny45.

fail again again
but type of the error was changed from

avrdude: usbdev_open(): did not find any USB device "usb"
make: *** [flash] Error 1

to

avrdude done.  Thank you.

make: *** [flash] Error 1

cut out extra coppers

just recognized the extra coppers. so tried to cut them off.


worked!

avrdude -p attiny45 -c avrisp2 -P usb -e \
        -U flash:w:fts_firmware.hex

avrdude: AVR device initialized and ready to accept instructions


Reading |                                                    | 0% 0.00s
Reading | #################                                  | 33% 0.00s
Reading | #################################                  | 66% 0.00s
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9206 (probably t45)
avrdude: erasing chip
avrdude: reading input file "fts_firmware.hex"
avrdude: input file fts_firmware.hex auto detected as Intel Hex
avrdude: writing flash (2482 bytes):


Writing |                                                    | 0% 0.00s
Writing | #                                                  | 2% 0.02s
Writing | ###                                                | 5% 0.04s
Writing | ####                                               | 7% 0.06s
Writing | #####                                              | 10% 0.09s
Writing | ######                                             | 12% 0.11s
Writing | ########                                           | 15% 0.13s
Writing | #########                                          | 17% 0.15s
Writing | ##########                                         | 20% 0.18s
Writing | ############                                       | 23% 0.20s
Writing | #############                                      | 25% 0.22s
Writing | ##############                                     | 28% 0.24s
Writing | ###############                                    | 30% 0.27s
Writing | #################                                  | 33% 0.29s
Writing | ##################                                 | 35% 0.31s
Writing | ###################                                | 38% 0.33s
Writing | #####################                              | 41% 0.35s
Writing | ######################                             | 43% 0.38s
Writing | #######################                            | 46% 0.40s
Writing | ########################                           | 48% 0.42s
Writing | ##########################                         | 51% 0.44s
Writing | ###########################                        | 53% 0.47s
Writing | ############################                       | 56% 0.49s
Writing | #############################                      | 58% 0.51s
Writing | ###############################                    | 61% 0.53s
Writing | ################################                   | 64% 0.56s
Writing | #################################                  | 66% 0.58s
Writing | ###################################                | 69% 0.60s
Writing | ####################################               | 71% 0.62s
Writing | #####################################              | 74% 0.65s
Writing | ######################################             | 76% 0.67s
Writing | ########################################           | 79% 0.69s
Writing | #########################################          | 82% 0.71s
Writing | ##########################################         | 84% 0.74s
Writing | ############################################       | 87% 0.76s
Writing | #############################################      | 89% 0.78s
Writing | ##############################################     | 92% 0.80s
Writing | ###############################################    | 94% 0.82s
Writing | #################################################  | 97% 0.85s
Writing | ################################################## | 100% 0.87s

avrdude: 2482 bytes of flash written
avrdude: verifying flash memory against fts_firmware.hex:
avrdude: load data flash data from input file fts_firmware.hex:
avrdude: input file fts_firmware.hex auto detected as Intel Hex
avrdude: input file fts_firmware.hex contains 2482 bytes
avrdude: reading on-chip flash data:


Reading |                                                    | 0% 0.00s
Reading | #                                                  | 2% 0.02s
Reading | ###                                                | 5% 0.04s
Reading | ####                                               | 7% 0.06s
Reading | #####                                              | 10% 0.08s
Reading | ######                                             | 12% 0.10s
Reading | ########                                           | 15% 0.12s
Reading | #########                                          | 17% 0.14s
Reading | ##########                                         | 20% 0.16s
Reading | ############                                       | 23% 0.18s
Reading | #############                                      | 25% 0.20s
Reading | ##############                                     | 28% 0.22s
Reading | ###############                                    | 30% 0.24s
Reading | #################                                  | 33% 0.26s
Reading | ##################                                 | 35% 0.27s
Reading | ###################                                | 38% 0.30s
Reading | #####################                              | 41% 0.32s
Reading | ######################                             | 43% 0.33s
Reading | #######################                            | 46% 0.35s
Reading | ########################                           | 48% 0.37s
Reading | ##########################                         | 51% 0.40s
Reading | ###########################                        | 53% 0.41s
Reading | ############################                       | 56% 0.43s
Reading | #############################                      | 58% 0.45s
Reading | ###############################                    | 61% 0.47s
Reading | ################################                   | 64% 0.49s
Reading | #################################                  | 66% 0.51s
Reading | ###################################                | 69% 0.53s
Reading | ####################################               | 71% 0.55s
Reading | #####################################              | 74% 0.57s
Reading | ######################################             | 76% 0.59s
Reading | ########################################           | 79% 0.61s
Reading | #########################################          | 82% 0.63s
Reading | ##########################################         | 84% 0.65s
Reading | ############################################       | 87% 0.67s
Reading | #############################################      | 89% 0.69s
Reading | ##############################################     | 92% 0.71s
Reading | ###############################################    | 94% 0.73s
Reading | #################################################  | 97% 0.75s
Reading | ################################################## | 100% 0.77s

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

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

avrdude done.  Thank you.

bash-3.2$ make flash
avrdude -p attiny45 -c avrisp2 -P usb -e \
        -U flash:w:fts_firmware.hex

avrdude: AVR device initialized and ready to accept instructions


Reading |                                                    | 0% 0.00s
Reading | #################                                  | 33% 0.00s
Reading | #################################                  | 66% 0.00s
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9206 (probably t45)
avrdude: erasing chip
avrdude: reading input file "fts_firmware.hex"
avrdude: input file fts_firmware.hex auto detected as Intel Hex
avrdude: writing flash (2482 bytes):


Writing |                                                    | 0% 0.00s
Writing | #                                                  | 2% 0.02s
Writing | ###                                                | 5% 0.04s
Writing | ####                                               | 7% 0.06s
Writing | #####                                              | 10% 0.09s
Writing | ######                                             | 12% 0.13s
Writing | ########                                           | 15% 0.17s
Writing | #########                                          | 17% 0.20s
Writing | ##########                                         | 20% 0.23s
Writing | ############                                       | 23% 0.26s
Writing | #############                                      | 25% 0.28s
Writing | ##############                                     | 28% 0.30s
Writing | ###############                                    | 30% 0.32s
Writing | #################                                  | 33% 0.34s
Writing | ##################                                 | 35% 0.37s
Writing | ###################                                | 38% 0.39s
Writing | #####################                              | 41% 0.41s
Writing | ######################                             | 43% 0.43s
Writing | #######################                            | 46% 0.46s
Writing | ########################                           | 48% 0.48s
Writing | ##########################                         | 51% 0.50s
Writing | ###########################                        | 53% 0.52s
Writing | ############################                       | 56% 0.55s
Writing | #############################                      | 58% 0.57s
Writing | ###############################                    | 61% 0.59s
Writing | ################################                   | 64% 0.61s
Writing | #################################                  | 66% 0.64s
Writing | ###################################                | 69% 0.66s
Writing | ####################################               | 71% 0.68s
Writing | #####################################              | 74% 0.70s
Writing | ######################################             | 76% 0.73s
Writing | ########################################           | 79% 0.75s
Writing | #########################################          | 82% 0.77s
Writing | ##########################################         | 84% 0.80s
Writing | ############################################       | 87% 0.82s
Writing | #############################################      | 89% 0.85s
Writing | ##############################################     | 92% 0.88s
Writing | ###############################################    | 94% 0.89s
Writing | #################################################  | 97% 0.92s
Writing | ################################################## | 100% 0.94s

avrdude: 2482 bytes of flash written
avrdude: verifying flash memory against fts_firmware.hex:
avrdude: load data flash data from input file fts_firmware.hex:
avrdude: input file fts_firmware.hex auto detected as Intel Hex
avrdude: input file fts_firmware.hex contains 2482 bytes
avrdude: reading on-chip flash data:


Reading |                                                    | 0% 0.00s
Reading | #                                                  | 2% 0.05s
Reading | ###                                                | 5% 0.06s
Reading | ####                                               | 7% 0.08s
Reading | #####                                              | 10% 0.11s
Reading | ######                                             | 12% 0.13s
Reading | ########                                           | 15% 0.15s
Reading | #########                                          | 17% 0.16s
Reading | ##########                                         | 20% 0.18s
Reading | ############                                       | 23% 0.20s
Reading | #############                                      | 25% 0.22s
Reading | ##############                                     | 28% 0.24s
Reading | ###############                                    | 30% 0.26s
Reading | #################                                  | 33% 0.31s
Reading | ##################                                 | 35% 0.33s
Reading | ###################                                | 38% 0.35s
Reading | #####################                              | 41% 0.37s
Reading | ######################                             | 43% 0.39s
Reading | #######################                            | 46% 0.41s
Reading | ########################                           | 48% 0.43s
Reading | ##########################                         | 51% 0.45s
Reading | ###########################                        | 53% 0.47s
Reading | ############################                       | 56% 0.49s
Reading | #############################                      | 58% 0.51s
Reading | ###############################                    | 61% 0.53s
Reading | ################################                   | 64% 0.54s
Reading | #################################                  | 66% 0.56s
Reading | ###################################                | 69% 0.58s
Reading | ####################################               | 71% 0.60s
Reading | #####################################              | 74% 0.62s
Reading | ######################################             | 76% 0.64s
Reading | ########################################           | 79% 0.66s
Reading | #########################################          | 82% 0.68s
Reading | ##########################################         | 84% 0.70s
Reading | ############################################       | 87% 0.72s
Reading | #############################################      | 89% 0.74s
Reading | ##############################################     | 92% 0.76s
Reading | ###############################################    | 94% 0.78s
Reading | #################################################  | 97% 0.80s
Reading | ################################################## | 100% 0.82s

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

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

avrdude done.  Thank you.

it seemed weird but one of our instructor experienced similar thing before. so the extra copper part might make wrong with connection..? anyway my PCB had been working!!

blow the Reset fuse

to make my PCB to FabTinyISP, I still had to do some procedures.

Firstly, run the following code to turn the reset pin into GPIO pin.

$ make rstdisbl

Secondly, removed solder jumper for breaking the connection partially.

Finally, I got my FabTinyISP!

USB detection

diffrent from tutorial’s order but worked!
this part should be done before doing “blow the reset fuse” phase but it hadn’t been possible.. now it’s okay


trying a sample program

I got sample program from Jun Kawahara‘s page and tried to run it by following how Kae Nagano tried last year.

downloaded file


blink_1.c

vs#include <avr/io.h>
#include <util/delay.h>
#define F_CPU 2500000

int main() {

    DDRB = 0b00000100;

    while(1) {
        PORTB = 0b00000100;
        _delay_ms(1000);
        PORTB = 0b00000000;
        _delay_ms(1000);    
    }

    return 0;
}

just blink LED program

To load the program, I run these three codes on terminal.

$ make -f blink_1.c.make
$ make -f blink_1.c.make program-usbtiny-fuses
$ make -f blink_1.c.make program-usbtiny

worked!

Description of Important Weekly Learning Outcome

Firstly, I failed setting of the endmill for SRM-20 and lost it from the first though I really took care about that. I got absolutely depressed. I cannot be too careful about it so I would take care of it more and more from now on.

And, this week’s task seemed simple so I thought that it should be done quickly. As it turned out, it actually took time because there were lots of the points where we were caught. For example PCB cutting accuracy, electronic parts choosing, quality of soldering, setting of bootloading, programing code, and so on. Many things I had to consider existed. Maybe, I would be in inevitable situation from electronics production later. So I would take much time when I have to face this topic.

FabTinyISP Traces cutting data (.rml)

FabTinyISP Outline cutting data (.rml)



Appendix

Building the FabTinyISP

MODS for PCB´S

zener diode(data sheet)

Red led(data sheet)

Green led(data sheet)

how to install avrdude

AVR tool chains download

Building the FabTinyISP

FabISP Production and programming

Sample blink program

ffmpeg -an (how to mute a video)(Japanese source)