Tuesday, April 15, 2014

DIY Pick and Place Machine - Part 2

Be sure to check out the other posts in this series below.
Part 1
Part 3

Ok, so we are moving right along with this project.  Parts are coming in weekly, and other parts seem to be endlessly delayed, so we make do.  Since the last post I have been concentrating my CNC PnP education on the following areas:

  • Automagic Z-Axis probing for setting the machines vertical zero position relative to your PCB.
  • Wiring in an emergency stop.  This should have been done before starting the first time.
  • Configuring LinuxCNC's HAL for digital outputs.
  • Investigations into robotic solder dispensing.
Much of this work has been around the back of the machine, so here is a picture of that, and lets discuss.

Above is the back side of the machine.  Along the top is a piece of DIN Rail that extends from the left and right of the ShapeOko frame.  This is where the majority of parts are installed.  Below this, you see a grey vertical surface with parts mounted.  This is a long steel L-Bracket, surplus from some IKEA furniture, that I screwed to the ShapeOko MDF work surface.

Working ( approximately ) from left to right, here is a list of parts:
  1. Green parallel port breakout board.  This gives screw terminal access to your PC parallel port.  To this we attach stepper drivers, digital outputs, digital probe inputs etc. Phoenix Contact P/N: FLKM-D25.
  2. DIN Rail mount Terminal Block.  Multicomp P/N: SPC10564
  3. I colored some of the above terminal blocks red or black with a sharpie.  These are electrically connected with Mulitcomp P/N: SPC11891 jumpers
  4. Big Easy Stepper Drivers - sold by SparkFun P/N: ROB-11876
  5. The two yellow circles are 3-way pneumatic valves.  Clippard.com P/N: EC-3-12 for the valve and P/N: C2-RB18 for a connectorized lead. One of these will be used for solder dispensing/component tape advancing, and the other is for the vacuum pickup system.
  6. Connected to the above valves, via blue tubing ( clippard P/N: 
    URH1-0402-BLT-050 ), is a pressure regulator, clippard P/N: MMR-1N.
  7. The valves and regulator do not come with fittings so I also ordered clippard P/N: 11752-5-PKG
  8. Next you can see a circuit board.  This custom job contains electronics for Opto-isolation, transistor amplification, and Back EMF suppression.  All of which allows us to switch inductive loads like relay coils and solenoids from our PC parallel port safely.
  9. Further to the right is a 12 V DC relay for switching the 110 V AC vacuum pump on and off.  The second set of contacts will eventually drive the vacuum solenoid to either create vacuum in the pickup needle line or vent to atmosphere. I'm not sure if these are available or not, mine is scavenged from an old project Omron P/N: MK2P-S-DC12
  10. On the very far right you can see a blue snubber that is wired across the aquarium ( vacuum ) pump.  I added this to reduce EMI on the 12 V Rail.  It was necessary.  ITW P/N: 104M06QC100.
So, that's kind of an overview of some components, that make the subsystems.  Let's talk a little more about some of the details of setting up the machine and how I intend to make this a useful robot instead of a list of cool parts.  This post will discuss setting up the Z-Axis probing and robotic solder paste dispensing.

Z-Axis Probing:

In case it wasn't already obvious, this entire project has been made so easy by those who have gone before me and were willing to write up their own findings.  Clearly, the best example of this is LinuxCNC, without which, nothing on my machine would be moving this early in the game.  LinuxCNC is powerful and customizable.  And thru adding some text to the configuration files, we can setup the probe functionality built into LinuxCNC, or perhaps more correctly G-Code.

7xCNC.com wrote up an article on how to setup Z-Axis probing.  This will allow me to know how high my pickup needle and solder dispensing needles are relative to the top of my circuit boards.  This is important because later on, when I write G-Code programs for the PnP I will need to reference the top face of the PCB.  Of course you could set the Z-Axis manually, but why would you want to?

Have a look at the picture above, and I will try to explain what happens when we probe the Z-Axis.  The aluminum block you see is 0.75" thick.  The wire connected to this aluminum block via a ring terminal is connected to the PC's parallel port ground.  The alligator clip, clipped to the same electrical point, is connected to the parallel port pin 13 on the other end.  What I just described is a closed switch as LinuxCNC sees it.  If we were to clip the alligator clip to the conductive needle instead, we would have a switch that closes when the end of the needle touches the aluminum block's top face.

If you were to call a probe command in G-Code it may look something like this:
G38.2 Z-2.500 F15

G38.2::G38.5 are probing codes.  In the case of the above code it reads: ( G38.2 ) Probe towards work piece, Stop on contact, Signal error if failure. adding ( Z-2.500 ) means that if you get to Z-2.500 before touching the probe surface, stop; something is awry.  The F15 is your feed rate.

So, F15 is fast for probing, right?  Especially when you consider that 7xCNC.com's tutorial implements debouncing for the probe signal.  IIRC, the debounce routine is 100 iterations of the base thread.  Say our base thread runs at 1 mS, well 100 iterations would be 100 mS, and 100 mS at F15 inches per minute equates to 0.0025".  In other words, if you just zoom down into the aluminum block and set Z = zero ( or 0.750" rather ), you will be 2.5 thou too low.  the answer is to slow down that feed rate and consequently decrease the overshoot.

Since we don't want to wait ages for a slow feed rate if we are a long way away from our aluminum probe block, I wrote the G-Code subroutine for probing as below.  If you read the comments you will see that essentially the code quickly probes down to the block, comes up a bit, then probe down slowly to get an accurate Z-Axis reference.

o100 sub

( Set current Z position to 0 so that we will always be moving down )
G10 L20 P0 Z0.0

( quickly probe down to touch off plate )
G38.2 Z-3.0 F15

( switch to relative coordinates )

( rapid up 0.1 )
G0 Z0.05

( probe slowly to get a more accurate zero )
G38.2 Z-0.2 f0.5

( set Z0.0 to be 0.75 above work surface - this is due to the touchoff plate thickness )
G10 L20 P0 Z0.75

( switch back to absolute coordinates )

( rapid to Z1.0 - probe tip is now 1" above work surface )
G0 Z1.0

o100 endsub

Below is a video of this Z-Axis probe action.

Now, after making my way thru the probe tutorial above, and modifying the G-Code subroutine for faster probing, I learned enough about how to make buttons appear on my LinuxCNC GUI, and more importantly, make those buttons do something useful.  So, I set out to make some more buttons to speed up the machine setup.  I made buttons for zeroing the X and Y axes as well as one to turn on my solder paste solenoid for 3 seconds to purge any dry solder paste from the needle.

To make this happen, I edited myCNCconfigName.ini such that the HAL UI MDI commands look like below:

HALUI = halui
HALFILE = 4axis_PnP.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal

# add halui MDI commands here (max 64) 
MDI_COMMAND = o100 call 
MDI_COMMAND = o101 call 
MDI_COMMAND = o102 call 
MDI_COMMAND = o200 call 

Then I edited custom_postgui.hal to contain the following:

net remote-o101 halui.mdi-command-01 <= pyvcp.o101
net remote-o102 halui.mdi-command-02 <= pyvcp.o102
net remote-o200 halui.mdi-command-03 <= pyvcp.o200

And finally, I added the following to custompanel.xml

# add halui MDI commands here (max 64) 

So, when you press one of these buttons on the LinuxCNC GUI the respective subroutines below are called:
o101 sub

( Set current X position to 0 )
G10 L20 P0 X0.0

o101 endsub

o102 sub

( Set current Y position to 0 )
G10 L20 P0 Y0.0

o102 endsub

o200 sub

M64 P1 ( DO 1 ON )
G04 P1.0 ( dwell seconds ) 
M65 P1 ( DO 1 OFF )

o200 endsub

I will be revisiting this creation of buttons again soon.  I am thinking of how to probe the X and Y axes instead of manually setting the zeros.

Robotic Solder Paste Dispensing:

To start with this robotic solder paste dispensing problem, I decided to rig up a manual pneumatic dispenser.  With a switch connected to a solenoid, I was able to selectively apply CO2 to my syringe of solder paste.  The solder paste naturally escapes thru the dispensing needle, and the hope is, that the correct amount makes it onto the correct solder pad.

This sounds easy enough.  We have a fixed orifice, and a fixed pressure ( 40 PSI of CO2 ), so we should have a constant flow, and with a constant time, a deterministic volume dispensed.  What I don't have, however, is a fixed viscosity fluid.  My solder paste varies from dry to entirely too wet.  The reason for this, I think is that the paste is 2 years old, and it has a shelf life of 6 months.

All this means is that my time based experiments in this area are largely useless at this point.  I have ordered a new tube of solder paste.  This has proven to be a good learning experience.

Eventually the human operated switch was replaced by an opto-isolated, transistor amplified, and back EMF protected circuit, that means that I can now write G-Code to turn on and off this solenoid for a specific time period with the code:
M64 P1   ( turn D0 ON solder solenoid )
G04 P1.5  ( dwell seconds ) 
M65 P1   ( turn D0 OFF - solder solenoid )

Strap the digitally controlled solder paste syringe to the pick and place gantry, and you can do this:

Below is a picture of solder paste dispensing onto a piece of paper.  The 5 dots on the left were dispensed with a 1.5 second period, and for the 5 dots on the right the CO2 solenoid was open for 2 seconds.

Here is a video of the dispensing in action. You can notice that the first pad does not get enough solder dispensed onto it.  Given the viscosity disparity of this expired solder paste tube, and my elected method of application, i'd say these results are pretty good.

While the solder was being placed on the circuit boards, I was hand populating the components.  The resulting boards are just as good as they ever have been using a solder paste screen.  And certainly, one of the coolest features of robotic solder paste application is that I can make new boards while never having to purchase a ~$200 solder paste screen again.

Ok, well I can't think of anything else to talk about on this topic.  It's all pretty prototypical at this point, but I'd say its moving in the right direction.  And if you've made it this far into the reading, thank you; you're doing better than me.
Post a Comment