pcb making

This simple circuit tests a 32bit AVR microcontroller for the oophone
project, and this is how I made it (with a bit of help from my friends). It's
quite simple, so it makes for a good example to show how I make a real circuit
board from scratch in my hacker space.
It also turned out to be a good example of what usually goes wrong and what I
do about it ;)
The schematic and PCB (Printed Circuit Board) designs are done in KiCad:

From KiCad, I "plot" the layout to an SVG (or PostScript) file, and import to
Inkscape. With Inkscape I add some writing and/or images and carefully place
some markers that will later on help me align the two printed out sheets for
the front and back side.

I should clarify: above schematic contains two crystals, the 32 kHz one and the
20 MHz one. Only the 32 kHz crystal is included in the board layout. But only
the 20 MHz one is needed for using the DFU programming method. The 32 kHz
(actually 32768 Hz) one is very good for keeping an accurate real time at low
power consumption, kind of out of place on a simple dongle like this. 
Below plots also lack the 20 MHz crystal, so these plots DO NOT WORK for DFU

Each layer is printed mirrored!

When the toner gets transferred to the copper, it has to go face down, so its
mirror image will be cast to the copper. By printing out the mirror image in
the first place, I get the straight unflipped image once the toner is

Both the front and back copper layers must be printed mirrored. KiCad will
usually plot the "Back" side mirrored and the "Front" side unmirrored. The
easiest way to make sure I have both mirrored in Inkscape is to add some
writing to both copper layers within KiCad. If all the writing is mirrored in
Inkscape, I'm ready to print.

With a PDF I go to the copy and printing shop around the corner. (I used to
use my own Lexmark laser printer, but the large xeroxes are just so much more
precise and reliable.) I don't print on normal paper, but on silicone paper.
This is 100 times superior to glossy catalogue paper because once the toner is
transferred to the copper, the silicone paper just peels off like a sticker.
Here is the second nice thing about silicone paper: it's a waste material!

Any shop that offers sticker ads and banners; when they design, say, a huge
writing to go on someone's shopping window, they use a plotter to cut the
letters from a large sheet of sticker. When they take off the sticker to place
it on their customer's window pane, the silicone paper is what remains:
silicone paper was merely the carrier for their sticker sheet. So if they're
any nice at all, any shop offering cut stickers will promptly hand out a huge
sheet of silicone paper, straight from their litter bin. Hopefully it's still
pretty flat, but if it's too crumpled it can be ironed to a degree. From the
large scrap pieces, I cut out standard paper sheet sizes (my shop likes DIN A4
or DIN A5).

The print shop staff knew which paper setting to use in their Xerox to avoid
paper jams. The setting that worked for us was "Gestrichen I", no idea what
that is in English. Anything that is suitable for coated paper or transparent
sheets should do.

Because errors happen a lot during ironing, I print out three or four replicas
of the circuit. With my mirror-flipped printouts on the silicone sheets, I
merrily walk home whistling a soft tune.

Transferring the Toner

Turns out that laser printer toner is a polymer, so it's basically plastic, and it resists etchant. So the idea is to melt the toner and stick it to a copper board. Where there is toner, the copper is protected, and where there's no toner, copper will be etched away. I let my standard clothing iron preheat to a setting "just below linen". I cut out the individual sides of the printout. Using a glass pane with a lamp beneath it (a cellphone should do), I perfectly align the two prints face-to-face with the clear copper board in the middle. The toner needs to be face down on the copper, and if your Inkscape layout was perfect, the printed markers of the two board sides should align perfectly. When alignment is accurate, I place the copper-board-wrapped-in-printout on a heat insensitive surface (it really helps to fixate the copper board in the printouts so moving it around does not mess up the alignment) and start ironing. Ironing: success depends on technique and timing. The first time around for this circuit, the paper slipped around and off, leaving me with half a print on the copper and the rest still on the silicone paper: I rubbed off the toner from the copper with acetone and started over with the next printout. I found it a good idea to leave the two sides on the same sheet of paper, and fold the paper so that the markers align. It adds stability. Placing two-sided stickers between the folded silicon paper also helps. When ironing, I start pressing the flat iron down over the whole print for a few seconds as hard as the iron handle seems to take. Doing this too long will result in smudged tracks and pads, as the toner starts flowing when it melts too much. Just five to ten seconds I guess. Then I tip the iron "backwards" and scrape the flat back edge over the print, with pressure. Careful not to rip the paper or change alignment. It's good to clamp things down as long as that doesn't obstruct ironing. Finally I use the pointy tip of the iron to individually stroke details like writing or pads, to taste. Then I turn it around and do the other side. I noticed that it helps to place the board on a heat-conducting material, like an iron sheet. My theory is that the copper board must be colder than the iron for the method to work: the iron heats the toner to melting point, it gets
pressed onto and cooled down by the copper, and hence sticks to that instead of the silicone paper. I may even be right about this, but not sure. So doing the two sides once does not take very long, because when the entire board gets very hot, I stop and wait for it to cool down anyway. I usually wait a minute and do the two sides again; and then another minute and iron both sides a third time. Finally, I carefully peel off the silicone like it was a precious collector's stamp. This is the most exciting moment: has everything transferred? There can be huge holes and rifts at first. So when peeling off the silicone, I only peel half of it, making sure that I can place it back down exactly where it was and iron over any patches of toner that got too little pressure, too little heat or were just too plain lazy to transfer their asses over. Repeat until satisfied. Small holes, rifts or smudges in the toner on the copper don't matter much. When there's too much toner, I scrape some away, and when there's too little, I take my "permanent" / "CD" pen and draw over the perforations: Note that the three small round holes in the ground plane on the right side are not errors, but drill markers for vias that will later connect both ground planes of the opposite sides. Let's take another close look before etching: Note that the writing is now unflipped and unmirrored. The TQFP100 footprint for the µC, that large squared fence in the image above, has a pin pitch of 0.5 mm (each pin is .25mm wide and has .25mm spacing to its neighbors) -- that's about as small as you can go with the toner transfer method. Any smaller and the physical errors will be numerous. Even the xerox printer had trouble with pads this small. The pattern of the pads combined with the printer's resolution grid produced a little Moiré pattern: periodically the pads get a bit wider and narrower. I had to make the pads and tracks in KiCad a bit narrower to counter this effect, as it caused some pads to bleed into each other. Anything above 0.3mm usually has no such problems.

Ready for etching?

I use NaPS, sodium-persulfate, for etching. It's a crystal powder solved in water. This stuff is not healthy. It is poisonous and can cause allergies, I'm told. That's why I try to protect myself as good as I can. I open the windows wide and try not to inhale any fumes, let alone dust clouds of the etching crystal, best poured directly into water. I have a plastic box in a plastic box in a third plastic box to do the etching in, because I am too messy I guess. The second etching box has a heating foil stuck to its bottom, because the NaPS prefers to work at 40 to 50 °C. The cable coming from the right is connected to a heat sensor, which in turn is connected to a self-built thermostat that switches off the heating foil when things get too warm. Besides the occasional turning over, I keep my boxes inside boxes closed, so that evaporating fumes tend to condensate back down. The heating foil also has the job of getting a mild convection going inside the box. I have little peas of heat glue stuck all over the bottom on the inside of the inner box: this way the board never lies flat on the bottom and the etching solution can flow around under it. To get the heat over the tiny gap between the two inner boxes, I keep a puddle of distilled water in the second box -- if there was even a thin bit of air between the boxes instead, the heat would be sealed off from the innermost box pretty efficiently. With a bit of water instead, the etchant inside the innermost box also gets some of the heat. When I put the board into the etchant I get nice bubbles pretty much instantly. That means the heat is right, the solution is not saturated yet, and the board will be done soon. Nevertheless, it's a good idea to turn and swish the board around in the etchant every now and then. Occasionally I notice a blue cloud of dissolved copper dispersing away. While the board etches, let me elaborate a bit: One of the reasons to have a ground plane filling most of the copper surface is to cover as much copper as possible: this will preserve etchant. (The most important reason for ground planes still is to help prevent noise in the curcuit.) To preserve etchant, I also sawed off most of the part that had no circuit on it, before tossing it in there. I usually also take away much more of the toner-less borders, but this board was a bit too small to handle delicately with a saw. It would have been good to cut the sides to size before ironing. After ironing, the toner may get hurt easily. In above images, you may see a glass bottle with blue liquid. That is saturated etchant. Strictly speaking, it could probably still etch a dozen boards given the right temperature, but etching gets slower and slower. So some parts may already under-etch and lift off bits of toner while others haven't even started to show holes. As NaPS is very cheap, I tend to make a new solution frequently. Note that the toxic bit is really the copper dissolved in the solution, so AFAIK it doesn't really matter environmentally to use more crystal. My understanding: as soon as the acid is neutralized, there is no environmental hazard besides the copper solution. Do Not Pour Etchant In The Sink, Not In The Toilet, Not In The Gutter, Not Anywhere Outside. If you do you may kill things. Or your local water plant may have trouble to deal with the toxic etchant. And if they find out their carefully balanced Ph has tipped because of you, it will get very expensive indeed. The proper place to get rid of etchant is the special waste collection centers. I can dispose of up to 2 litres of etchant for free there, so that's what I do. IMPORTANT: NaPS solution gasses out. In other words, it expands. If you place it in a glass bottle and tightly screw it shut, like I did once when I was a teenager, you may experience what I did: in the middle of the night, a loud BANG startled me. I thought I had dreamed, turned around and slept on. In the morning I saw the etchant was sprayed all over my room and down my cupboard, and I still have those brown markings on the wood today. Luckily the bottle exploded away from my bed and didn't pour all over my face. So, you should keep it in a glass or PET bottle (not metal!), and you should keep the lid slightly untight so that any gas can escape the bottle without exploding it. After a while of swishing and turning, the copper starts to get holes. Also the etchant starts getting a blue tint (this was a fresh batch). And two minutes after that, the etching is done beautifully, no more copper is visible: To be able to solder the copper without fumigating myself, I take away the toner with a bit of acetone and a scrap cloth. Note: paper tissues or mostly anything besides a bit of cloth do not work anything like a bit of cloth. For a long time I wondered if acetone is too weak for the job, but it was the paper wipes that made it difficult. With a beautifully clean board, I saw out the contours as needed. Here I just need the USB pads really. Some heavy duty sanding paper is capable of taking away the last half millimetres of PCB, to make the thing fit. Product placement in the background: my Nager IT mouse. Those guys are building and selling a computer mouse that is as fair as possible. I can recommend it!


Time to drill the vias. Vias connect both sides of the board together. If everything went well, the drill markers on the two sides of the etched board are exactly on top of each other. So I drill straight through, with my huge household drilling machine fitted with a tiny 0.8mm drill, works quite nicely in fact: This is another exciting moment: it's when I see whether the two sides are aligned properly. This is also why I use pretty huge via pads of 1.5 mm diameter. Looking on the bottom side, I see most of the drill holes are off center, a bit more so than I had hoped for. I should have taken via pads of 2mm diameter! In a factory produced board, the drilling holes are chemically lined with conducting metal, so that each drilled hole is electrically connected through to both sides. In my DIY method, I don't have that. I often stuck bits of wire about 2mm long through the holes and soldered them to both sides. Currently I'm experimenting with this self-adhesive copper foil I bought out of curiosity. I cut it into a tiny wedge, place it through the hole and stick it flat to the pad on either side. During soldering, the drill holes that are too near the edge of the pad are a real pain. The solder should nicely wrap around the wire (copper foil) and connect to the pad all around. On this board, some pads don't do that and look a bit ugly. I tried too hard to make the solder go all around, so I take away some excess solder and some wrong bridges I made with a bit of de-soldering wick. Don't buy stupid de-soldering wick (in .de, not from C*nrad, rather from Segor), because having proper wick is such a joy. Now I look at all connections and test them. Does anything seem to be too close together? If the test shows electrical connection where there should not be any, I take a soldering iron or a carpet knife and separate things. Does a track seem too narrow or broken? If it is not connected where it should, I spread a layer of solder over it. Possibly just a wipe with a used, soaked de-soldering wick may suffice. No problems here, I am amazed that all connections are perfect.

Placing parts

I apply the lead-free soldering paste to pads as needed. Older solder used to contain lead, but that is considered a health hazard now. I like to buy lead free solder. Its melting point is quite a lot higher (~350°C instead of ~250°C) but it's smug to be lead free. Some people apply soldering paste all over their copper layers. I only place a speck of paste on each pad. Slightly heating up the syringe and/or the copper pads helps to make it flow onto the pads. The µC pads are just tooo tiny to apply paste to individually. So I just smudge all over them. Here most legs are not used at all, so I don't even bother with those. Paste placed, I stick the parts on top, consulting with the layout on KiCad to figure out what goes where and which way around. The paste is sticky when cold, so the parts stay stuck for now.

Reflow soldering

Now something needs to heat up the whole thing to > 350 °C. Some people have a kiln, I just have my stock heat gun. Heating each pad individually with a soldering iron also works, of course. I adjust my heat gun a bit hotter than needed as the air exiting the gun cools down rapidly. With the fan set to lowest speed I can also adjust the heat by the distance I stay away from the board. The distance between heat gun nozzle and board is usually 10cm or less, but probably not below 5cm since the parts will start blowing off of their pads by then. It makes sense to first gently preheat the board for even spread of heat in the hot phase. I circle the gun around the board, always pointing inwards towards it. After one or two good dozen seconds I step up the heat (gun set to 450°C is probably 250°C on the board), and about five seconds after that I give it the full blast (550°C on the gun with me adjusting the distance goes just above melting point of the soldering paste). I keep at it until all the pads have silvered over. If the paste doesn't want to turn silver in some places, I stay a bit longer around specific spots. Heating too much may damage parts though, so I am eager to stop heating as soon as possible. When the pads have glossed over, I take the gun away. (In practice, I have seen several un- and resolderings of the same chip without destroying it, so I'm not really that scared of damaging things other than plastic plugs; oh, and smaller copper pads tend to come off after the second or third heat up.) When the soldering paste heats up, it is still kind of sticky, but it gets very slippery, almost like Terminator 2 dissolving. The parts start swimming around on it. If the pads are designed well, the parts will just magically soak to their precise places (due to surface tension forces). If not, well, I help it with my tweezer. I should mention that the four components on the back side can't be soldered with hot air, because the parts already soldered to the other side would fall off.

Final fixes

There will be a couple of unwanted solder bridges between the chip's pins. Soldering wick solves that in a breeze. It magically takes away all the solder from the gaps, while leaving it everywhere the pin touches its proper pad. You may notice that I placed 43 Ohm resistors instead of 39 Ohm as
specified. I had the 43 Ohm ones lying around, and they work just as
well AFAICT.

Time to test electrical characteristics again. Is the resistance between the power supply pins large enough? If it is too low there may be a short somewhere. This circuit has dozens of kilo-Ohms and will pull a tiny current, safe to go. But first I test most connections that I feel like testing. It wouldn't be the first time that I had a smudge of solder connecting things it shouldn't hidden under a chip. Last resort is to cut individual tracks with a carpet knife to isolate a short -- solder over the gap later. But no, I see no errors, everything looks just as it should.


The dongle is complete, but quite unprotected. If anything that conducts electricity touches it across some contacts, for example my keys lying on the table, things are likely to sparkenspitzen and fusenblowen, possibly damaging my computer's USB port even. So when I'm satisified, I will coat the entire thing (less the USB pads) with some transparent spray paint three or four times. I also had to add a good half millimetre of thickness on the backside of the USB pads to help make lasting contact with a USB port. I used some thin cardboard and sticky tape for now...

Reality hits

This is where I am satisfied, open the system log (tail -f /var/log/messages), stick the thing into my USB hub (respectfully not directly into my laptop at first), and what do I see? Usually, at this point, what I expect to see is exactly nothing. This is how the universe reminds me of the need to have a head. Here I am with a board that is connected perfectly (enough), a brand new chip, spent hours etching a board and describing how I made it on the internet even, and what do I see? Exactly, nothing. What I really expect is a message from a DFU device registering on the USB. "USB-DFU" is what ATMEL chose to use for programming the chip via the aptly named USB-DFU bootloader. It's (hopefully) a way to avoid buying a JTAG. But there's nothing in the logs. No error message as one would usually get with software. If it were software, it would have spat out a message sort of like this: error: cannot start USB client: oscillator not found. It's impossible to get such an error message, so I had to look at ATMEL's AT32UC3C and AVR UC3 DFU bootloader datasheets, this time properly, and found, out of a hunch, that the USB needs an 8, 16 or 20 MHz crystal or oscillator connected to XIN0/XOUT0. When designing I naively connected a 32786Hz crystal to XIN32/XOUT32, hoping that it would employ one of its PLLs to get a USB time reference or something. That is not the case. Entering electrical sailor of the seven seas mode. Hither device shall be made to work, regardless the cost to life and love! Henceforth! So I still have this large 16 MHz crystal with thin wire legs in a drawer, and I need to connect it to pin 47 and 48. Those two pins are fairly obstructed by other parts. The pad surface sticking out under the pin is super tiny. First I contemplate soldering the crystal's legs directly onto the chip's pins. But alas, those seemingly thin wire legs are wider than a pin plus its gaps! These pins are just amazingly small for a human. A quarter millimeter is really on the outer edge of what my "huge" fingers can navigate in three dimensions. So even a smaller wire went everywhere it shouldn't, and I feared I would melt the chip's package. Finally I came up with probably my only chance of fixing this board, short of making a new one from scratch: use the self-adhesive copper foil. I can cut that to a fifth millimeter width with my household scissors. When it's stuck to the pin, any surplus solder can be wicked away to remove bridges, and it won't jump right off like a wire would. But what should I stick it on so the copper foil doesn't short everything out? Hmm, I need a fairly large isolated surface... and the crystal also needs two 22pF capacitors from both its legs to GND. Hmmmm... .....and here I go, my "creative" fix that saved this board, if not its looks: I stuck copper foil to the µC package, thin probes of which connect to the two tiny pins, and soldered the crystal pins on top of that. I basically let a drop of solder fall across the gap and removed heat immediately. The crystal is also held in place by soldering its (neutral) package to the ground plane, and the two 22pF capacitors standing up just fit between that and the two legs. To my utter joy, I get an instant reward when I connect the fixed board to my USB hub: 1: new full-speed USB device number 8 using ehci-pci / 1: New USB device found, idVendor=03eb, idProduct=2feb / 1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 / 1: Product: DFU AT32UC3C / 1: Manufacturer: ATMEL I spend the rest of the day grinning at random. This is pretty much how I made all of my boards to date. And this is also the reason why it can make sense to order boards from a professional manufacturer. There are just under a million steps to make a pcb, and as many things can go wrong, plus, keeping an etching bath in your closet is not easy logistically. Nevertheless, it is great fun to gauge all the details and gradually improve technique and timing, and having gone through this process really makes me appreciate the precision of professionally made PCBs, with proper soldering masks, chemical vias and everything... Thank you for your attention. If you have any comments or questions, have found typos or untruths, please contact me immediately! :) ...and if you have your avr32 ready for action and are wondering how to get going, check out avr32 hello world, a report of how I got going.
login 2013-12-26 03:26