5. Electronics production

Assignment

  • Characterize the design rules for your PCB production process
  • Make an in-circuit programmer by milling the PCB,
  • Program it, then optionally try other PCB processes

Prof. Farnsworth

Good news everyone !

I made an improved version of Brian’s design of the FabISP, and it’s close to perfection !

EAGLE designed PCB

The two main improvements are :

  • The orientation of the ISP connector, it now can be connected in-line (see this picture as example)
  • It uses one less resistor

As I want to use a flat end mill and the smaller one I have is 0.3mm, I used a clearance of 16mils as design rule.

EAGLE Files

Board and schematic are archived in FabISP_45.zip.

Engraving the FabISP

The Bantam Tool software can import EAGLE .brd files directly, but I prefer to use the pcb-gcode plugin because it’s more efficient at rendering fine details. But I wanted curved corners for the cutout and pcb-gcode did not exported it (only straight lines) so I used the eagle file, where the Milling layer come into Holes section. Here you can see the addition of the two jobs :

Milling job

USB issue

When I connect the milling machine to my computer, it starts to interfere with my cursor position. Like if I connected a crazy USB mouse.

USB issue

Thanks to Nicolas, I found out that it was an electrical problem with my laptop touchpad. I will try to make an USB isolator but for now, it works well with an external USB mouse (and the touchpad disabled).

I did not noticed that thermal pads were absent.

And there was some copper left betweens traces :

Milling result

So I removed the excess of copper with a scalpel :

Manual cutting

After a little sanding with fine grit (600 or +), the board is ready for soldering :

In the PCB holder

Components

Bill of material

LED’s

Both LED’s have a visible identification of the cathode (-) :

LED's identification Green LED Red LED

Zener diode

Zener diode

Zener cathode

Soldering

I tried to spread tin along ATtiny pads but this was not a good idea, FR-1 is fragile and I lifted a track :

Better fix this...

It was not really a problem as I stopped before the track broke. Here is the board, populated with components :

Populated board

Testing with Arduino IDE

Before uploading the FabISP firmware, I wanted to try to make it blink using Arduino IDE. To do it you have to add ATtiny µcontrollers to Arduino IDE boards, like explained in this tutorial. You also need to specify the programmer. I used a USBtinyISP, directly plugged on my FabISP :

Programmer's programming

I uploaded this code :

#define LED PB2

void setup() {
    pinMode(LED, OUTPUT);
}

void loop() {
    digitalWrite(LED, HIGH);
    delay(500);
    digitalWrite(LED, LOW);
    delay(500);
}

Upload Using Programmer

In Arduino IDE, you can do the usual Upload or use Upload Using Programmer. With the old Arduino (version 1.5), a simple Upload (V button) worked. But with Arduino version 1.8, you must use SketchUpload Using Programmer to achieve programming with a USBtinyISP.

LED blink

I specified an internal clock frequency of 16.5 MHz (like in the FabISP firmware) in board.txt but it looked like the ATtiny did not received this information because it blinked two times slower than expected. I guess that default frequency of ATtiny45 internal clock is 8 MHz.

Upload Using Programmer

Maybe that the option Upload Using Programmer could have solved this problem. Now I want to try but I can’t because I already blown the reset fuse :(

Burn bootloader

I found out that using Upload Using Programmer does not update the clock frequency, the only way to do it in Arduino IDE is Sketch → Burn bootloader

Flashing firmware with WinAVR

I first downloaded WinAVR from Sourceforge. Then lauched the install. When you get a list of options, make sure that Add Directories to PATH is selected.

The third option installs another IDE named Programmers Notepad. It is not necessary but I wanted to take a look at it.

WinAVR setup

You also need to download and extract the firmware for FabISP.

Then I tried to follow this tutorial but many of the command lines did not work (because I downloaded a different firmware). The only help I got from it was about editing the Makefile.

So I replaced AVRDUDE = avrdude with AVRDUDE = avrdude -c usbtiny -p $(DEVICE) and it did not worked, because -p was already included in $(DEVICE).

It worked with AVRDUDE = avrdude -c usbtiny $(DEVICE)

Makefile edition

Firmware version

If you downloaded the fabISP firmware version 0.8.2, you won’t need to change this line. But you may have to change F_CPU

As you just saved the Makefile, look at the comments at the beginning. It explains the commands to flash the firmware. Open the command prompt, use cd to go into the firmware directory, and type these commands :

  • make clean removes all autogenerated files.
  • make builds the .hex file.
  • make flash uses the programmer to load it onto the target chip.
  • make fuses programs the fuse bits on the target chip.
  • make rstdisbl blows the reset fuse.

Then unplug your FabISP off the programmer and plug it directly to your computer’s USB port. If it clearly says that the device is not working, something is wrong. If it’s not identified, download and istall the driver for USBtinyISP.

If nothing happens, you FabISP may have been recognized instantly.

You can check it looking into the Device manager :

USBtiny driver

Testing the FabISP with Arduino IDE

Programming an Arduino

If your connection is correct, the power LED of your Arduino should be on.

  • Open a sketch, for example Blink
  • Select ToolsBoard → your board (I used Arduino Uno)
  • Select ToolsProgrammer → your programmer (I used USBtinyISP)
  • Select SketchUpload Using Programmer

It worked at the first attempt but…

If you want to upload a sketch a second time, you may need to disconnect and reconnect USB before.

Other PCB process

I wanted to to chemical etching by drawing the traces on copper with our vinyl plotter. I was complicated because the software is only generating the contours :

Drawing on copper

So I decided to use a photosensitive board and cut the isolation in the protecting sheet, instead of printing a transparent stencil.

I tried to do it with a lasercutter but it was inefficient because the protecting sheet is made of a plastic that melts baldy. So I had to cut it with our vinyl plotter :

Stencil cuts

The complete etching process can be read on it’s dedicated page.