Week 4 Assignment - Electronics production

Goals

Assignments

Bonus goal

Extra goal from my instructor (Ohad)

Results

Here is my finished board.


My tutorial for using the FabISP to program the Hello Echo board

Update: It served me well all the way thought Fab academy, I did all my programming through it. :)

Making the FabISP

Fabricating the circuit board

Hardware

CNC mill and stock

Verket Fab lab where I am taking the fab academy is equipped with a SaleCNC.com CNC router and a windows laptop running the Mach3 CNC control software. It has recently been equipped with a home made vaccum-cleaner powered vaccum table which we will use to mount our FR1 circuit board stock to.


Software

Previous experiment used as starting point

During week2 we had a visit in the lab from our local instructor Jens Dyvik from Fellesverkstedet Fab Lab in Oslo. He helped us test-mill the PCB for the hello.ISP.44 version of the FabISP to verify that the machine was capable enought to do it. I now used the file from that experiment as a starting point for learning RhinoCam which is a milling path generator for the 3D modeling program Rhinoceros.

Getting the board layout into RhinoCam

I choose to also use the hello.ISP.44 layout from the 2017 class archive for my FabISP to be able to improve on the previous milling experiment.

I imported the hello.isp.44.traces.png (show below, right click to save) into Inscape and used the trace bitmap command to generate a vector image which I exported as hello.isp.44.traces.pdf for import into RhinoCam.

Generating the milling paths

Below you see both the milling paths in RhinoCAM and the milled card from the previous experiment.

The amount of settings for even such a basic job is quite daunting and I will not cover all of them here. Here are the basic settings used in the program during the experiment. I used them as my starting point.

Starting settings used

2 1/2 axis pocket - PCB path milling

2 1/2 axis cut - To cut the card out of the stock

Updated circuit board milling settings

2 1/2 axis pocket - PCB path milling

2 1/2 axis cut - To cut the card out of the stock

The lab already had a post processor calibrated so that RhinoCAM could generate the correct g-code that Mach3 will use to control the machine. Anyway I double checked that the start and end of the code looked the same as a reference file on the Mach3 laptop before running the file.

Milling my own board

Mounting the stock

To mill the circuit I placed a piece of FR1 PCB stock on the vaccum table and sealed the rest of the table with plasic bags to ensure a good vaccum on the board. During the milling I kept tesing the the vaccum-cleaner exhaust air temperature with my hand to make sure that it didn't overheat from the reduced airflow.

Calibrating the machine origin

I inserted the correct milling bit and manually drove the tip to the center of where I wanted to mill the card. I then placed a paper on the stock and carefully tapped the Z-down button until the bit hit the top of the paper. I then overrode the X, Y values manually in the Mach3 interface so that I saw that the preview was aligned with the center of the card at X40 and Y50. I then set the current Z height to be Z0.1mm to compensate for the paper I used. Next time I'll try the trick of adjusting the Z by sliding the milling bit out of the collet instead, but I think it might be more tricky with this big collet.


Milling the traces

I started the milling program and saw that I was too high in Z.


So I adjusted Z again by stopping the milling and overriding the Z value in 0.1 mm increments untill the card machined generally fine. However there were some areas that just didn't want to get milled, it didn't seem to matter that I ran over them with several passes, each 0,1 mm deeper than the last one. The problem only appeared in the open areas, never right next to a copper trace.


Finally when I tried a 0.3 mm deep pass I got the mill to clear the stubborn areas.


Cutting it out

Then I could run my cut out file to release the milled cricuit board from the stock.


Cleanup

I finished by scraping the card (didn't seem to be much irregularites but it also didn't seem to hurt) and washing it.


Stuffing the board

Locating and placing components

First I located all the component bags needed to "stuff" (add the electronics components to) the board using this image from the lecture notes. It helped knowing that R means resistor, C capacitor, that Mhz indicates an occilator and that diodes have a direction! (Positive Anode Negative Cathode = the PANC rule. The arrow points from + to -, that is from A to C and that means the tiny line on the diode shall be towards the Cathode.)


Soldering technique

I prepared one or two components at a time to avoid loosing or confusing them. I attached them by first adding some solder to one pad, and then lowering in the component with tweeezers while heating the "puddle" of solder. It was a nice technique!


Fabricating missing header

We didn't have any surface mounted 6 pin headers so I made my own by bending two 3-pin pieces of right angle male header strip into shape.


Finding and fixing problems

I added componentes and tested them as a went with a multimeter. When I added the header I noticed a short circuit between the VCC header and Ground. It turned out to be a milling error, see pics:


I broke the connection with a knife and remeasured to verify that the short circut was gone.


Finishing the board

For the IC and the header I first added to much solder, binding several legs together. But I used a soldering wick to suck up the extra solder and that left a really nice and clean result. That worked so well that I'll consider doing it intentionally the next time around.

This is the finished board (which I forgot to clean).


Fixing the milling paths and root cause analysis

I opened files in RhinoCAD and found why the path wasn't milled correctly.




Here is the fixed Mach3 file.
TODO: add rhinocam1 file

I wanted to know why the file had a too tight gap in the first place so I reopened the original .PNG file in Inkscape and measured the gap. Turns out that it depends on which side of the blurred edge you measure the gap. Inside the start of the blur it is 0.38 mm and outside it is 0.42 mm TODO ADD FIXED HELLO 44 trace


Programming the new FabISP


My FabISP version hello.isp.44 being programmed by an Arduino UNO

Step by step instruction

This is an instruction for programming the FabISP version hello.isp.44 using a Arduino UNO a Windows 10 computer and the AVRDude software.
  1. Program the Ardino UNO with this sketch. (It is modified according to the ArduinoISP instructions.
  2. After(!) programming the arduino, connect a 10 uF capacitor between RESET and GND. (Read why here)
  3. Connect your FabISP to the Arduino.

  4. Backup your PATH environment (Reason: AVRdude installer is from 2010 and apparently sometimes overwrites it instead of updating it on modern windows versions.) (UPDATE! If this sounds scary the ARV Toolchain might be an alternative.). HowTo:
    1. Start the Windows registry editor (Windows key + "Regedit")
    2. In Regedit: Navigate to this folder HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    3. Right click to Modify the Path line and copy the contents to a notepad document.
  5. Download and install AVRDude
  6. Open RegEdit again and compare your notepad copy to what the Path line now lists:
    1. If the WinAVR folders were added to the list, do nothing.
    2. If your previous entries are missing. Add them back after the WinAVR entries, separate the entries with a semicolon.
  7. Download the FabISP firmware. We will use this to build a program that we will run on our FabISP.
    1. Unzip the firmware file and open the file called "Makefile" in Wordpad (it looks OK in landscape mode, or use your favourite text editor like Bracket or Notepad++)
    2. Now we need to write into it which COM-port your Arduino connects to your PC. Connect the Arduino and open the Arduino software. Find it here:
    3. Replace this line AVRDUDE = avrdude -c avrisp2 -P usb -p $(DEVICE) # edit this line for your programmer with this line AVRDUDE = avrdude -c stk500v1 -b19200 -P COM3 -p $(DEVICE) And edit the COM3 so that it matches the number on your COM port.

  8. Now open the console (windows key and typ cmd)
  9. Navigate to where you unzipped the Firmware and edited the Makefile.
  10. Follow this instruction with one exception. If you get an error when you type "make clean" just proceed with the next command.
  11. DONE!
  12. You can now remove the solder jumper to prevent further programming of the board.
  13. I reccomend leaving the 0 Ohm jumper on so that you can power the boards that you will program thtrought the FabISP, if you choose to remove it, they need separate power.

Program a hello echo board using your new FabISP

Why use an Arduino as ISP?

In order to use the FabISP it needs to be programmed. At the time of doing this exercise there was no dedicated In-sytem programmer (ISP) available in the lab. This is a typical chicken and egg problem since if I can get my FabISP programmed it will be a dedicated ISP in itself and can be used to program us any number of new ISPs...

However I had access to plenty of arduinos and they easily can be programmed via USB. The reason you can can program an arduino without an external programmer is that they comes with a preinstalled bootloader.

Programing the Arduino for the job

There is an official sketch (arduino program) for using the arduino as an ISP, it comes with the arduino installer as one of their File->Examples and is called ArduinoISP.

It's intended use is to use one arduino to reprogram other broked arduinos or make new ones from components. However we want to use it to pass along our own code, the FabISP firmware to our card. This is why the official instructions are only useful until step 5. After that you have to pice together your own tutorial from many different sources, that is why I wrote this one.

Avoiding triggering the arduino bootloader

After we have uploaded the modified ArudinoISP sketch to our arduinio we had to add a 10 uF capacitor between reset and ground. Like this:


This has to do with the special way we will be using the arduino after we programmed it with the ArduinoISP sketch. Now we want to send code through it, not reprogram it. If we leave out the capacitor the arduino will interpret us sending code to it as an attempting to reprogram it and do an automatic reset, sending the code that we inteded for our FabISP to the arduino bootloader instead. If we include the capacitor, it absorbs the reset pulse and lets us send the code through the arduino to the FabISP card being programmed instead. Source

What is a bootloader?

"The bootloader is basically a .hex file that runs when you turn on the board. It is very similar to the BIOS that runs on your PC. It does two things. First, it looks around to see if the computer is trying to program it. If it is, it grabs the program from the computer and uploads it into the ICs memory (in a specific location so as not to overwrite the bootloader). That is why when you try to upload code, the Arduino IDE resets the chip. This basically turns the IC off and back on again so the bootloader can start running again. If the computer isn’t trying to upload code, it tells the chip to run the code that’s already stored in memory. Once it locates and runs your program, the Arduino continuously loops through the program and does so as long as the board has power."

My emphasis Quote Source

(Arduino IDE = Arduino Integrated Development Environment or Arduino Software.)

TODO add comprehensive workflow guide and a guide to what is what and why is it there, especially about the jumpers.