Electronics Production
This week's project was to create an in-circuit programmer. We milled traces to create a Printed Circuit Board (PCB), soldered on components, and flashed the microcontroller firmware. Here is the final result:
The first step was to create the PCB. The typical green PCBs are made on a material called FR-4. However, FR-4 cannot be milled as it will destroy the "end mill". FR-1 can be milled, so it is suitable for short runs and rapid-prototyping using standard milling techniques.
The top layer of FR1 is a very thin coating of copper. We mill around the copper to leave only the desired traces on the board.
It took a little experimenting to get correctly mill the PCBs. I found that while the default Z-Depth for milling the traces was 0.1mm I needed to set the the depth t 0.18mm to reliably cut through the top layer of copper. Here is the completed board after milling:
Next we soldered components on to the board. See the half completed board below.
There's two steps to loading the firmware onto the board. Using the prescribed firmware (
described here),
make fuse
, and a usb connection we can compile the initial dependencies, and set configuration options on the board -- including the clock source. Then we open two jumpers on the board, and run
make program
-- flashing the fuses and the firmware. When I first ran
make fuse
the Make target compiled successfully. Then I opened the jumpers, and ran
make program
resulting in an error message:
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
The word "fuse" is used for historical reasons. Originally some configuration settings were set in microcontrollers using fuses as physical bits. Options such as setting the microcontroller clock source were set by blowing a fuse -- opening the circuit through that fuse. This way, the the bit could only be toggled once.
After some troubleshooting, we found that I had used the wrong capacitors. After running make fuse
, the microcontroller switched to using the external clock, and because the capacitors had the incorrect capacitance, and the clock no longer worked. See where we accidentally burnt the FC-1 with the heat gun while removing the erroneous capacitors.