But other than the solder paste application problem (which is to be solved now we've a nice stainless steel stencil on order) there's also the small issue of placing parts. Anyone who's ever done this with tweezers is probably familiar with the age old problems....
If you keep your 1206 resistors in nice, separated, pill boxes (or jewellers box compartments, or whatever you call them) there's a good chance that they don't all fall onto your desk the same way up! Picking resistors not only the right way up, but also the right way around (yes, we like all our numbers to be the same way around on a soldered-up board) can be a pain.
Then there's the issue of getting a dab of solder paste on the tip of your tweezers. Which acts like some kind of crazy kinetic-mind-melting glue, attracting all kinds of SMT components (and bits of fluff) from all over the desktop.
Once you've put the component down on the board, you have to remove the tweezers cleanly, without sneezing (or, more likely, twitching or shaking) as you remove them, unless you want to spend the next few minutes nudging the component back into it's desired position. Nudge a bit, no, too much, back a bit, no, back where it was.....
We've been saying for some time we need to make a pick-n-place machine.
The only thing is, they're pretty time consuming. What we really need is a quick hacked-up pick-n-place machine, made from junk that's just lying around, and can be quickly thrown together and made to work. Since our PCBs are only very narrow (100mm x just 14mm wide) there's even a case for making a one-time pick-n-place, just for this one job. After all, if it can be done quickly, and cheaply, then there's no harm in it being a single-job machine, rather than a generic device capable of handling lots of different boards (which it would need to be if we were going to spend any great money on it!)
It just so happened that we had an old flatbed scanner lying around, and a knackered DVD rom drive. Perfect for making a simple xy carriage!
Unusually our flatbed scanner had just one rail, straight down the centre, rather than a rail either side as we'd expected. No matter, this will just have to do for now.
The flatbed scanner was easily dismantled. At first we were just going to take the stepper and the belt from it, but then it occurred to us that the actual plastic frame may just make a good enough y axis for our pick-n-place - after all, it was a good enough y-axis for a scanner, taking in images at 1200dpi. It has a footprint of just over A4 (so quite small) but even if we only used one "half" of the bed (splitting it long-ways and adding a second rail along one side) there's still plenty of travel in the y-direction and enough width for the x-carriage made from a DVD rom drive.
After putting back the belt and carriage system, we very quickly had a working y-axis. The x-carriage would mount on the black plastic piece that the current belt system drives up and down along the 6mm stainless steel rod. The y-axis is actually quite nicely assembled, for such a cheap scanner.
The original scanning head was pulled along by a single 48 steps/rev (7.5 degree) stepper motor.
The underside looked very interesting - it's been geared down quite a bit. So this will be great for super-precise positioning. Our only concern is that it doesn't slow things down too much!
The linear rail is simply a polished stainless steel rod with a piece of plastic clipped over it. The toothed belt sits in part of the plastic that has been moulded to fit the teeth - no need for clamping here! The rod feels like it may have had silicon grease applied at some point in the past. It's not the best quality for a carriage assembly, but it moves smoothly (no binding) and there's no wiggle in it as it travels up and down - everything you could want from a linear rail system!
The tension is maintained in the belt by a simple spring-loaded, free spinning pulley on the far end (opposite the motor). The pulley is not toothed, so the belt just passes around it. The spring ensures that the belt is under tension, without putting it under too much strain.
For the x-axis we butchered a old, broken, DVD rom drive.
It doesn't have particularly fine resolution, but should be just about good enough for what we're needing; after all, our PCBs can withstand placement up to 0.5mm or more out-of-place. If we're going to place all our components and use either hot air or an over to "bake" the boards, any slight mis-alignment will be corrected as the solder paste melts anyway.
To get at the carriage, simply keep removing "layers" from the DVD rom drive (retaining any parts that might look useful along the way) until the optical head positioning assembly is accessible.
This part had actually been glued (presumably with some kind of epoxy) to the cast aluminium frame, so required a bit of "persuasion" to release it. Much to the relief of the other nerds, the hammers stayed locked away for this (though a selection flat-ended screwdrivers made for great levers to prise apart the different layers)
We kept the ribbon cable from the little stepper motor intact, but it's quite trivial to solder a couple of wires to the connection points on the top, if it should get damaged. We took off as much of the optical reader hardware as possible from our carriage, until we were left with very little
The optical reader assembly had some interesting bits, including some tiny little mirrors and this tiny - but functional - magnifying lens!
With the two assemblies dismantled, it was now a matter of trying to get the stepper motors to work independently, before we put everything back together and try running it as an actual xy cnc.
This meant putting together a test rig, with a PIC microcontroller (what else?) some L293D H-bridge IC chips (thanks for those Jason) and - just for fun - a 16x2 character LCD to report what was happening (and when the thing is finished, to display which component is being placed, and where)
Sure, it just looks like a tangle of wires (though Steve should be impressed that there are plenty of different colours, to distinguish between each part of the circuit, instead of our usual trick of wiring everything in green wire, then not knowing where to start when it comes to debugging!). Sure, it's just a microcontroller driving a couple of steppers (no Arduino copy-n-paste library code here though!). But it does demonstrate that we've got the basic control over an x and a y axis, both using jog buttons, and by sending "destination co-ordinates" over serial.
Originally it was tempting to just throw an Arduino at the h-bridge chips and get the motors spinning, but in the end we went with the big beefy 18F4550 PIC for a couple of reasons:
- Arduino libraries are of variable quality. Most are ok. Some are quite clever. A few are shockingly poor. If there are any problems trying to run multiple things together (like receiving serial while maintaining two steppers, and servicing a servo, as well as responding to manual jog controls) eliminating the libraries is the first place to start - so why use them in the first place?
- We're going to throw quite a bit of stuff at this, and also quite liked the idea of a character LCD to report back which component the device is picking, what it's target destination/co-ordinates are etc. This means we need quite a few pins.
- Manual jog buttons (up/down/left/right plus a "jog-slowly" option) means lots of I/O pins are needed. Probably more than we could get from a '328 AVR without resorting to shift registers or IO expanders.
Even with a massive 40-pin chip, we used up a lot of IO lines:
A full explanation of the code and ideas behind it (including interrupt-driven, circular buffered serial receive) will follow in a later post. For now, here's a video of some very crude testing: