Thursday, 8 September 2011

CNC pick-and-place update

We've spent a few days scavenging stepper motors from a variety of sources, and looking at what's available on eBay and other online sources. It's proved a bit tricky to decide exactly what to use for our pick-and-place machine; there are just too many options available!

It's a fine balance between scavenging and ease-of-use.
Typically, the easily accessible stuff (stepper motors from floppy drives, old printers and so on) is not so easy to drive - mostly they're high voltage (24V, 36V etc) and bipolar (2-phase, 4-wire) motors. While these are not impossible to use, they're more difficult to drive than our preferred uni-polar (5 or 6 wire) motors, which we've discovered can be run at lower voltages, using less current.

Current draw is proving to be an important consideration.
We've spent ages getting multiple motors working - albeit one at a time. When we introduced more than one motor at a time, our power supply (a 500mA phone charger providing 5V) wasn't up to the job. So we've upgraded the power supply and salvaged a PC power unit (PSU) which is good up to 400W, and gives us plenty of 12V and 5V power connectors.

The idea now is to use a PC supply (which should be easy to get hold of) and concentrate on 5V or 12V motors.

Unfortunately, we soon discovered that our original circuit was no good for higher voltage motors.
After beefing up the actual power supply, we managed to get more than one motor turning, but at a cost - a funny smell and a lot of smoke! It turns out that the ULN2803A chips we were using to drive the motors can only handle up to 500mA. And the motors were drawing 1A at 12V. Hence the darlington arrays blew after only a few seconds of usage.

This chip didn't just smell and smoke, it actually scorched the breadboard and blew the bottom off the chip when we tried to force it to drive two 1A motors at full belt!

All this means we've had to upgrade our stepper motor circuit.
We've replaced the ULN2380A chip with a series of IRF640 mosfets.
We need a single mosfet on each phase of the stepper motor coil(s) - i.e. four per motor (for a 4-phase unipolar motor). They include internal fly-back diodes and accept 5V logic level inputs, so are quite easy to use and require no extra components.

Here's a photo of the breadboard with the darlington arrays replaced with mosfets.
The benefit of this approach is that the mosfets can be used with low-power motors as well as the bigger ones, so the stepper motor driver will be compatible with a wider range of motors once complete.


The schematic is here - showing how to connect 4 pins from a PIC to 4 mosfets, for driving a single 6-wire/4-phase stepper motor.

[schematic pdf goes here]

Once we got the motor turning again, it was time to build the pulley for the belt-drive system.
We're using one of the belts we got out of the Lexmark Z73 - it's got a really fine tooth-pitch, about 1.2mm. So our cog/pulley needs to have a similar pitch to make the belt teeth fit snugly without slipping. We wanted as large a cog as possible, so that one single rotation moves the belt as far as possible. The larger to cog, the lower the precision, so like everything else, it's a fine balancing act to get the right combination.

Here's how we decided what to use:
The stepper motor is a 1.8 degree motor. This means 200 steps per revolution.
We're using half-stepping, so 400 steps/rev. The tooth-pitch is 1.2mm, or maybe 1.25 if the belt is imperial rather than metric (we can't be sure at this stage, so we're going to make the system, try it out and if there's any slippage, replace the cog/pulley for one with more/fewer teeth).
If we say our pitch is 1.25mm, then a cog with 40 teeth would move 40*1.25 = 50mm per revolution. At 400 steps per revolution, this means each step moves 50/400 = 0.125mm per step. This seems quite quite a nice level of accuracy.

The photo above shows a 40-tooth cog with a pitch of 1.25mm. It's pretty small.
So we thought, if we used an 80-tooth cog, we'd double the speed of the movement (80*1.25 = 100mm per revolution, or 100/400 = 0.25mm per step). Although not as precise, moving a head to within a quarter of a millimetre seems precise enough for a pick-and-place machine, so we decided to make a cog with 80 teeth.

Why pink? Just using up scraps of left over acrylic from a previous job! It wasn't a conscious decision to use pink over any other colour!

We added the disks above and below the cog to stop the belt slipping off the pulley during use. In fact, we found that our belt was every so slightly wider than 3mm (the thickness of the acrylic) so we created little spacer disks from cardboard, and used these between the disks and the cogs, to space them apart slightly.


With all the centre holes lined up, we stuck the multiple layers together and fitted to the stepper motor shaft (although the datasheet said the shaft was 6.25mm, we had to cut our holes 6.35mm to get them to fit and even then, it took some effort to get them onto the shaft!)

We made our cogs using InkScape.
It has a built-in gear maker. On a new document, go to the Extensions menu, Render, Gears:


By default, Inkscape uses 90 pixels per inch resolution. We decided that our belt is probably 0.05" pitch, so the circular pitch in pixels is 0.05*90 = 4.5


I found this diagram when looking for definitions such as circular pitch and pressure angle (I didn't know what they meant either!)


With the parameters in InkScape set, it was just a case of letting it create our gear by hitting apply:


With the gear created, we just needed to add the hole for the shaft. After much trial and error, we discovered that the ideal sized hole for the shaft was 6.35mm. We drew a circle with no fill colour and set the height and width to 6.35, then placed it inside the cog:



With both items selected, go to Object, Align and Distribute. Set "relative to" the biggest object. Then centre along both the x and y axis:


The end result is a cog with a perfectly centred hole for the shaft:


Which fits perfectly with our tiny-toothed timing belt. Or so it seems. We'll know for sure, once we've got the CNC machine up and running!