Tuesday, August 20, 2019

SMD SMT experiments

I'm just now graduating to doing SMD/SMT soldering.  I think of myself now as being in my Junior year of soldering.  Freshman year is through-hole soldering  Sophomore year is manual soldering with surface mounted devices.  Junior year involves use of solder paste.

I started into this by getting a "SMD SMT Components Welding Practice Board" from e-Bay.  It was a good deal, only costing about $2 + shipping and wait time.  I got two of them, partly because they were relatively inexpensive, and mostly so I could blow one up and do better on the other one.

The kit was pretty cute.  The top of the board has practice areas on left and right for mounting lots of capacitors and resistors of different sizes.  The center section is functional and includes mounting points for a timer chip, a counter chip, diodes, triodes, LEDs, and resistors and capacitors.


The back side of the board is also laid out, and they didn't really have to do that but I like it.  It has various measurement examples for trace widths, SMD component sizes, and some IC form factors.

The kit also includes all required parts.  SMD components are super tiny, so it's really easy to lose them, and it's nice that they provide extras of the small ones.

Also provided is a bare bones instruction page.  It gives you a rough idea as to how to do manual soldering of SMDs, and provides a circuit diagram and a parts list.

The parts list shows the different sizes of components provided.  The chips and triodes are specially shaped, so it's easy to figure out where they go.  You do, of course, have to pay close attention to the orientation of the chips.  The instruction page also gives hints about how to figure out the orientation of the diodes and LEDs.  (The LED orientation instructions showed the bottom of the LED, whereas when you have them facing up, only a single green solid line is visible and represents the negative side.)

One step before soldering is to sort out the resistors and capacitors of specific values that you need for the center of the board.  The ones on the side are just for practice, so they can be of any value, and indeed the instruction page just lists "various" as the value provided.

To determine the resistor values, you can read the numbers on them.  Generally speaking, three-digit values ABC are AB*10^C, so a 103 is a 10k resistor, and a 101 is a 100ohm resistor.  There was one 4-digit resistor in my set, so I just measured that using a multimeter.  All such resistors are mounted to the board with digits visible.

The capacitors on the other hand are not as easily measured.  If you have a multimeter that is precise enough, you can attempt to measure their values that way.  Mine only reached a certain level of precision, so I think some of the picofarad values weren't really measurable.  The saving grace for this kit was that the capacitors were mostly of different sizes, some 0805 size, some 0603, some very very small ones at 0402 size.  By comparing sizes and counts to the parts list, I got a decent idea of which was which.

Hand-soldering SMDs

The soldering technique the kit suggested had these steps:
- Tin the pad on one side
- Hold the component down atop the tinned pad, re-melt the solder, and let the piece melt on
- Heat the pad and component edge on the other end, and solder it on.

In practice, I found it better to do this:
- Tin the pad lightly if you can on one side.  Avoid large solder blobs.
- Hold one device pin to the tinned pad, remelt that solder, and let the device melt on.
- Putting pressure from above (with as little lateral pressure as possible), re-melt that pad again, attempting to get the component to lay flat atop the melted solder.
- For the opposite side, move the solder wire to a position where it's very close to or touching the SMD pin and its pad.
- Touch the iron to the solder wire and then immediately to the corner formed by the SMD pin and its pad.  (Having the solder melted this way helps with the heat transfer to the pin and pad.)

Other materials

Doing this work also requires use of good tweezers, good lighting, a magnifying headlamp, and a solder smoke filter/fan.  Using the filter/fan, for me, cut down on the light available because of how it had to be placed close to where smoke was coming off of the board, so I mounted an LED strip onto the filter/fan itself so it could provide light as well as pull away smoke.

One problem I ran into was that my tweezers were magnetized.  That's probably par for the course, given they have to be sturdy; strong ones probably are made of some kind of ferrous material.  But because of this, some SMD components (the resistors, especially) would hang on to the tweezers in weird ways when really wanted to let go and get a different hold.

It's also useful to have some alternate form of magnification available.  I have an Okularis 10x loupe ($6 on Amazon) for quick looks.  For detailed inspection, the HackerLab 3d microscope is pretty fabulous, but can be disheartening when you see how poor your solder joints are at high magnification.

Hand-soldered results

Here's what my board looked like after hand-soldering.


It took me a little while to figure out the LED placement.  I didn't totally check against the provided circuit diagram, and soldered the center one backwards.  I also made a simple mistake on one of the ring ones, wiring it backwards.  The ring LEDs have their negative terminals to the outside.

The circuit flows output from the 555 LED to a junction, where the signal goes to the center LED and splits off to feed a clock signal to the counter chip.  Since I had the center LED backwards initially, it resulted in having the full 555 clock signal being sent to the counter.  That worked out well, actually, allowing the ring and four corner LEDs to blink as intended.  But, it meant that the center LED didn't light up.

When I oriented the center LED properly, the animation stopped working.  I could only guess that was happening because too much current was lost to the LED, and not enough was flowing to the counter chip.  (I was running at 3V, too.  I'm not sure if I needed to go higher.)  I solved the problem by replacing the center LED's resistor with one of higher value.  Now, the center LED is quite dim, but the animation works.


The LED 6x6x6 control board, rebuilt for SMD

I revamped the layout of my LED control board to use SMD resistors, capacitors, and 75HC595 chips.

I haven't yet re-done the board that handles the ground plane controls and transistors.  With those, I want to be careful about power capabilities for the transistors.

I chose to 0603-size components, but now having done the manual soldering, I think I might be better off using 0805 components.  They're just a tad bigger, and easier to manipulate.


I still have to use through-hole components for the headers, and I'm still using manually soldered jumpers to connect 595 pins to a common bus (or something that kind of acts like a bus). But overall, the board dimensions came down quite a bit, which means less lateral (X axis) movement on the HackerLab CNC machine, and hopefully that'll result in better accuracy.

Here's the new board, engraved.  Again, this is an FR-1 board using isolation engraving.  The jumpers wire vertically on the back side of the board.  The jumper holes are generally .6mm, whereas the header pin holes are generally 1.0mm.  If I were using a 2-sided board, the jumpers would be vias.



I certainly could solder SMD components onto the board manually.  There is enough copper that you lose heat pretty quickly down each trace.  The main thing to do is to apply a reasonable amout of solder rosin to the pad locations prior to soldering.  That seems to help quite a bit in keeping the solder on the pads, while also avoiding solder bridges.

This is another copy of the board with the 74hc595 (technically, an HC595AG here) chip manually added along with two capacitors.  The jumpers are also in.  There was a test run adding two components on the bottom right, but I de-soldered them after playing with it.  (The aspect ratio of this might be a little weird.  I took the original at an odd angle, and then skewed it back into shape in Photoshop Elements.)


Building a solder mask from an aluminum can

My next step was to attempt flow-soldering instead of manually SMD components onto the board.
Materials needed:
- a reflow oven (the HackerLab has one now)
- solder paste

Based on various reading, it seems the "right" thing to do with solder paste is to apply it sparingly at weld locations, then heat the affected area of the board up at a gradual rate, let the board rest for a little while at that heat, then heat fully to melt and flow the solder.  After a short time at top temp, cool off the board at a controlled rate.  That's what the reflow oven does.  It provides a number of built-in wave forms to follow, depending on the characteristics of your solder paste.

But I wanted to be even more precise in how I laid down the solder paste onto the board.  I'd read online that a solder mask could be created out of thin material - perhaps mylar or a very thin, stiff kind of plastic -- or even out the aluminum from an aluminum can.

Target3001! steps

I figured I could create my own solder paste mask so I went back to my design in Target3001! and started there.

In Target, there is an ability to generate Gerber output.  I went into my original design, and brought up the PCB view to make sure I was working on the right design.

Then, I chose File / Input/Output Formats / Production / (X-)Gerber (or F11).
The dialog let me choose what I wanted output for, and I selected only the solder paste top.  In my design, that's layer 19.  I gave it a new output directory ("testpaste") and hit Start, and off it went and generated a file.

The result was in a file ..../testpaste/One side 2 latch SMD v4 relabeled.PasteTop
I renamed that to PasteTop.gbr.

FlatCam startup

I then downloaded and fired up FlatCAM.   FlatCAM can read a .gbr file and, eventually, generate gcode from it.

In FlatCAM, I chose File/New, then File/Open Gerber...
I navigated to and found my PasteTop.gbr file and loaded it.  But immediately it showed that Target 3001! had emitted a not-so-nice warning message as part of the Gerber output, saying that Commercial use was prohibited under my license of the product.  But, I argue that I'm using it for hobby purposes, so I shouldn't feel constrained.

Fortunately, Gerber is a text file format, so I exited FlatCAM.  Then I copied the file to "PasteTop_edited.gbr", and loaded it up in Emacs.

Removing the warning

After a small amount of trial and error, I found that there's a long vector sequence starting with the first "G54D10*" line and going to the next occurrence of a G, so I wiped out all those lines.  (In my Emacs set-up, that is:
ctrl-S G54D10
ctrl-A (go to start of line)
ctrl-space (start selection)
ctrl-S G (finds the current one) ctrl-S (goes to the point past the next one) ctrl-A ctrl-W (cut)
I then saved that file, closed Emacs, and loaded the edited file into FlatCAM.

FlatCAM Gerber-to-gcode sequence

Generating a geometry from a Gerber file

In FlatCAM, I did File/Open Gerber... and opened up my edited pads file.  The warning message is now gone.

Choose the entry in the PasteTop_edited.gbr entry in the Project tab, and hit Selected.  This is typical of the FlatCAM interface -- you choose something to work on, and then the Selected tab lets you work on the details.

In the Selected tab, I chose these settings:
Plot: select only Plot, not Solid.
Isolation Routing:
While we're not really doing isolation routing, the CAM motion is about the same anyway, but what I'm really trying to do is cut vectors out of aluminum.  That's not really doable with a laser cutter (could damage the laser) and so the next closest thing I can do is use a tight V-bit in a CNC router.  In an ideal world, I'd cut inside the lines of each pad, but I don't know if FlatCAM supports that.  So I chose to set Tool dia to zero.
I left the Width (#passes) set to 1.
The Pass overlap doesn't matter so I left that alone, too.
So I clicked Generate Geometry under the Isolation Routing tab.
The FlatCAM TCL Shell responded by with "Isolation geometry created: PasteTop_edited.gbr_iso".
(I assume "iso" means "isometric" here, not "industry standards organization".)

Generating the gcode from the iso geometry.

I went back to the Project tab, and clicked on the new entry there, "PasteTop_edited.gbr_iso".  Then, I clicked Selected.  This took me to the Geometry Object pane.

In this pane, we get to choose how we're writing the CAM code that will drive the CNC machine.  We have to be careful here, because the emitted code might have to be specific to the kind of driver in play.  For the HackerLab CNC, we're using Mach3, so we have to know what gcode works for it.

We also are working in inches, whereas the other .gcode output we've seen for the HackerLab CNC has been in millimeters.  So, I had to do some conversions.

Under Create CNC Job, heading...
Cut Z is set to a negative value indicating how deep you'll go into the material.  I wanted to set it to the thickness of an aluminum sheet.  I'd read online that an aluminum can wall is around 0.12mm thick, so I set this value to -0.0055 inches (that is a negative number).  -0.0055 inches equates to around 0.1397mm deep into the material.

Travel Z is a positive value indicating the height to raise the bit tip to when moving from one (x,y) location to another.  (In other systems, this might be called "Safe Z".)  To avoid long delays in raising the head, I wanted to keep the bit pretty close to the surface, so I set this to 0.0787 inches (positive number, which equates to about 2mm above the material).  If that makes you nervous, use a larger number.

Feed rate is the speed at which the head travels when cutting through material.  I set this to 0.315 inches per minute (aka about 8mm/sec) but it doesn't matter much what this is set to.  We'll be overriding it later when doing manual editing of the output file.

Tool dia is set to zero, and I left it that way.

Spindle speed doesn't matter in our set-up, because the spindle speed is manually controlled.  Just for grins, I set it to 6000.

Finally, Multi-depth and Depth/pass work in combination.  I did choose to cut in two passes, so I clicked the checkbox for Multi-depth, and then set Depth/pass to at least half of Cut Z, setting it to 0.00275.  Depth/pass is set as a positive number, even though Cut Z is specified as a negative number.  Also, the system kind of loses the precision, turning 0.00275 back into 0.0027, but the resulting output ends up yielding only two passes.

The cut file runs both depth passes at each hole.  I wasn't sure if it would run all holes in one pass, and then again at a second depth.  But it does run both passes at each hole, and that saves a lot of time.

Now click Generate, and the shell window responds with "CNCjob created: PasteTop_edited.gbr_iso_cnc".

Go back to the Project tab.

Now click on the Project tab and select the new PasteTop_edited.gbr_iso_cnc.  Click on the Selected tab.  This takes you to a CNC Job Object screen.

Here, you basically leave everything alone.  While you could prepend or append some g-code, we'll do that in a more complex step that involves direct text editing.

So, leave Plot checked, leave Tool dia set to zero, don't prepend or append any other text, leave Dwell set to duration 1 (I don't know if they go this right in FlatCam -- Dwell seems to generate a gcode that indicates milliseconds to dwell, not seconds...) and just click Export G-Code.

Choose a reasonable output filename, and hit Save.  In my case, I named it PasteTop.gcode

Quit FlatCam at this point.

Manually edit the gcode file

Start by taking the PasteTop.gcode file, making a copy of it, and renaming it.  I ended up with PasteTop_edited.gcode.

I then opened up that file in Emacs.

Individual changes
1.  Add a G70 command after the G20 line.  This ensures that Mach3 is expecting inches as units.
2.  Change the initial feed rate to be slower.  Modify the F0.32 line at the top to be F0.197.
3.  Add a tool change and pause after that first F line.  So, now where you have F0.197, you want to add these lines after:
M06 T1
G00 Z0.197 (Please change tool and hit Cycle Start)
M0

 The 0.197 height here puts the head at 5mm above the surface.  The text in parentheses ends up as a notification message in Mach3.  The M0 stops the sequence allowing you to turn off the spindle, set up a tool, and properly zero Z.

4. Add Feed rate changes around all Z moves.
This part is tricky, and it's not entirely great.  A better solution could be devised but would require more complex coding.
The idea is that the originally created gcode has moves and downward plunges that look like this:
G00 X0.0810Y0.2340
G01 Z-0.0027
G01 X0.1190Y0.2340
...
G00 X0.0810Y0.1780
G01 Z-0.0055
G01 X0.1190Y0.1780
...
Left alone, the Z downward moves are at the same feed rate as the cutting motion, and that isn't great for our fragile little V bits.

So using emacs, I do a regular-expression-based search/replace to surround those Z moves with feed rate changes:
F1.811 <--- this is prior to any "G01 Z-" line.  I don't think I can specify F as part of a G01 operation.
  // 1.811 is 1.811 inches per minute, or about 0.5 mm/sec plunge rate
G01 Z-0.0027
F18.9 <--- this is my 8mm/sec or 18.9 inches/minute cutting feed rate.  This goes after every "G01 Z-" line.

To do this in Emacs, the keystroke sequence is:
type <ctrl+X>[ (that's controlX and a left brace "[") to jump to the top of the buffer.
type: <meta+X> (in some set-ups, meta+X is ALT+x, others it's ESC x)
(the minibuffer will activate and show "M-x"
Type query-replace-regexp<Enter>
Type in this search pattern: \(G01 Z-.*\)
hit <Enter>
Type in the replacement patter. It should look like this:
F1.811<ctrl+Q><ctrl+J>\1<ctrl+Q><ctrl+J>F18.9<Enter>
(The ctrl+Q and ctrl+J are "hold down the control hit and hit Q, then hold down the control key and hit J).

The match instances will be shown and you're being prompted to say which one to replace.
Type the exclamation point (!), meaning "replace all occurrences".

If you did it right, all the Z negative moves will now be surrounded by safe feed rates (in inches/minute).

Save the file.

What's not so great about this maneuver is that the Z plunge speed from the Safe Z height will be slow for the entire downward movement.  Often it's better to have a faster move from Safe Z to near the surface height, and then start a slow plunge, but that would take slightly more complex coding to achieve.

Optionally, you may add a "move to (x,y) = (0,0) and raise Z to a safe height.  Or, just raise Z to an even higher safe height when done.

Reviewing the gcode file

Before you do any gcode cuts, it's a good idea to check the output file in NCViewer.  Just navigate to ncviewer.com, and load up the gcode file you edited.  Use the mouse wheel to zoom in, and use the other buttons to pan and rotate.  You should be able to see the multiple passes that are taken.  However, you will not be able to visualize the plunge speeds.

Cutting the solder mask using the edited gcode file

Copy your edited gcode file to a flash drive, and transport it to the HackerLab machine that controls the PCB CNC machine.  Save it in an appropriate area (typically under the HackerLab Members folder and then under a subdirectory of your name).

Prepare a soda can or similar material.  

I did this by following instructions/YouTube videos online.  Basically it went like this:
- Find a can
- Do all following steps very carefully, and use cut-proof gloves if you have them.  In all this, you're quite prone to slicing your fingers up, so do these steps at your own risk.
- Carefully puncture the can, creating two slots, one at the top, one at the bottom.  Each slot should run laterally (i.e., if the can were standing up, the cut would go in the right-left direction).
- Slice a line from the top slot to the bottom slot
- Using scissors (that you don't mind hurting), cut laterally around the circumference both at top and bottom.
- Trim any excess rough edges using the scissors.  Try to cut it such that the edges are orthogonal to each other (i.e., try to end up with a rectangle of aluminum, if possible).
- Wash the can, and dry thoroughly.
- Flatten it manually as best you can by bending it across the desk edge

Prepare the can for cutting

Unlike other CNC routing we've done on the PCB CNC machine at HackerLab, I'm actually cutting through material here, so I do not want to put the aluminum directly on the mounted wasteboard of the machine.

Instead, take a piece of scrap from laser cutting area.  Typically you will find small pieces of plywood there, and they will be larger than the mask that you're trying to build.  Make sure whatever plywood you get, it's pretty flat.

Using double-stick tape, affix the aluminum to the plywood.

Now, using more double-stick tape, affix the aluminum-plywood assembly to the PCB CNC wasteboard, aluminum side up.  Try to keep the edges of the aluminum somewhat in alignment with the x/y axes of CNC machine.

Using Mach3, move the head to an (x,y) position somewhere within the material that will allow full cutting of the mask.  Zero x,y at this point.  Attach a V-bit (ideally 15 or 20 degreeswith 0.03mm flat tip), and manually/visually zero the Z axis.  When done, check to make sure that all zero settings are as desired, then manually lift Z up to about 5mm.

Note: you cannot use auto-levelling because your aluminum will not act as a good electric conductor.  There will be some amount of variance in height due to the double-stick tape and aluminum bend inconsistencies.

Optional: Run an air cut

Lift Z to 3 mm or higher, and reset the Z zero value at that height.  Then, load the PasteTop_edited.gcode file.  Start the spindle as normal, and start the cycle using Alt+R or click the Run button.  Be prepared to stop the machine using the space bar, if anything should go wrong.  It should run through the cut and movement motions without digging into the material.

Turn off the spindle.

If all went well, move back to (x,y)=(0,0), re-zero the Z axis, and continue.

Do the actual cut

At this point, your (x,y,z) zero values should all be properly zeroed.

Load the TestPaste_edited.gcode file into Mach3.  Start the spindle.  Start the cycle (ALT+R or click on the Run button), and always be ready to stop the process by pressing the Space bar if anything goes wrong.

You should see the cuts occur.  Repeatedly brush the kit (while in motion) to try to remove any build-up.  You will find that the bit will get a bunch of goo on it during this cut, because it is probably melting adhesive tap onto the bit.  Use only the provided horsehair brush when doing this brushing.  Do not try to forcefully remove the melted-on material, else you may disturb the machine's notion of zero Z.

Re-iterate maybe
Stop the spindle, hit Reset in Mach3, and move the gantry out of the way (using the Up arrow on the keyboard) so you can inspect the results.

Using a loupe or similar magnifier, check each hole to make sure the machine cut all the way through the aluminum.

If the cuts did not go all the way through, do another run at a slightly deeper depth.  Move the head safely to (x,y) = (0,0) again, then re-zero Z visually.  But then this time, change the Z motion speed to 5%, and tap the PageDn key briefly to move the bit deeper into the material than what you originally considered zero.  Set Z zero to this newer, lower position.  Raise Z to a safe height, turn on the spindle, and run the .gcode file again.  Repeat until all holes have cut through.

Post-processing

Remove the aluminum+plywood assembly from the PCB CNC wasteboard.  Remove all double-sided tape from the PCB CNC wasteboard.

Gently remove the aluminum from the plywood.  You may easily bend the aluminum at this point.  I don't see a way around that.  You might also break some narrow pieces of aluminum.  Ensure all tape has been removed from the aluminum.

When done, you will need to do two more things, at least:
- Re-flatten the aluminum since it might have been bent up during the removal process.
- Sand the aluminum to remove burrs.

You should now have a nice solder mask.  I'm rather amazed at how well mine turned out.  The picture below is my first ever attempt at doing this.  It started as a Dr. Pepper can in the trash can at the HackerLab.  The small lines between closely placed pads survived the cutting and removal processes.

Using the solder mask

To use the solder mask, place your circuit board on a flat work space.  If the mask is larger than the PCB, add other junk PCBs or flat, blank PCBs around the edges so that you end up with a flat surface yet can adhere the mask to one of the surfaces.  If you do use additional PCBs to keep things in place, it's best to tape them down to the work surface, and use at least three boards to constrain movement of the target PCB.

Line up the holes of the mask with their pads on the PCB. While holding that firmly in place, tape down one edge of the mask.  That's all you need.

Squirt some solder paste around the holes.  Using a rubber spatula or similar, wipe the solder paste into the holes.  Try not to use too much paste.  And don't use that rubber spatula for anything else, because now it could have lead on it.

This is what my board looked like on my first attempt.  Generally speaking, I think this is on the "too much solder paste" side of things.  I didn't have a rubber spatula for this step, only a scrap piece of rigid plastic.  The mask precision is good, though.


I then manually did the pick-and-place for the components.  They ended up looking like this.  This was just a test run, and so I didn't place the HC595AG chips, though I should have.


I put this into the EasyBake Oven -- ok, I like calling it that, but it's a solder reflow heater something -- and set it up according to the solder paste I was using.  It did smell a little of smoke while I baked it, so I'm not entirely sure if FR-1 is safe with the oven, but nothing caught on fire and no smoke alarms were triggered.  I think it'd be a good idea to have some kind of fire dousing materials around that oven, just in case.

Here's the end result at this point (and this is as far as I've gotten).

First, here's the board with components on.
You'll notice that all the unused solder paste areas that had been there for the HC595AG chips have turned into little solder balls, some of them bridging.  I think it's probably reasonable to guess that if the chips had been there, things would have worked out the way they were supposed to.

The other thing to notice is that a few of the components on the bottom didn't go down cleanly.  (This is a test board using capacitors instead of resistors on the bottom row.)  Here, I'll point them out:

But really what's the root cause?  It's because I placed those chips down poorly in the first place.  If you go back to the earlier picture where I'd put these components onto the solder paste, I wasn't all too accurate with those two.  Here's the same section of the board (done with a little Photoshop magic), pointing to the exact same region:
So, at least for this board, component placement matters.  And, probably, I put down too much paste so it didn't do the magic capillary effect thing, sucking the component to where it should be, instead allowing each of the bad components to stay where it was placed.

What has been learned?
- I can make a solder mask on the PCB CNC out of an aluminum can.
- I can use the EasyBake Oven to flow solder, though it seems a little dodgy with FR-1 boards.
- I really should place all components when flowing, not just some of them.
- Component placement is important.
- It's probably better to try to use Target3001! to generate Gerber files and send it off for real production at oshpark or similar, thus getting a real solder mask, and a real 2-sided board.
- I think I want 0805-size SMD components instead of 0603, but the 0603 ones do appear to work ok with this approach.

No comments:

Post a Comment