Guerrilla guide to CNC machining and resin casting

Benchtop manufacturing tips, thoughts, and recipes for robot builders, model makers, and other hobbyists

VOLUME II: Real-world projects
(click here for vol I)

Copyright (C) 2007, 2008, 2009, 2010 by Michal Zalewski <lcamtuf@coredump.cx>

1. Introduction

This is a direct continuation of the first part of my hobbyist CNC manufacturing guide. The second part focuses on building an appropriate part library for CNC engineering tasks, taking baby steps with simple CAD and CAM projects, working with casting resins, and troubleshooting common issues encountered along the way. It also throws around a couple of loosely tied mechanical and electronic design ideas that may be of some use in starter projects.

The reader is expected to be familiar with the basic topics covered earlier in the series, including having a good understanding of key parameters of CNC mills, or the key characteristics of all the chemicals used. It is also necessary to have a basic grasp of electronics, particularly as related to digital circuit design, as I will not be explaining the fundamentals; as noted earlier, "The Art of Electronics" is a good place to start if you need learn more.

2. Prefabricated element library

Reinventing the wheel is sometimes fun, but most of the time, just pointless; even the most creative makers benefit from knowing various generic, prefabricated components that may and should serve as connectors, bearings, fasteners, spacers, and other low-level buildng blocks in even the most unusual designs. The same rule also applies to various electromechanical devices and sensors needed to bring your creations to life. So, let's begin by going through what to stock on, and where it makes sense to use it.

Now, to be sure, this section barely glances over some of the fundamentals; if you are interested in a more thorough collection of mechanical engineering ideas and tricks of trade, you should also check out the two books mentioned earlier in the series: "Machine Devices and Components Illustrated Sourcebook" and "Mechanisms and Mechanical Devices Sourcebook".

2.1. Let's talk bookkeeping

You will probably hate this, but should start keeping an old-school inventory of all the stuff you buy. Trust me on this: creative chaos and CNC machining do not mix. You need to know up front what exact screw or dowel pin lengths you have at your disposal, what is the diameter of motor shafts you need to fit a gear onto, or how deep your 1 mm end mill can go when peck-drilling a hole. If you get any of these factors wrong, you will likely have to start the entire component from scratch, setting you back hours or days.

Go with the format that works best for you - an old-fashioned paper notebook is easier to draw in, while a text file on your disk is more convenient to revise and update as you go. Whichever option you choose, try to keep track of the following: In addition to this documentation, you should try to grab technical manuals and safety guidelines for all the specialty chemicals, plus application datasheets and non-trivial for all the less obvious electronic components in your workshop (ICs and exotic sensors in particular). Companies go out of business, trash their webservers, or phase out products when you least expect it. Sure, you will able to look up the pinout of any 7400 series chip on the web for the foreseeable future, but if you have a rare Dinsmore compass sensor - better not bank on it. Plus, running a search and downloading 5 MB PDFs every time you want to check the pinout on your favorite microcontroller just gets old.

All right? With bookkeeping out of the way, let's get into the shopping mode for all the components you may find useful.

2.2. Mechanical components

2.2.1. Screws and threaded rods

Perhaps the most essential items on your grocery list should be machine screws, also known as bolts (the question of naming is roughly equivalent to the "vi vs emacs" debate - call them whatever you want). Machine screws will let you create exceptionally strong and serviceable joints in a manner that can't be approximated with, say, glue. Where to get them? Your local hardware store likely carries a large selection of screws, but you probably shouldn't be buying them there: the pricing is almost certainly atrocious, and you won't find the most useful sizes in stock, unless the store specializes in miniature applications. Instead, look for bulk manufacturers or distributors of miniature fasteners, such as Micro Fasteners or Small Parts Inc. They will charge only around $2 to $4 for a bag of 100 screws of a particular variety, and all have an excellent selection of miniature sizes to pick from.

SIDE NOTE: Small Parts Inc will be a recurring name through this section. For almost all small, mechanical components, they are the best, most user-friendly place to shop - although be warned that in some cases, they may be more expensive than more specialized retailers. Most importantly, however, Small Parts inventory is also available through Amazon, and eligible for free 2-day shipping under Amazon Prime, with no minimum purchase required. This is almost impossible to beat, and offsets any pricing differences most of the time.

Anyway - whichever store you choose, you should be looking for 100-packs of non-countersunk, fully-threaded machine screws made of steel or brass; the exact type of an alloy is mostly irrelevant (for fastening plastics in designs not exposed to elements, anyway): pick the cheapest one. Be sure to stay away from more expnsive and less durable Nylon, aluminum, and similar exotic materials, though. Drive type (slotted, Phillips, hex socket) is mostly a matter of personal preference: if you have a matching screwdriver, you should be fine - and if you don't have it, get one already!

When it comes to screw diameter, it is good to stock on something around 1.5 mm (fragile - for small, precision applications where space is at a premium), 2 mm (good for all around uses), and 3 mm (good for high loads or extra long reach lengths); in the States, the corresponding ANSI Unified Thread Standard designations are 0-80, 2-56, and 4-48, respectively. Most useful screw lengths are around 6, 8, 10, 15, and 20 mm. You can also substitute 20 mm for 4 mm, and ditch 3 mm (4-48) diameter altogether, if you plan to focus on smaller projects only - that is, nothing over 2-3 kg or so. A handful of projects might also have an use for subminiature screws (say, M0.8 - 000-120 ANSI, or even less), but expect them to be significantly more expensive.
     Good all-purpose                             A so-so
      screw geometry                          screw geometry
    _                             
   / |________________                     |\________________
   |  ////////////////)                    | ___/////////////>   <-- sharp tip for wood applications
   \_|                                     |/ 
                                               ^
                                            ^  `-- not fully threaded
                                            |
                                            `----- countersink
The sizes of hex nuts and washers for a particular screw diameter are mostly standardized, and should be selected accordingly. Keep in mind that your uptake of the screws will likely be higher than that of nuts and washers, so do not aim for a 1:1 ratio. In most rigid plastics with high flexural strength, you can just make a slightly undersized hole - and then drive a screw through it, so that it impresses its own thread in the plastic, and form an excellent interference fit that will not give up easily. No nut is needed in this approach at all! Alas, the trick does not work well when joining very thin sections, or when working in brittle plastics susceptible to stress cracking (acrylic, polycarbonate, polyester) - so still, some nuts would not hurt.

What else? Oh, while we are at fasteners - another potentially interesting addition to your library could be threaded metal rods, but it's your call. These rods can serve two purposes: the boring one is that when cut to a desired length, and capped with two nuts, they form an arbitrarily long fastening screw. The more exciting use: pair a rod with an appropriate nut, and then use it to cleverly convert torque to linear thrust. A naive example would be:
                                                                        ___  actuated element
           sliding guide                                               |   |  
           ============================================================|   |===================
                                                                       |___|
                                                                         |
                                                                         | rigid linkage
  --------.                                                              |                    _
          |    _________________________________________________________.-.______________    |
  motor   |===[/////////////////////////////////////////////////////////| |//////////////]===| bearing
          |                                                             `-'                  |_
  --------'    threaded rod                                         <-- nut -->
The nut is not allowed to freely rotate with the rod, as it is attached to another element - but can move forward or back when the rod is rotated: it is going to advance by the distance equal to the pitch of the thread (say, 0.5 mm) with each turn. Voila - we have a really simple and compact way to convert rapid rotation of a DC motor driving the rod into a slower, more powerful linear motion of whatever we wish to attach to the moving nut.

Now, there is no reason to get too smug - regular screws are not really meant to be used this way, and the assembly would have pretty awful efficiency under load - somewhere around 10-20% is a safe bet - because friction is the primary mode of power transfer, as opposed to rolling action in well-designed spur gears and ball bearings. Still, screw drive is much simpler than any other alternative, and is also locking - that is, applying linear force to the actuated element would ordinarily not move the nut or rotate the motor (because of the very low angle of the thread). Not a great solution, but hey - it comes handy.

Anyway, a couple of 30 or 90 cm rods would likely last for a longer while if you foresee yourself using this approach. Perhaps the most useful diameter for small applications is around 2 mm (2-56).

2.2.2. Plain pins, rods, and tubes

At first sight, dowel pins sure look completely unnecessary: they are just pieces of featureless cylindrical steel, machined to tight tolerances. But as much as they may seem plain, they have important applications. Their perhaps most important use is as axles for spur gears and other rotating mechanisms (example); but you will also use them to precisely align workpieces during the milling process; to align multi-piece molds for casting; and to join finished parts with an accuracy far better than would be possible with a screw alone. They also do a good job as easily servicable torque couplers; slide guides and movement limiters; contact sensors; and much more.

Non-tapered, solid metal dowel pins are available from a number of places, including Small Parts Inc, for about $4-$8 per 100; 2 mm diameter pins with lengths around 4, 6, 8, 10, 15, 20, and possibly 30 mm are probably all you need. You can also look around for 1 or 1.5 mm diameter pins for precision work, especially if you want to build really compact gearboxes for small motors.

Dowel pins aside, you might want to have a peek at vanilla (non-threaded) metal rods and tubes: they are very cheap ($1-$2 per meter, Small Parts offers a good selection), and when cut to a desired length with a hand saw, they are an indispensible engineering material for building lightweight frames (example project), creating long torque-bearing axles, and putting together similar assemblies that are ridiculously resource-consuming to machine individually. Steel or brass tubes around 3 and 6 mm, aluminum ones between 4 and 8 mm, as well as solid metal cylinders, are worth checking out. Rectangular, hexagonal, or L- and I-shaped rods are particularly useful for torque transfer applications.

2.2.3. Spacers

Nylon spacers are a yet another potential low-cost lifesaver you should be aware of; it's much less essential than dowel pins, but may simplify mold design and reduce cutting times by providing a way to ensure a specific distance between fastened elements without actually machining tall protrusions on the part itself:
        Without a spacer                     With a spacer

   part 1              part 2         part 1               part 2
 
   |    |              |    |         |    |               |    |
   |    |              |    |         |    |     spacer    |    |
   |     \_____  _____/     |         |    | _____________ |    |
   |_ _ _ _ _ _||_ _ _ _ _ _|         |_ _ ||_ _ _ _ _ _ _|| _ _|
   :_ _ _ _ _ _::_ _ _ _ _ _: <-      :_ _ ::_ _ _ _ _ _ _:: _ _:  <- screw through hole
   |      _____||_____      |         |    ||_____________||    |
   |     /            \     |         |    |               |    |
   |    |              |    |         |    |               |    |
   |    |              |    |         |    |               |    |

   <----------->                      <---->
    part height                     part height
The lower the height of the part is, the quicker the initial master can be machined, and the less silicone is needed to make a mold - so this simple tool may come handy. Now, it's not all roses - you lose some rigidity of the joint when it comes to shearing forces: the screw will be allowed more play when an interference fit exists only in relatively thin sections far apart from each other. Still, there are cases where it works well.

Spacers with inner diameters of 2 and 3 mm, and outer diameter of 4 mm, are probably most useful with the choice of screws and dowel pins discussed earlier; lengths of approximately 7, 10, 15, and 20 mm are a recommended starting point if you want to stock them. Small Parts Inc is - again - a good place to shop for these on the web.

2.2.4. Springs and spring wire

Springs are traditionally seen a simple shock-absorbing tool, and in that capacity, they are of fairly limited use - maybe as a suspension for certain all-terrain wheeled robots. That said, there is a number of less obvious applications where springs come handy: for example, attached to a motor so that the axis of the spring is aligned with the axis of rotation, they can work as a lightweight, flexible, buffered torque transmission device. A canonical example of this use are... sex toys: this highly NSFW X-ray image illustrates the idea fairly well. The same principle can be used in small robots for torque coupling, with none of the X-ray drama. Another uses of springs include contact sensors (whiskers) and return mechanisms for actuators, to name few.

Springs come in three principal flavors: compression (wound in a manner that permits them to shorten under load, at the expense of the ability to be stretched elastically), extension (wound tightly to permit maximum elongation when pulled apart - no meaningful compressive action), and torsion (tightly wound, thicker, designed specifically for twisting action - e.g., transferring torque). Compression springs can double as (poor) extension springs to some extent; but extension springs will not work as compression ones. Extension and compression springs can be used for torque transmission, too; they might handle high torques less gracefully than a dedicated torsion spring, but the difference is not particularly pronounced in small-scale applications.

For each variety, spring geometry is described primarily in terms of their inner and outer diameter, and length under no-load conditions. For a given type of steel, the force needed to move a spring is proportional to the thickness of the wire ((OD-ID)/2), and inversely proportional to spring diameteter, pitch, and length.

It's difficult to advise on the right size of springs to stock up on, as it is highly application-dependent; it might be good to start with a cheap assortment of small springs, such as this one. For individual 10-packs of springs, you can also go with Small Parts, although it will cost you more, and you will have to make some rather arbitrary choices up front.

Spring wire, also known as music wire, is a close relative of springs, and can be used to make tactile sensors, or to wind your own non-standard springs and tensioners. Because of its elastic properties that make it bounce back even after a significant bending force is applied, it is a far better choice than common wire varieties for bump sensors and structural components. Assortments are available cheaply from a number of sources; if all else fails, look for dental wire used to make braces - same thing.

2.2.5. Ball bearings

The most rudimentary way to constrain a rotating component to a fixed axis is called a sleeve bearing. In this simple arrangement, a cylindrical rotating part is driven through a circular opening of a slightly larger diameter. With a proper choice of lubricants, this permits rotation in the axis of this opening only, while introducing only a modest amount of friction. This is often good enough for low-speed, low-load applications - but sleeve bearings may result in significant power losses or unacceptable wear in more demanding conditions, especially if significant off-axis forces are present (due to unbalanced loads, gravity, etc). While dowel pins and sleeve bearings work very well for almost all gearboxes, the last stage - with the load attached to it - may be trickier to design efficiently.

Ball bearings address this problem by introducing an intermediate layer of smooth, rolling balls between the inner rotating element, and the outer frame in which the bearing is mounted. This allows rotational motion to be transmitted through rolling action with negligible friction even under heavy loads (example). Ball bearings are not exactly dirt cheap, and so, should be used wisely - but they are affordable enough to keep a several dozen in continuous stock. Some of my favorite bearing sizes are 3x6x2 mm (ID x OD x H, link, about $1.00 a piece - only for miniature projects); 6x10x3 mm (link, $1.50); 8x12x3.5 mm (link, $1.50); and 8x16x5 mm (link, $1.00). If you want the cheapest option, consider 8x22x7 mm, too - they are bulky, but because of their wide use in rollerskates and other consumer products, they trade for about 50 cents a piece or less (link).

All the links above will take you to one of the best sources of ball bearings - VXB. Along with individual bearings, they routinely carry 10-, 20-, 30-, or even 100-packs at very competitive prices, unmatched by Small Parts. I have a very positive experience ordering from them, and you should try them out, too.

2.3. Robot-related electronic components

2.3.1. Motors

The selection of motors at your disposal is the single most important factor affecting your ability to bring your ideas to life - and rest assured, balancing torque, motor size, power consumption, and price is not always trivial. You will probably be interested in low voltage, low power DC motors - around 3 to 12V, and no more than 30W or so - as going past that point can be costly, dangerous, and is largely unnecessary in small to medium-size projects. If that's correct, you still have quite a few choices to make.

Brushed motors: Brushless motors: Well, that's it. The choice is up to you, and it's not an easy one! Servos and geared motors have their advantages, but can easily put a hefty price tag on any even moderately complex robots - consider, for example, that a typical quadruped walking robot with independent limbs requires about 12 motors (8 if you are willing to make some major sacrifices); a decent hexapod needs between 12 and 18 actuators. DC motors are abundant and cheap, so they make more sense from that perspective - but if you take this route, you will often need to design and machine somewhere between 3 and 6 gears per motor, and accommodate a lot of simple sensors to properly instrument the motion of each joint. This process is time-consuming, and gives you many opportunities to learn from your own mistakes.

All right, made up your mind? To further complicate your life, when comparing the motors of a particular variety, there are several additional parameters to look at: To find good prices on a wide assortment of brushed and stepper motors, look for local electronic surplus and discount retailers. Some very interesting choices are available from Kysan Electronics, including competetively priced metal gear motors, but modest minimal order quantities apply (check with them for details). Otherwise, All Electronics, Electronic Goldmine, Surplus Shed, BG Micro, and HSC Supply are excellent surplus outlets. Jameco and Mouser have first-hand, cheap components in bulk; DigiKey is the third well-known outlet, but their pricing is usually less competitive; and Newark is another, with good pricing on some ICs. Of all these places, Mouser and All Electronics are my favorite destinations - but all of them are worth checking out.

You won't find many servos and brushless motors in any of these places, though; for these, Hobby King is definitely the best place to shop. They ship worldwide from Hong Kong at very reasonable rates, but keep in mind that large orders may get some attention from customs, depending on where you live. Even with import duties added, they would still be much cheaper to shop there than in many of the local outlets, though.

Oh, a friendly tip: I would generally recommend staying away from robotics-oriented stores, such as Solarbotics, Robotics Connection, Pololu, Acroname, and many, many more; it's not that they are bad people, but they often sell the same surplus components with "robotic" slapped in front of the name, and at a significant premium. They also carry many off-the-shelf components and sensors at a markup higher than Jameco, Mouser, etc; for example, you can get this motor for $23 from Robot Marketplace, $16 from Solarbotics, or just $8 from Kysan Electronics (the actual factory price is under $3 on orders over 1,000 - so it's safe to assume that all these parties paid this much). One of the tell-tale signs of a fishy deal is when a store conceals model names or part numbers on supposedly first-hand components, coming up with a designation such as "Robot Motor 1" instead - and cleverly photographs the items to make the data impossible to decipher from the picture itself.

Anyway - some of my favorite motors currently available on the market are listed below.

Vanilla brushed motors: Spur geared motors: Stepper motors: Servos: Well, that's it. Again, keep in mind that you need 2-4 motors for most wheeled or treaded robots, around 6-8 for a biped robot, and normally 12+ motors for fully-featured quadruped or hexapod bots! It is usually better to buy a dozen el cheapo motors you actually expect to have an immediate use for, than to get one of every type imaginable, or go broke on 20 really nice $40 servos "just in case". To be fair, many robot builders actually do take that last route, and end up with cool designs that unfortunately cost $2,000 or more. Naturally, if you have enough expendable income, by all means, get the nicest motors you can find.

2.3.2. Linear actuators (or lack thereof)

For certain mechanisms, life could be easier without motors. A compact electrical device that directly outputs linear motion (thrust) could quite conceivably be more convenient to use, for example, to operate joints. Alas, linear motion systems are complex, and seldom mass-produced for consumer applications; even in industrial applications, pneumatic actuators controlled by electronic valves tend to be more common than any purely electromechanical solutions.

There are two minor exceptions, though: firstly, we have solenoids - simple electromagnet and plunger assemblies capable of moving a load attached to the plunger a short distance back and forth. Solenoids are typically used to operate valves and car door locks. Some models are reasonably sized and fairly affordable - for example, this push-type or this pull-type actuator, sell for $2.50 a piece. Devices of this size can usually lift between 500 and 1,500 g, but seldom by more than 5-10 mm. Other than their small displacement, the main disadvantage is that they are essentially binary: although the action may be controlled to some extent for a well-known constant load, it's rather difficult to do so reliably.

Another exception is something called a "muscle wire" - an unusual alloy of nickel and titanium that contracts slightly when heated up. This heating can be induced by simply running a sufficient current through the wire. An appreciable lifting force is generated - up to around 1 kg for 1A wires - but because the wire gets only about 5% shorter, this travel needs to be amplified (and lifting capability proportionately reduced) in most applications. The other significant drawback of muscle wire is that it is fragile - it can be easily destroyed by overheating, overloading, or just just getting caught into something; it also runs hot enough to soften some plastics. It's definitely cool - just not nearly as cool as it might appear at first sight. If you are interested, Small Parts sells an assortment of Flexinol brand wires, for around $5 per meter.

To some limited extent, synchronized, vibrating piezoelectric elements can also be used to build linear motion systems, as shown in this animation. Although used in some consumer products - most notably, in high-end SLR lenses - broad availability of cheap actuators of this type seems unlikely any time soon.

2.3.3. Sensors

A variety of sensors can be used for measuring the outside world, and providing internal feedback on the state of the robot - current position or movement of limbs, wheels, steering mechanisms, etc. Several types of rudimentary sensors can be built from scratch (e.g., spring wire whiskers) - but there are limits to what you can do at home. This section covers some of the most useful, commercially available choices to consider in your designs:

2.3.5. Integrated circuit glue and MCUs

You probably have your favorite picks in the land of microcontrollers, and if so, there is no need to change old habits. If you don't have your mind made up, you might want to have a look at ATmega644P ($7) or the new ATmega1284P ($8), though. These two very inexpensive chips operate at anywhere from 0 to 20 MHz (internal oscillator provided), carry 64 kB (644P) / 128 kB (1284P) Flash program memory that can be written without any expensive programmers (an SPI USB dongle goes for about $20-$30), plus 4 kB / 16 kB data memory (SRAM), and 2 kB / 4 kB EEPROM. This amount of memory is certainly enough to write pretty sophisticated programs, as long as you do not need to capture and process images, or engage in other extremely data-intensive tasks - in which case, a more expensive and power-hungry 32-bit chip may be necessary.

Both of the aforementioned Atmel chips come with 32 bidirectional I/O lines, 8-channel 10-bit ADC, and hardware PWM channels, and are available in PDIP-40 packages in case you do not feel like doing too much SMD work. Both accept a wide range of voltages, and are very power efficient, consuming between 0.5 and 5 mA when busy (depending on clock speed). Perhaps more importantly, unlike several other types of microcontrollers (PIC, ATtiny), they have an extensive support for open source C development: a fully-functional port of GCC, GDB, libc, libm, binutils, a nice emulator, and even a decent, dedicated evelopment and debugging IDE. This sure beats manually approximating 32-bit floating point arithmetics in 8-bit RISC assembler.

If chip size is critical, ATmega328P is a narrow PDIP-28 version with comparable specs, but 32 kB Flash, 2 kB SRAM, 1 kB EEPROM, 23 I/O lines, and 6 ADC channels ($4). All these chips are available through Mouser.

For debugging and prototyping more complex algorithms, you might actually prefer to use a regular computer instead. This has some disadvantages - most notably, an external ADC will be necessary to sample analog signals - but also lets you play with arbitrarily crazy algorithms without having to micromanage interrupts and memory layout, or prematurely optimize your code to fit on the chip and run fast enough. The easiest way to interface to a PC is through the IEEE 1284 parallel printer port - programs can set and read back TTL-compatible signals on individual pins directly, at megabit speeds, with no need to negotiate, encode, or time communications in any particular way, unless you want to. This is not the case for any other common I/O port - RS-232 serial ports are slower, use a specific protocol, and require 15V signalling; USB and Firewire connections require a dedicated controller to negotiate with the host and implement packet transmission; and audio inputs and outputs can be easily used for digital communications, but only at fairly low speeds. Industrial and prototyping I/O controllers are another alternative, and more flexible than the parallel port, but also very expensive.

So, if you want to take the IEEE 1284 route, and if your computer does not have the 25-pin printer port by default, you can grab a cheap PCI or PCMCIA expansion card instead; just beware of USB dongles that claim to work as a parallel port - they only emulate a printer driver, but do not provide low-level port access through standardized means at all.

When using MCUs, you will probably benefit from some intelligent way to output status messages and other runtime data; luckily, there is a lot of pretty, neatly backlit text-mode LCDs based on the well-known HD44780 chip - for example, NHD-0216K1Z-NSB-FBW-L ($12). The chip is very easy to interface with using 6 data lines (parallel nibble mode, write-only).

In addition to getting a platform to actually execute the code, you will need some IC glue to make your life easier. Firstly, try to get a good assortment of generic logic chips - preferably 74HC (CMOS) series, though 74LS (TTL) is also OK. Both these families are easily available from just about any reputable electronics place, very cheap ($0.15 - $0.35 per chip), and both offer comparable performance and output current capabilities; 74HC has a significantly lower idle power consumption, better fanout, and is a bit less picky about supply voltages - but for most part, it does not really matter that much. The only thing to keep in mind is that CMOS and TTL logic voltages are slightly different, so you might need a pull-up resistor for TTL -> CMOS interfacing, and a pull-down one for CMOS -> TTL when mixing the two systems.

Some of the most useful chips in the 7400 series are basic logic gates (74xx00, 02, 04, 08, 32, 86 - NAND, NOR, NOT, AND, OR, and XOR respectively), line drivers for controlling small loads (74xx240, 241, or 244), and multiplexers, demultiplexers (74xx164, 74xx165), line selectors (74xx137, 74xx42, maybe 74xx151), and flip-flops / latches (74xx175, 74xx75, 74x259) for controlling more devices than the number of output pins on the MCU. Some projects may also have an use for counters, 555 timers, quartz oscillators, or assorted op-amps, etc - but this should be fairly obvious.

If your MCU does not have an ADC, or if it's not fast enough or not accurate enough for your needs, you may need to shop around for this part, too. TLV571 ($5, around 1M samples per second) and ADC0804 ($3, 10k samples) are both decent, affordable 8-bit converters that work in a standalone mode, use parallel output, have internal clocks, are easy to hook up to pretty much anything. A bilateral switch such as CD4066 ($0.20) can be used to cleanly switch between multiple analog input lines for a single ADC to keep costs down. Oh, and if you also want to output analog signals, for example to drive a speaker or control the current supplied to some other device, consider TLC7524 ($3) - a cheap and robust general-purpose parallel input 8-bit DAC; or MCP41010 ($1.50) - a nice dual 8-bit digital potentiometer with serial input. Couple them with a power transistor and you should be good to go.

Driving motors is another topic that calls for some IC shopping: most MCUs and 7400 chips can output something around 20 mA, which is far too little for most motors (and some other output devices); using discrete transistors is possible, but not always space- or cost-efficient. FAN8082 is probably the cheapest ($0.40) full H bridge driver capable of bidirectional control of brushed motors and bipolar steppers up to peak 1.5A at 18V - and even comes with rudimentary speed control; the only disadvantages of this chip are a relatively high voltage drop (approaching 2V!), and the fact it does not support a "freewheeling" (high impedance) mode: only forward, reverse, and brake. Somewhat more expensive TA7291P ($0.90, 2A peak at 20V) supports all four output states; while TLE52052 ($3.50, 6A peak at 40V) can drive larger motors. Several dozen similar chips also exist - shop around. You almost certainly want to grab 10-20 of one of these devices. And for driving unipolar steppers, solenoids, and other power equipment where polarity reversals are not necessary, ULN2003 ($0.30) and ULN2065 ($2) offer high current capability in a small package (6 x 500 mA at 50V and 4 x 1.5A at 35V, respectively, complete with protection diodes).

In cases where it is desirable to ensure a higher degree of separation between the logic circuitry and the driven load (especially useful with dual supplies), you might want to look into optocouplers such as H11A1 ($0.40), or a broad selection of miniature mechanical and solid state relays ($0.50 - $2).

An important challenge hinted in one of the earlier sections is the problem of living with a motor that requires a voltage different from all the logic chips. It is almost always desirable to pick the supply voltage to match the most power-hungry component - the motor - and then adjust the voltage for low-power chips, rather than the other way round. This is because resistor-based voltage dividers and linear DC-DC regulators, such as LM317T ($0.25) or L7805 ($0.50), are very inefficient, and therefore, work well only for relatively low currents; wasting few miliamps when driving a chip or a sensor is not a problem, but 1A for a motor is an issue. Non-linear converters are much better, but simply get expensive rather quickly: 20 mA ICL7660 costs $2, a hybrid 3A Murata OKR-T3-W12-C is $7, and its 6A variant is $14.

2.3.6. Power sources

The last item on your shopping list should be power sources. For prototyping, I would recommend getting a regulated, adjustable benchtop power supply, delivering something around 0-15V at 0-5A or 0-30V at 0-3A, depending on your needs. Mastech GPS-3030D ($90) looks like a good choice; just stay away from supplies that do not let you limit current with a separate dial (e.g., Lascar PSU 130), as being able to do so is a great safety feature - you are much less likely to fry expensive chips due to wiring problems if the supply is temporarily capped at 20 mA, rather than 3 A.

Once you have your design finalized, you probably want to take it off the tether and let it roam freely. Many designs do well with regular off-the-shelf alkaline batteries or NiMH rechargeable cells. Voltage aside, be sure to consider two factors: battery capacity (the amount of time it would be able to supply a particular current), and internal resistance / impedance of the device (limiting the maximum current it can supply). For commodity batteries of a particular type, the capacity is roughly proportional to battery size, and inversely proportional to nominal voltage; internal resistance is chiefly proportional to voltage. A typical alkaline AA battery will deliver up to 3,000 mAh (or, expect it to last about 15 hours at 200 mA) and will have an internal resistance around 0.1Ω, in practice supplying as much as 10A when necessary; D-size cell has a comparable current capability, but delivers as much as 20,000 mAh. On the other hand, your typical 9V battery is closer to 500 mAh, and has a resistance of 10Ω - that's less than 1A maximum current when you need it.

For datasheets of many common Duracell batteries, see this page; while Wikipedia provides a good general overview of battery capacities. Oh, and in case you were wondering: NiMH rechargeable batteries generally have lower capacities than their non-rechargeable counterparts.

In some projects, commodity batteries simply won't do. If you need high capacity at higher voltages cheaply, but don't care much about weight, you can turn to rechargeable, sealed lead-acid cells; about $20 will get you a 12V in the 7-8 Ah range, or a 6V one around 12-15 Ah - but it will easily weigh about 2 kg. This may be not a concern for wheeled vehicles moving over flat terrain, but often becomes an issue in pretty much any other use case. You can also shop for lithium-polymer (Li-poly) rechargeable cells, which tend to be much smaller and about 5-6 times lighter, but usually also several times more expensive. A good selection of reasonably priced Li-poly cells can be found via Hobby King - they have 7.4V 5 Ah cells for about $25 (~300 g), 1.6 Ah ones for $10 (~90 g), and 0.8 Ah cells for $5 (~50 g). A simple charger costs around $5. Li-poly cells have a tendency to start fires when charged incorrectly, short-circuited, or damaged, so some caution will be necessary. A voltage cut-off IC, such as MAX8211 + n-channel power MOSFET, or MAX8212 with a p-channel one, is also necessary to prevent draining Li-poly batteries past a certain minimum voltage.

Ultracapacitor "batteries" are another interesting concept - aerogel-based, high power density capacitors in the 300-1,000 Farad range are capable of storing enough juice to replace NiMH batteries, and have the advantage of low weight, near-instantaneous charge times and extremely low internal resistance (well, this quickly becomes a disadvantage if you accidentally short them - but resettable PPTC fuses can help with this). Sadly, the price of such a capacitor easily reaches $50-$150 today; this will probably change.

Lastly, solar cells are an interesting power source, too - used for a number of simple, lightweight robots (solarbotics) - but don't be led into thinking they are fun to work with: small, cheap (polycrystalline) cells seldom deliver more than few miliamps at usable voltages unless put directly under a desk lamp, and so you need to make significant design trade-offs, including storing energy in a capacitor and pulsing motors only every few seconds or minutes, to get anywhere.

Many other ideas for power delivery were floated around and tried in experimental designs, including wireless induction, optical tethers using laser beams automatically following photovoltaic cells, etc; they will not be universally useful, but let your mind wander every now and then :-)

2.3.7. Standard electronic components (duh)

It goes without saying that you will also need an assortment of resistors and capacitors, a handful of PCB mount potentiometers and trimmers, a bunch of medium-power BJT and MOSFET transistors, 2.54 mm raster PCB terminal blocks and ribbon connectors, a solderless breadboard or two for prototyping, and a bunch of perforated or blank PCBs for finished projects (good news - you can "etch" and drill them on a CNC mill with high precision!). LEDs and regular pushbutton or rocker switches can come handy, too (you want to be able to power down that killer robot when it turns against you, right?), so do chip sockets (makes salvaging MCUs and other relatively expensive parts from failed designs much easier). Thin wrapping wire (30 AWG) and insulated magnet wire (32 AWG and beyond) also comes handy for hooking up tiny sensors in tight spots - especially tricky in legged designs.

3. Working with the software

All right - with the assortment of basic components sorted out, it is now time to start exploring the CAD / CAM software of your choice. This section gives you a quick overview of the essentials you need to know to work efficiently - but is not application-specific, and by no means exhaustive; you can't get proficient with these tools overnight... and until you are proficient, you will be given ample opportunities learn from own mistakes. Don't get discouraged too quickly, and make these lessons count.

3.1. Baby steps with CAD

CAD programs tend to have a steep learning curve: they often use non-standard UI paradigms, coupled with unfamiliar lingo to describe object primitives and transformations. On top of this, it is somewhat difficult to learn to manipulate complex 3D objects using 2D input devices and 2D projections on the screen. Let's start with some general tips: All right, ready to get started?

3.1.1. Drawing and manipulating basic curves

Your first goal should be discovering how to draw the following simple shapes: In most cases, you will be using these splines, and not fancy, ready-made surface or solid tools, to bring your designs to life. Spline curves are extruded, revolved, lofted, or used as trimming paths to create complex 3D objects - so fight the urge to experiment with all the spiffy solid drawing commands for now.

Once you have the above mapped out, try entering numerical parameters manually, play with standard snaps and basic keyboard shortcuts, and so forth. Try to draw a smiley face without the use of your mouse (remember LOGO?). When you are done, explore the following operators: In particular, understand how all these operations behave for various origin or reference points. Then, check out the following analytic tools: Again, practice numerical entry for all the new drawing functions, and see what other options they have. Try to use them to draw a simple shape - for example, a mock spur gear using a circle, and a radial array of rectangles. Use measurement tools and a calculator to make sure the elements of a radial array are spaced evenly, and the distance between the first and last tooth is consistent with the remaining teeth.

3.1.2. The inner workings of splines

Internally, curve segments are represented as a collection of coefficients of a polynomial function. The degree of the function defines how complex the segment may be: first degree segments are just straight lines, and only their starting and ending points may be manipulated; second degree segments can additionally have a single bend (think parabola), and the shape and direction of this bend can be manipulated by moving an additional control point; third degree segments can have two bends with two control points; and so forth. In most programs, a single logical curve may consist of several discrete polynomial segments; the point where one segment ends, and another begins, is called a knot. The important consequence of this is that the direction of a curve can't change instantaneously within a particular segment; knots that join them are usually smooth as well, but do not have to be: a particular type of a knot, often called a kink, allows segments to meet at an arbitrary angle with no regard for curvature continuity. A square, for example, typically has four kinks in the corners, and four first degree curve segments in between. A circle may be implemented the same way, but with second degree segments instead.

Editing curve coefficients manually is not something you'd want to do, so most programs offer two UI-based abstraction layers: one is dragging control points, generally located outside the curve, to which the shape is "pulled" toward with a force proportional to how far the control point is (illustration), and possibly also proportional to a "weight" assigned to that point; some programs use Bezier handles extending from knots instead (example), but the idea is the same: the curve is pulled toward handle locations. The other mode is moving around edit points through which the curve must pass, and will be fitted to do so (illustration). In both edit modes, you will also be shown all the sharp endpoints (kinks) that terminate segments of the curve, and should be able to drag them around.

All right, this probably sounds overwhelming, but is really important in practice. To understand how curves can be edited, find the following controls and play with them on some of the simple shapes discussed in previous section: Also familiarize yourself with these tools: When you are reasonably comfortable with the concepts outlined in this section, see if you can turn a circle into a nice, symmetrical heart by adding two kinks (if necessary, depending on the implementation) and scaling or dragging around control points. Then, if permited by your CAD application, try the same with edit points to a new circle. See which editing mode you like more.

3.1.3. Curve reassembly

The two next very important tools for curve and for surface editing are the split and trim operators. Both take two operands: a set of cutting objects, and a set of objects to slice. The latter selection is neatly cut into separate chunks in the places they intersect the former group. The split operator ends here, while the trim operator also removes one of the halves (as picked by the user). Remember the gear-drawing exercise earlier on? The trim operator could be used to remove the overlapping segments and create a proper gear outline. This is how complex shapes are built, so play with this a bit.

In most programs, the trim, split, join, and explode operators are very accurate, often using trimming masks instead of recalculating the entire geometry - and for most part, preserving the planar nature of edited shapes. Many other Boolean operators and complex 3D editing tools do not necessarily share this property, so stick to simple tools where possible.

Be aware that the trim operator does involve some computational guesswork, and you will inevitably see it fail every now and then; if so, do not panic: use the split operator, and manually delete the bits you no longer need. As usual, practice is the key: see how these operator behave with two curves that share a particular straight segment, slightly overlap or do not fully touch each other, etc. Knowing this behavior will be very, very helpful as you go.

3.1.4. Other useful curve tools

The last three editing tools are immensely useful for CNC work are filleting, chamfering, and offseting a curve. Filleting is applied to a corner (kink) on a curve - and replaces it with a specified corner radius. The change is barely noticable for obtuse, and significant for acute angles; the significance of this operation is that it closely emulates the behavior of an end mill in the XY plane, and thus helps create models that conform to the actual CNC output for snap fits.

Chamfering does roughly the same, but replaces a kink with a straight segment that starts a specified distance from the kink in one direction on the curve, and ends at a specified distance in another. Chamfering can be used to approximate fillets in many applications while producing a computationally simpler geometry (so that CAM processing takes less time). Both techniques are also used for aesthetic purposes (to achieve nice rounded or tapered edges), and to relieve material stresses in engineering applications: chamfered or filleted ribs and protrusions are able to withstand higher shearing forces without breaking off.

The last operator - offseting - simply allows a curve to be resized in a very useful way: by creating a complementary curve consisting of points at a constant, specified distance from the original. This is subtly different from scaling, and extemely useful in creating all sorts of thin-walled elements, such as external enclosures.
  |                |                |                : |
  |                |                |                : |
  |                `                 \               : |
  |                \                  \              : `-----
  |_______          `-._____           \____         `.......

    input           fillet           chamfer          offset
Well, that's it - we're done with curves! Well, OK - this is purely optional, but you may want to poke around and explore the other curve tools: stars, spirals, helixes, etc; non-uniform refitting, blending (like filleting, but giving you a greater control over curvature continuity), extending, and closing curves; curvature display; and so forth. These features are not needed nearly as often, but knowing them should not hurt.

3.1.5. Creating simple surfaces

This is where it gets good. To get started, draw a closed curve, then find an operator to create a planar surface bounded by that curve. Looks promising? Next, see what happens if you select two separate curves; and what happens if one is inside another, or partly overlaps it: you should be able to make surfaces with holes. Examine the failure modes, too: what if one of the curves is on a slightly different Z level? Or slightly tilted? Or not planar at all? What if a curve is open or self-intersects?

The other key surface-building operator is extrusion. Draw an open or closed curve, and try using this tool to extrude it in the axis perpendicular to that curve. See if you can toggle the setting for generating "cap" surfaces on the top and bottom: in some cases you need them, in some you don't. Let several surfaces intersect, and revisit the split, trim, join, and explode operators you previously used on curves. Draw 6 rectangular planar surfaces, arrange them to form a crude box, and then trim and join them to create a neat, watertight object with no unnecessary internal detail or protrusions of any sort. Your program probably offers solid measurement and diagnostic tools: ask it to calculate the volume of your solid, and see if everything checks out.

Another three important surface creation tools - less so for designing gears, but for developing organic shapes - are curve revolution, lofting, and sweeping. The revolution operator allows you to draw a surface by rotating a curve around a specified axis (imagine the curve leaving a trail in space): this is a common method of creating many cylindrical shapes such as bottles, glasses, cans, and so forth. The lofting operator lets you "drape" a surface over a series of curve outlines arranged in 3D (think of slicing an object and preserving contours of each slice - example). While revolution is relatively simple, lofting definitely deserves 30 minutes of experimentation or so: radial and planar arrangement of the outlines, various alignment, fitting tolerances and modes, are worth exploring. Lastly, sweeping is an operator somewhat similar to revolution - but causes the shape to follow an arbitrary path, rather than rotating around a straight axis; common uses include creating spiral threads, cylindrical cams, etc (illustration). Some programs support advanced sweeping operations between multiple rails and using multiple profile curves, supplementing lofting - so be sure to investigate.

Again, experiment with these tools, and observe how they behave depending on the type and arrangement of curves used. Also, examine the operators for extracting edges from surfaces and solids: boundaries, silhouettes, and intersections will be useful.

At this point, you can also play with variable edge chamfering and filleting, edge blending (a more reliable and accurate way to create complex fillets), hole placement and removal, Boolean operations on solids, cage editing, orienting objects on a surface, and so forth - but again, do not make a habit of using these functions unless really necessary, and certainly not if you need to maintain micron-level accuracy.

3.1.6. Managing the mess

The last set of CAD-level tools you need to explore are ones related to grouping, ungrouping, temporarily hiding or locking objects, and working with layers.

The purpose of grouping is to manipulate separate, perhaps non-contiguous objects as a single entity in the UI to reduce clutter - but still have the ability to open the group and tweak something easily if you change your mind later on: a good example is a stack of gears, where you may still want to be able to tweak gear spacing without having to resort to booleans, but for most part, just want to move them around as a single thing. A different take on grouping is a layer - objects on a particular layer (say, "bottom cover") may be assigned a specific color, and may be locked, hidden, or selected by that association, but can be edited separately in the UI at all times.

Hiding is useful for keeping your workspace tidy without losing data: for example, you might want to hide helper curves used to create a gear, rather than deleting them, so that you can always pull them back should there be a need to correct an error. Locking, on the other hand, keeps finished objects visible, but prevents any interaction: accidentally selecting, dragging, or trimming them when you are operating on something nearby.

Many programs also support instantiating objects - that is, creating virtual copies of an object; each instance may have separate coordinates, scaling, and rotation, but references the same underlying geometry (and all instances will be updated when one of these copies is edited). Instances usually offer memory and CPU time benefits over creating independent copies of every screw or a gear, so make a habit of using them in more complex projects.

3.1.7. Practice time (and some rules to go by)

Well, that's it! Although your typical CAD application has dozens more 2D and 3D primitives and manipulation tools, the aforementioned set will be likely all you need on a daily basis. Try to experiment with said features to create simple shapes: bar stool, door hinge, a rubber duck, or a wine glass are all good starter projects. Once you are done messing around, let's come up with something to feed to a CAM program: draw a simple heart shape, about 30 x 30 mm. Then, draw a square on the outside, at least 5 mm away from the edges of the heart - and another one, by offseting that first rectangle by 1 mm to the inside:
   _________________________
  |.-----------------------.|
  ||                       ||
  ||      ,-~-, ,-~-,      ||
  ||     /     ,     \     ||
  ||    |             |    ||
  ||    |             |    ||
  ||    `.           .'    ||
  ||      `.       .'      ||
  ||        `.   .'        ||
  ||          `.'          ||
  ||                       ||
  ||_______________________||
  `-------------------------'
Move this entire set of curves so that the bottom left corner of the outermost square is at (0,0,0). Select the outermost square, and extrude it down to -9 mm in the Z axis (turn "cap" surfaces off). Then, make a planar surface out of the same curve, and drag the result down to -9 mm again. Next, select both rectangular curves and create a planar surface in the 1 mm space between them. Lastly, select the inner square, extrude it down to -8 mm, make a planar surface out of the same selection, and drag it to -8 mm likewise. Select all the created surfaces and join them. Voila - you should have a closed solid for the mold: a hollowed out box, 8 mm deep, open on top, and with 1 mm walls on all the other sides

Now, select the heart, drag it down to Z = -2 mm, then make a planar surface out of it. Extrude the curve down to -6 mm. Join the two newly created surfaces. That's it - you have a complete mold: notice that if you machine this shape, pour silicone rubber into it, and then cover it with a flat sheet of polypropylene, put something on top, and let the resin cure, you will end up with a rectangular negative mold with a heart-shaped cavity, accessible from the bottom end, and closed off with a 2 mm wall on the top. If we then flip it, pour in polyurethane resin, and again cover the mold with non-stick plastic, a simple 6 mm thick heart pendant will be produced - identical to the heart resting at the bottom of the original machined mold. Simple as can be.

If you are observant enough, you might have noticed that the CAD heart we created does not have a bottom cap. This does not matter for machining, as this area is safely hidden from the cutter; but it is better to avoid this where possible, as it hinders the ability for your CAD application to, for example, calculate the volume of a solid.

That aside, you are probably scratching your head about a couple of other seemingly arbitrary decisions made when creating this shape: for example, we used a certain distance between the part and the edges of the mold for no obvious reason. Well, when working on your own, you will need to start thinking about how the part is going to be machined very early on - and then, these details will come naturally. In essence, you simply have to make sure the part can be realistically made with the tools you have, that it is not going to take too long, and that the result will be structurally sound. Some of the rules should be apparent after reading the earlier part of the guide: for example, in three axis cutting, you should avoid undercuts (cliff-like geometries that hang over a void); here's a couple more: As for structural considerations - in one-part mold designs, you should avoid five fairly simple things: When using silicones in the 60-80 Shore A range, most of these constraints are less pronounced; except for the last one, where the need for careful mold design increases in proportion to the hardness of the rubber.

3.2. Creating toolpaths in CAM software

All right, this is where the pain begins: if you thought CAD can be counterintuitive, CAM programs will probably make you cry. They are some of the most unforgiving, sluggish, and buggy applications I have ever worked with; I hope somebody decides to sit down and writes a decent open-source implementation to shake this market up. Until then, to even understand how to import a project, create a toolpath, and write the resulting NC file, you might need to read the manual several times over; and if you do not end up having several projects ruined by random glitches, consider yourself amazingly lucky.

Before loading your project, start by configuring the application for your particular machine - which amounts to picking the right postprocessor (or creating a new one based on something closely related with the NC language reference in hand), and confirming that all the global options are set sanely: arc / helix interpolation enabled (except when it randomly introduces weird glitches, of course), metric units checked, tolerances similar to that of your CAD application, etc. If your machine is to be operated using G-code, and the program asks about a "coordinate system" at any point, be sure to set it to G54; this is the first and default user-controlled coordinate systems - and the only one you will really need to use for hobby work with individual workpieces.

3.2.1. Importing and orienting the geometry

When you're done with the configuration - and only then, mind you - try to import your CAD geometry. Depending on the software, you might need to first export the data to some other, common interchange format (IGES, DXF, STL); if so, prefer formats that support spline surfaces to these that require conversion to polygons (if not possible, at least configure meshing to achieve sufficiently close tolerences in this conversion - 0.001 mm is a good idea).

Once you have the model loaded, you need to make sure it is oriented correctly. In 3 axis mold work, it is customary - and usually most convenient - to set your X and Y origin point (zero coordinates) in the bottom left corner of the workpiece, and Z origin at the top of the block (so that you do not have to adjust the model depending on stock height - just machine from the top surface down); a different Z0 location may need to be used if you expect to completely remove the top surface of the stock in between processes, since this takes away the ability to put the Z0 sensor there during tool changes - but that's a different story.

The actual X, Y, and Z origins will be set later on, using the machine's control panel - but before that, the loaded geometry needs to be oriented accordingly. Be sure to check where (0,0,0) in the program actually is, and if it is not aligned with the model as expected, move the origin or the model around. The way to do this is highly application-specific, but is really of critical importance - if you get this wrong, cutting will begin at an unexpected location: in mid-air if you are lucky, in something expensive if not.

Several simple mills, such as Roland MDX-15 or MDX-20 always use a fixed machine coordinate system with (0,0) in the bottom left corner of the working table; only the Z origin can be set before sending out the toolpath. For these mills, you need to make sure that your part is loaded into the CAM application at an X and Y position corresponding to how far from the hardware origin the actual workpiece will be mounted. For this mold, you can just go for X = 10 mm, Y = 10 mm - we can mount the actual stock roughly at that location later on.

Confusing side note #1872: the rules for rotary machining are different: your mill will have a specific procedure for setting the Y and Z origins to be precisely aligned with the center of rotation, and the model must be aligned with the Y=0 Z=0 axis to match your stock material and the desired machining strategies. There are quite a few good articles about this in the jewelry world; but do not even bother with four axis milling until you have a decent success rate with three axis workflows, as it is harder to follow.

3.2.2. Roughing toolpath

As mentioned earlier, most cutting processes are split into two phases: roughing, which aims to remove bulk of the material as fast as possible, leaving only a relatively small "margin" in place; and finishing, meant to remove the remaining bits slower and more accurately to achieve a good surface finish. If the top of the workpiece is uneven (perhaps after earlier cutting experiments), an additional surfacing process is sometimes employed before any other steps, but this should not apply here.

Most roughing strategies employ a modified waterline approach: the toolpath fills all hollow regions in the X-Y plane for progressively lower Z values; the fill pattern for each step may be linear, spiral, shape outline offset, or anything else, and may cut only on that Z level, or also move up a bit to better interpolate slopes; but the idea really remains the same (image). The most important parameters for this toolpath are: Z step, the distance between fill toolpaths in the X-Y plane, margin width (the minimal thickness of material to be left in place for finishing), and machining feeds and speeds.

The first parameter, Z step, will put more stress on the cutter when set to a high value, may cause some chipping, and will increase the amount of material left behind at the bottom or in staircase patterns on sloped surfaces; very low Z step, on the other hand, will just make the cutting process unbearably slow. For RenShape 460 and a 3 mm cutter, 0.5 - 2 mm makes sense; in our case, 1 mm is probably optimal.

Toolpath distance has a similar effect, but in another plane. The value simply needs to be lower than the diameter of the tool, otherwise the toolpath may not make any sense (and your CAM program may opt not to warn you about this subtle detail); 1-2 mm should work well in our case.

Next, margin size should be set so that the cutter can still machine most of the narrow spots on the mold - not necessarily all of them, but as discussed earlier, bulk of the work should be done in the roughing pass. Be careful: if a slot on the mold is 4 mm wide, the cutter is 3 mm, and margin is 0.6 mm, the region will be left uncut (3 + 0.6 * 2 > 4). It is tempting to set margin to 0, but heavy cutting tends to leave tool marks - so in most cases, leaving around 0.3 - 0.5 mm makes more sense; 0.3 mm is my recommendation for our sample mold. Here's a nice trick, too: if the program does not have a specific setting to define a margin, simply edit the tool to add 2 * margin to its declared diameter; and offset the toolpath by margin up in the Z axis (or even move Z origin up manually on the machine). The effect will be exactly the same; just be careful not to accidentally propagate these values to other processes that are not meant to have a margin.

The next part of the puzzle are machining speeds. For roughing RenShape with small diameter cutters, RPM can be usually set to the maximum value; for our 3 mm bit, feed speed should be set to about 3,000-4,000 mm/min at 12,000 RPM, or proportionately less if the maximum RPM is lower. If your application supports specifying lower feed rates for material approach movements, you should set this speed to 70-80% of the primary value (hard or abrasive materials may require 30-50%, but PU boards don't).

Conventional (up cut) machining strategy is advisable for roughing and finishing in PU boards, for the reasons explained in the previous section (better dimensional accuracy); but meander mode is also acceptable for roughing with a safety margin, and will speed things up for linear toolpath fill patterns.

Next, there are various application-specific settings you might need to tweak, including selecting the area to machine, so that only the inside of the mold is worked on, and the program does not concern itself with the external shape of the box we imported from CAD. Just pick a rectangle somewhere on the 1 mm "flange" of the mold, and you should be fine; but watch out for traps. Try to understand how the program interprets cutting boundaries - there are three possibilities: In some programs, this is configurable; in others, the meaning of a boundary changes from one cutting method to another (ugh!).

Also look out for settings that let you specify part sampling accuracy (0.05 mm should be enough for the roughing step), or define toolpath entry and exit strategies (for plastics, often best turned off, as they only add machining time). If you stumble upon anything puzzling in your application, just drop me a mail and we can try to figure it out.

3.2.3. Finishing toolpath

The roughing phase leaves some material uncut, and there are three components to this: Fixing all this requires some creativity, depending on the shape of the part. In most molds, the first step is to repeat Z level cutting (this time, without filling the X-Y plane) with a zero margin; Z step should be reduced to capture all vertical features of the component and trace around them fully, as explained in section 3.1. This operation generally fixes the first and third issue on the list above.

The next step is to machine all horizontal surfaces to correct the second problem. This is done with parallel X, Y, or spiral projection profiling of the inside of the mold, usually with a toolpath stepover of 20% of tool diameter or so. When doing this, keep in mind that the region within one diameter of the tool from any vertical protrusion is already machined as a result of the earlier finishing step. Since touching these walls again with a cutter moving sideways can only negatively affect surface finish, adding a matching X-Y margin (but no Z margin!) to this operation is a pretty good idea; if controlling X-Y margin separately is not supported by your CAM program, you can use the trick suggested in the previous section: lying to the program by increasing the specified tool diameter (and in this case, not touching the Z origin at all).

In deep molds with vertical walls, lowering RPM for both these steps may be desirable to avoid chatter; if you notice fine, spiral scratch-like patterns on some walls, you should probably have done that. Another potential cause of such a pattern may be too much material left at the bottom of the mold, causing the final Z level to involve heavy cutting; a way to prevent this is to swap the two steps outlined above - but keep in mind that if this is done, a correct X-Y margin must be set correctly to avoid trouble.

The remaining steps depend on the specifics of your mold. Angled slopes might need to be re-machined using a suitable strategy (3D pattern draping often works well, but so do linear movements parallel to the slope); ball cutter may be useful for this purpose, too. If your mold features any holes with a diameter exactly matching the diameter of the tool, you will probably also have to add manual drilling steps, or at least double-check that the program has bothered machining them. Finally, progressively smaller tools may need to be employed to finish specific regions, such as tight corners, small diameter holes, or fine surface patterns. In this particular case, you might want to re-machine the fillet on top of the heart: if so, a 1 mm tool with 10 mm reach, operated at about 900 mm/min, 12,000 RPM, with waterline Z step of 0.25 mm, should do the trick.

If a particularly fine finish is required, especially with larger tools, lowering feed speeds to 30%, using unidirectional, linear toolpaths, and perhaps reducing RPM a bit (to 80% or so), is often a good idea.

Another random tip: when making deep cuts with limited chip removal opportunities using small, long-reach cutters (say, 1 mm diameter tool cutting an 8 mm hole 1.5 mm in diameter), finely powdered chips may end up getting compressed by the neck of the cutter, and effectively reduce hole diameter by deflecting the tool. A good way to minimize this problem is to machine the hole twice.

3.3.4. Final sanity checks and exporting toolpaths

Measure twice, cut once: since there are quite a few parameters you need to keep track of, always double-check your work before sending it to the machine; 5 minutes will save you a lot of grief: If everything checks out, you need to get the toolpaths ready for cutting. In some programs (e.g., Modela Player), the output is done directly from the application - in which case, nothing needs to be done right now. In many others, the data is written to a text file, and that file then needs to be sent to the machine using a separate utility (e.g., VPanel); if so, export ("post") the toolpaths now.

4. Making parts

Well, yeah - let's make some stuff already!

4.1. Milling

First, we need some stock material. For this mold, the workpiece should be about 6 x 6 cm, and at least 15 mm thick - though the beauty of this process is that you can use a larger or thicker stock, and the amount of cutting does not change. Just grab a square piece roughly 6 x 6, sawed off from the prototyping board at hand. Then, dust off the table and the workpiece, and use 3-4 thin strips of double-sided tape (as discussed in the previous part of this guide) or any other mounting system to attach it to the table - securely. When mounting the stock, you need to make sure that both the bottom left corner and the top right one are within the area the cutter can move to (which is smaller than the actual size of the table - check manuals); that when fully retracted, the tool can clear the workpiece comfortably; and that it has enough movement in the Z axis to reach to the lowest point you intend to machine. You can use a "booster" block of prototyping board if the stock is too low or otherwise hard to mount, and then use several drops of instant glue (for PU) or another strip of tape (for machinable waxes) to attach the actual workpiece to this block. If your machine has a rotary axis, a tool changer, or any other features that the cutter or spindle assembly could collide with, make sure this will not be a problem, too.

Finally, hook up the mill to the computer, mount the right mill in the collet, and turn the power on. Set the coordinate system to G54 if applicable, then use the bundled software or a hardware control panel to set the X and Y origins about 2 mm from the bottom leftmost corner of the stock (i.e., slightly over the workpiece); and Z origin at the top of the part. You can use a Z0 sensor, or - if the machine does not have one - simply grab a thin strip of paper and hold it under the cutter to spot the right moment while carefully lowering the spindle using the control panel (no refunds on your fingers, so affixing it with some tape may be a good idea instead).

Every time you want to output any data to the machine, there's one more important thing you always need to check: that the tool is above the workpiece in the Z axis. If it is not, perhaps because you aborted a previous cutting attempt or tried to check something outside the milling envelope, sending a new toolpath will likely cause the cutter to plow through the part on its shortest way to the next destination. Some CAM programs know to avoid this, or can be instructed to do so by manually entering some G-code to retract the tool first - but it's not a rule, so don't bet any money on this.

Anyway - let's start cutting! Some mills allow you to adjust cutting speed dynamically, using a hardware jog dial or some sort of a software slider; if so, make a habit of dialing it down to the minimum setting before starting a process, and ramping up the speed to 100% once you see the cutting takes place in the expected spot and in a sane manner. In any case, hold your hand on the "abort" button, grab some eye protection, stand clear of the table, and... hit "send"!

With any luck, several minutes later, you should have the mold ready; if a tool change is necessary halfway through the process, be sure to vacuum off the chips and redo Z0 sensing for the new tool. Forgetting that last step can be an expensive mistake.

There are several things that can go wrong, but should be pretty self-explanatory: if the machine starts cutting at an unexpected location, or too high / too low in relation to the workpiece, you probably messed up CAM model alignment or setting X, Y, and Z origins on the machine. If your tool breaks while cutting at the expected location, you probably used incorrect RPM, feed speed, or cutting depth parameters. If the workpiece comes loose (which, by the way, you do not want to happen - really, with industrial machines milling metals, people have died this way), you need to do a better job attaching it. If the machine stops suddenly, you probably overloaded it, or it couldn't communicate with your PC - perhaps because of incorrect port settings, or the power save mode kicking in. Incorrect dimensions of the machined part are usually due to installing the wrong cutter. If you run into any problem you can't figure out, feel free to drop me a mail, and I'll do my best to help.

You are probably anxious, but before turning off the mill and removing the part, vacuum off some of the chips again and carefully examine the result, with a flashlight if necessary: were all the areas machined exactly as expected? Anything that needs to be retouched? When you turn off the machine and remove tha part, there's no going back - the alignment of the workpiece is lost, and will be very difficult to accurately restore.

4.2. Casting negative molds

Let's assume the mold looks roughly the way we wanted it to. Clean it thoroughly, and when necessary, use a soft brush, an airbrush, or canned air to remove any dust from hard-to-reach spots. Measure and inspect the mold surface carefully: is the finish silk smooth? Are there any visible toolmarks on horizontal surfaces? What about vertical ones? If you notice any unexpected dings or other issues, stop now and do some extra testing, perhaps using an even simpler model (something that takes under a minute to cut is a good idea). Check if the results gets better if you attach the workpiece more robustly? If RPM or feed speed is lowered? If CAM margins are tweaked? The importance of these factors is often machine-, material-, and tool-specific - and this is your best chance to figure it out. If you ignore any potential problems and move on to more complex molds, you will end up with simply too many variables to sort this out later on.

If everything looks as expected, apply a release agent to the mold next, as discussed in the previous part of the guide. For preparing silicone molds, one light round with Stoner A324 or wax seems to be enough, and even if you do not use any demolding agents, you should be fine in most cases; for polyurethane molds, I strongly recommend applying one or two coats of wax, followed by A324 - otherwise, the mold and the molded part may fuse together and form a nice, decorative paperweight.

Applying the agent is pretty simple: distribute it with a brush or spray it on, taking care to cover all the surfaces from all angles. Let it dry (this can be accelerated with compressed air, heat, or vacuum), then proceed with subsequent applications if necessary. Also note that waxes and several other solid releases can be buffed out to a shine with a soft brush or a piece of cloth, so be sure to try it out.

Next, you need to prepare and mix an appropriate amount of resin, taking care to avoid cross-contamination of the components. Your CAD application should have a tool to estimate the volume of your model; subtract this figure from the volume of a solid box with the same outer dimensions as the (virtual) workpiece to get the volume of resin needed, multiply it by specific gravity of the rubber (usually around 1.1 g/cm), and add about 30% as a safety margin. This last part is important: some material will stay in the mixing cup, some will probably spill outside the mold - especially during degassing - and some extra is required simply so that the the mold can be gradually covered without trapping any air underneath. With the volume calculated beforehand, prepare your workplace, measure the appropriate amount of the first component into a cup able to hold at least 3 times that volume, start a kitchen timer, add the second component, and mix thoroughly for about 2 minutes with a tongue depressor, a chopstick, or other durable tool, scraping sides and bottom of the container regularly, and changing directions and angles every now and then.

It is best to place the mixing container on a scale and weigh the components directly as you pour them; pre-weighing the desired amount in a syringe is also OK, but doing so in a separate cup is too error-prone: several mililiters will always cling to the walls, depending on the shape of the container and the viscosity of the resin, and it's very difficult to account for this.

After mixing, degass the contents of the cup for about 3-4 minutes, watching the process to make sure the material is not overflowing (release vacuum several times in a row if it is; depending on the geometry of your vacuum chamber, shaking or spinning it carefully may help, too). For some resins, particularly polyurethanes, you might find that results are better if you also degass the components individually before mixing; but in many cases, a single round should be enough.

If you do not have a degassing rig, obviously skip some of the above; in this case, you will need to be extra careful not to mix the resin too virogoursly, as to avoid introducing bubbles. If this proves to be difficult, here's a cool trick: put the silicone in the fridge before and after mixing for 20 minutes or so; as the temperature decreases, viscosity increases sort-of linearly, but cure speed drops exponentially - allowing more time for bubbles to rise to the surface of the cup. Never cool down polyurethane resins, though: components may crystallize and alter the chemistry - and even if this does not happen, condensing water will turn the resin into a polyurethane foam later on.

In any case - let's assume you have the resin mixed and free of bubbles at this point. You can put the mold itself inside the vacuum chamber, pour about 1/2 of the required volume evenly over the entire geometry, put the mold on a sheet of aluminum foil, and wrap the foil to form a makeshift flange around the cavity - so that when the liquid rises under vacuum, most of it stays where it's supposed to be. Next, put all this under vacuum for about 2 minutes, and slowly release the valve at that point (you do not want the remaining bubbles to punctured and then filled with the air rushing in - you want them to peacefully collapse, instead - and this means giving it a minute or two). When done, put the mold on a flat surface on your workbench, and pour in the remaining resin.

When working with transparent silicones, you can now give it about 1-2 minutes for any residual air bubbles to rise or collapse back into the solution, while you suck out any larger pockets of trapped air (should there be any) using a syringe and a stub length needle (paying special attention to any tight spots in the mold - use a flashlight to inspect them if visibility is poor).

If you do not have a degassing chamber, or if the mold is too big to put there, the procedure is again slightly different: gently and slowly pour the resin in a single, deep spot in the mold, trying not to trap too many bubbles in the process; inevitably, you will end up with some, so force them out with a syringe filled with some extra resin. Non-transparent silicones are more difficult here, because you will need to learn where the bubbles are likely to be stuck and pinpoint them blindly - it's not impossible, but you need to learn this by trial and error.

Well, that's it! Cover the mold with a piece of plastic (preferably also treated with mold release), put something flat and heavy on top of it, then stop the whole thing from sliding off by resting something by the edges of the cover. Covering the mold to avoid air entrapment is a bit of an art form by itself, but after several hits and misses, you will get it right: the trick to be gentle, slow, and to start at one of the edges instead of just dropping it centrally. You also need to make sure that the cover is not electrostatically charged after wiping it and applying the mold release earlier on - touch it to the tin foil flange around the mold, or somesuch.

When done, wait several hours until the leftover resin in the mixing cup gets safe to touch, then move the mold to the oven set to 35° C for 1-2 hours. Silicone molds can be removed from the master at this point, and laid flat first at 50°, then at 80-100° C for the final cure (1 hour for each step); for polyurethane rubber molds, see the curing tips in the next section instead.

Pressure pot may be used while the resin is curing, too, but unless you are dealing with a particularly tricky mold or a particularly high-viscosity resin, it's usually not necessary.

With silicones, about the only problem you can run into is just poor cure, with the surface of the mold being tacky, or - worst case - the entire mold being soft and gummy. These problems can be caused by insufficient mixing (especially if it occurs in strips or patches), incorrect mixing ratios (polyaddition silicones are very sensitive to this - measure carefully), or cure inhibition due to contact with incompatible chemicals (especially liquid dyes, certain types of rubber, and foodstuffs). If this happens, to rescue the master, first put it at 50-60° C for a while, to see if the remaining resin is inclined to cure. If not, wipe as much of it as possible, then use naphtha to dissolve the rest.

Another less likely problem is that some liquid additives may also cause premature cure of the material, rendering it thixotropic and impossible to pour into a mold; but this will be obvious early on. All in all, the number of problems you are likely to run into is limited... and if things go south, again, don't hesitate to ping me.

4.3. Making polyurethane castings

In principle, the process of making polyurethane parts is roughly the same as working with silicone: you start with a negative rubber mold, treat it with an appropriate mold release, mix and pour in a resin, and then cover it with non-stick plastic to cure. Polyurethane resins come with a couple of extra gotchas, however.

First of all, most ABS-like resins, and transparent ones in particular, are highly moisture sensitive - so you need to make sure that the mold is perfectly dry, and avoid touching it with bare hands. The best way to avoid trouble is to place silicone molds for 20 minutes at 120-150° C, then remove them while wearing PVC or latex gloves; silicone has a fairly poor thermal conductivity, so this should be reasonably safe - but use thicker gloves or a tool if in doubt, as there are no refunds in case of horrible, disfiguring burns. Next, apply mold release to a still hot mold; and then cool it down quickly to room temperature using a fan (do not put them in the fridge and do not use freeze sprays, as this promotes condensation). Five extra minutes under vacuum to be safe - and at this point, you should be able to get a high-quality polyurethane part from that mold.

Now, molds made out of polyurethane rubber can't be baked the same way - but placing them at 60° C for 50 minutes, then allowing them to cool down for another 20 minutes before removing them from the oven and putting under vacuum for a while, should work pretty well.

Mixing the resin also requires clean, dry cups and mixing tools; treating them with a small amount of mold release makes it easier to clean up and reuse the equipment, so this is a good practice. Be sure to reuse the mixing sticks, too: once they get a coat of cured resin, they become more durable and less likely to absorb moisture or other contaminants. Oh, and before measuring the resin, be sure to thoroughly stir each component in its original container (most easily, by simply shaking and inverting it - but make sure it's closed tightly, and exercise caution anyway): the additives present in some compositions tend to settle out of the solution in storage. After pouring the resin, sealing the container with inert gas is a good idea; leaving it open, waiting to be knocked over, is a pretty bad one.

If you want to add color, dry pigments usually need to be dispersed in a small amount of isocyanate or some plasticizer first (0.5 to 1 g is a good starting point), and only then added to the remainder of the resin; caking can be a problem otherwise. Pigments and fillers also tend to absorb moisture, so baking them alongside with the mold is not a bad plan - in fact, certain types of fillers, such as pecan flour or Kevlar flock, simply must be subjected to this treatment.

A drop of acetone or ethyl acetate may be added to the resin while mixing to aid degassing, especially in higher viscosity compositions with short pot life, but is not always necessary. For non-transparent resins, several grams of zeolite, pre-baked at 150-200° C shortly before the casting process, may help with humidity-related issues, too.

The pot life of your resin is probably between 5 and 20 minutes, and you need to be done in about 60% of that time or so (the exact figure depends on the cure profile of the resin). This isn't much - but on the upside, the viscosity of a typical polyurethane resin should be much lower than that of the silicone, so it can be mixed, degassed, and poured more quickly. You will need to test the limits, and sort out the workflow, with some trial and error, though: even something as trivial as making sure you have a place to put away dirty syringes, or can grab a paper towel with one hand, will have a tremendous impact when every minute counts.

The idea is to mix the components for about 1 minute or so (very thoroughly, changing directions and scraping sides of the container several times over), degass the resin in the mixing cup for 30 seconds or so (until it collapses), pour part of the resin into the mold (use a syringe to apply the resin to a more complex shape if you don't have a vacuum rig), degass the mold again for a brief moment, take the mold out and lay it on flat surface, then pour the remaining resin, making sure there is some excess to form a convex meniscus and push away any residual bubbles in high-viscosity resins. If too many bubbles are still present, using a syringe to push them out is a good idea, too. When you are done, simply cover the result with sheet plastic (necessarily treated with mold release) and apply some weight on top (100 - 200 g is optimal - you do not want to squish the mold).

You should be aware that some polyurethanes are a bit tricky to mix, as they undergo a phase change: the components may initially form a milky dispersion, and only as the reaction progresses (30-60 seconds maybe), form a homogenous solution. If mixing is stopped earlier, this may have adverse effects on the final part. Experiment a bit; if your resin exhibits this property and has a pot life that makes 2 minutes of mixing impossible, consider getting a magnetic stirrer and continuing the mixing process under vacuum, as discussed in the previous part of the guide. You can then put the whole thing in a pressure pot, where it needs to stay until the resin is reasonably hard.

The optimal curing schedule for polyurethane resins is usually roughly similar to that for silicones, but always check the datasheet: for example, polyurethane rubbers often require lower post-cure temperatures than rigid plastics; also, some rigid plastics become significantly tougher if post-cured at a high temperature (100° C or so), while some simply get more brittle as additional cross-links are formed between the polymer chains. The usual accelerated cure protocol may be to wait 2-3 hours for the resin to harden (this will take much longer in cold weather), place the mold at 30-40° C for the next two hours, allow it to cool down after that; demold components, place them in the oven, set the temperature to 50-60° C for 30-60 minutes, and 80-100° C for 2-4 hours.

Before handling polyurethane parts after heat-accelerated cure, always allow them to cool down slowly: like almost all plastics, but unlike silicones, they are fairly soft at high temperatures. This not only means they need to be handled with care to prevent simple mechanical damage, but also that creating a significant temperature gradient may cause warping due to uneven thermal expansion in this vulnerable state.

The likelihood of trouble when casting polyurethanes is quite a bit higher than when dealing with silicones, and chances are, your first casting will not be perfectly right; don't get discouraged - because of the shorter working time and greater sensitivity to contaminants, the process takes some skill to carry out flawlessly; and even as you get familiar with all this, you should probably expect a 5% rejection rate for molded parts. Air bubbles are one of the most significant issues. While an occassional small bubble of air does not necessarily ruin a large part, an unfortunately positioned one may critically weaken a tiny gearwheel, or be an aesthetic blemish in a transparent component.

In industrial settings, bubbles are commonly avoided simply by applying a significant pressure to the curing system, thus forcing any voids to collapse, and gases to dissolve back into the resin - but as discussed earlier, getting a pressure pot is a complex decision. If you prefer not to, your best bet is to learn about common failure modes and try to avoid them, instead. In general, bubbles can be divided into several classes: Other issues you may run into include cure inhibition when exposed to certain mold materials (uncommon, but affecting some resins such as Innovative Polymers OC-50xx, which happens to be sensitive to platinum-cured silicones), parts too soft or too brittle after full cure (bad mixing proportions - forgetting to tare the scale is a common culprit; bad cure schedule may also be to blame), patches of uncured material or varied color (insufficient mixing), small clumps of pigments visible (pigment not dispersed properly), pigment settling out of the solution (mostly a problem with powdered metals, glass, glitter, and other large and heavy additives - using more finely powdered dyes or higher viscosity resins usually helps), or pigment changing its color after mixing (chemical incompatibility - tough luck). I might have missed several corner cases; as usual, if you stumble upon something that seems hard to explain, feel free to drop me a mail, I will be thrilled to help.

Still, assuming things worked out as expected, you now have a cheesy heart-shaped pendant in your hand; keep it to as a reminder of how it all started :-) Then, make a couple more and test their properties: see what happens if you hit one with a hammer, drill a hole through another, sand or polish their surface? Test any other resins you might have, and examine their properties. You may also want to play with controlled errors - try to use a ratio 30% off the recommended figures in one test; add a drop of water with a detergent in another; how much tolerance does this resin have? What are the usual symptoms of trouble? The more you know about this before embarking more serious projects, the better.

5. Assorted mechanical engineering notes

5.1. More complex mold types

Several fundamental problems in mold design were discussed in section 3.1.7: say, the need to ensure minimal bottom thickness, reinforce thin walls, reduce length of thin protrusions, or add pull tabs for deep geometries. This is essentially all you need to know for flat, one-side molds - but there are some cases where more innovative approaches are necessary:

5.2. Part geometry tips

Figuring out how to design physically possible, durable parts, is a subject where it's nearly impossible to come up with an exhaustive set of simple rules; you will have to observe the world around you and experiment a lot. That said, here's a collection of random notes: Many other useful part design rules are listed on this page; while some of them only apply to injection molding, it's still an interesting read.

5.3. Desiging spur gears

Straight spur gears are the most rudimentary and the most common type of a gear - transferring rotation between parallel axes using symmetrical, uniformly sized and spaced teeth oriented on a circle. The most important features of a properly designed gear is that it transfers torque uniformly using rolling motion (see animation) to minimize friction - and getting this right is a bit tricky, so follow this section closely.

Begin by deciding how many teeth your gear needs to have, and how thick each tooth needs to be. For the gear construction method outlined here, you can go for almost any tooth count - at least 10 is recommended for optimal strength, but lower values are definitely possible. Tooth thickness is mostly limited by the cutting tool available (as the tool will needs to cut matching slots for meshing gears). For example, for a 0.4 mm cutter, you probably want to keep tooth size in the 0.5 - 0.7 mm range; it must be somewhat higher than the diameter of the tool.

Every normal spur gear is described in terms of a pitch circle - a nominal circle at which two meshing gears should be touching, and at which the thickness of every tooth and the corresponding slot is exactly the same (illustration). For any given tooth count and tooth size, you can arrive at the diameter of this circle by calculating tooth_count * tooth_size * 2 / π. The metric system is further based on the concept of a "module" - defined as pitch_diameter / tooth_count (and therefore equal to tooth_size * 2 / π) - as a different, less intuitive, but much easier to measure way to describe any given gear.

As hinted, meshing gears should be generally designed so that their pitch circles touch with each other. Once you have calculated and drawn the pitch circle itself, the next step is to pick a yet another defining property for your gear, called the "pressure angle"; this is the angle at which the torque is to be transferred between mating gears, shown as a solid red line in the animation above. Gears designed for higher pressure angles will have thicker, more robust teeth - but will also also generate stronger axial forces, will be more noisy, and if given the opportunity, more prone to slippage. High pressure angles increase the curvature of tooth profile, making it more pointy for low tooth counts, and requiring a smaller cutter under the pitch circle in high tooth count gears. My recommendation would be to stick to 12-18° at torques up to 2,000 g*cm or so; and use 20-25° past that point. The standardized values used in most of the commercially available gears are 14.5°, 20°, and 25° - but there is nothing special about these numbers as such.

Now, moving on! Let's draw a line tangent to the pitch circle, and then rotate it by the value of the selected pressure angle, in relation to the point where it touches the wheel; then, draw a second circle with the same center as the pitch circle, but tangent to the rotated line (this is marked with a dashed red line in the animation). This new circle is known as the "base circle"; if you do not want to bother with constructive geometry, the diameter of the base circle is simply pitch_diameter * cos (pressure_angle). The significance of it is that no power transfer is supposed to occur below this circle; and that tooth profile above the base circle is an involute curve originating from its surface. Involute is an interesting curve best visualized by imagining having wrapped a piece of string around the circle, attaching a pencil at the end, and then moving the pencil away from the circle. As it moves, and is pulled by the string, it draws a curve like this.

The parametrization of this curve is x = r * cos(t) + r * t * sin(t), y = r * sin(t) - r * t * cos(t), but in most CAD programs, it is actually easier to approximate it using a simple iterative algorithm. Assuming that the pitch circle is at (0,0), it goes thus:

  1. Let offset = 0,
  2. Draw a point at x = offset, y = r,
  3. Rotate point around (0,0) by 360 / (base_diameter * π) * offset degrees to the left,
  4. Increase offset by base_diameter * 0.01 (the constant defines curve approximation accuracy, and can be changed),
  5. Go to 3 until the desired length of a curve is created.
  6. Select all created points, fit a curve through them with the desired accuracy.
This picture illustrates the result.

With the involute constructed, it is now time to decide what the tooth height should be. To ensure good meshing and tooth strength, most sources recommend making it equal to roughly the module (or, 2 * tooth_size / π); making the tooth shorter - down to 50% of the module or so - is sometimes beneficial, however, as it may help you avoid pointed tooth profile in very small gears, or insufficient cutter clearances in large ones; there is no significant harm in generating stub gears with only 70-80% the nominal height if necessary.

Once you settle for a particular height, draw an addendum circle with a diameter of pitch_diameter + tooth_height * 1.98, and a dedendum circle with a diameter of pitch_diameter - tooth_height * 2.02 or so. The addendum circle marks the height limit for every gear; the dedendum one tells you how far every slot between teeth needs to extend to accommodate a meshing tooth; the clearance created by the dedendum needs to be slightly larger than the addendum in standard gears, but the adjustment values mentioned here are arbitrary.

When you have all these circles and an involute curve drawn, calculate the angle corresponding to a distance of 1/2 tooth width along the pitch circle: 360 / (pitch_diameter * π) * tooth_size / 2. Next, draw a vertical line extending from the center of the circle to the outside, and rotate it by this angle. Rotate the involute curve so that it passes through the intersection of this line and the pitch circle - and mirror it in the Y axis. You should have much of the tooth profile on the screen. The remaining part down to the dedendum line can be drawn by extending a straight line to the center of the circle. You can then use the trim operator to trim the parts extending under the dedendum, over the addendum, and trim the addendum circle itself, to form a complete tooth profile; and join all the resulting segments if necessary. Voila?

Well, almost - this is where most of the guides you can find on the Internet end, but it's not exactly that simple! This approach only works if the total number of teeth is higher than 2 * tooth_height_factor / sin(pressure_angle)²; for full length gears (factor 1.0), this is 30 teeth at 15°, 17 at 20°, and 12 at 25°; for stub length gears with a factor of 0.7, the limits are 21, 12, and 8, accordingly. If you have fewer teeth, the tips of each tooth begin to interfere with the profile of the slot as they move in or out - especially when a significant difference in tooth count, and therefore the curvature of each gear, exists; this drawing illustrates the problem pretty well. An extreme case of differences in tooth count is meshing with a rack - which can be considered a gear with an infinite diameter with a base circle under the dedendum circle, and a perfectly straight involute with an angle matching the pressure angle (see example). This image shows various stage of a rack tooth entering and exiting a gear, as would appear to a camera mounted on the gear itself, and fixed on a particular tooth; the concave area at the bottom is the undercut not accounted for by the involute curve, but necessary to properly mesh in this situation.

So, what do we do? Generating the undercut curve is actually fairly simple - the algorithm amounts to drawing a single, centered rack tooth engaged with the gear, then making copies of this tooth at linear offsets and rotating them by an angle corresponding to a matching distance on the pitch circle: a method very similar to how the involute itself is approximated.

All right, all this probably sounds ridiculously confusing - and rightly so. While completing this exercise manually a couple of times is a very valuable lesson, I have a simple shell script that implements almost all of the calculations and construction steps for you in Rhino, so that you do not have to spend an hour on every single gear: click here to download it (to run the script, you need to have Cygwin installed). The script takes tooth count, pressure angle, module, and addendum as parameters in the command line, and generates a sequence of commands that should be pasted or loaded into the application. The following steps still need to be carried out manually later on:

  1. Rotating the involute curve - the one pointing right - around (0,0,0) from where it intersects the pitch circle (marked in red) to the intersection of the right tooth width guide (black line). Be sure to use "int" object snaps for this.
  2. Mirroring the involute curve and the undercut curve (pointing left) around in the Z axis, drawing a circle with a diameter of tool_diameter + 0.05 mm, and dragging that circle around to sure that the tool will be able to enter the slot; minor adjustments to the undercut curve are OK, but if there is a significant clearance problem, a different geometry should be attempted (stub length, smaller pressure angle, larger module).
  3. Removing the mirrored copy, trimming and joining the involute and undercut curves as necessary, and then rotating them around (0,0,0) from their current location on the pitch circle to the left tooth guide.
  4. Mirroring the curve again, and trimming it against the addendum circle, perhaps also dedendum circle, to create a complete tooth profile,
  5. Creating a 360° polar array of tooth_count tooth profiles, centered around (0,0,0), trimming and joining them as necessary, and then offseting the entire gearwheel by 0.001 mm to the inside to minimize interference.
  6. Cleaning up all the guides and helper circles except for the pitch circle.
Phew, that's it for real!

Oh, here's one more thing: lowering tooth height, increasing module, or changing pressure angle are not the only tools to generate a machinable geometry when the standard output is not satisfactory: another trick is dubbed "profile shift". This last approach involves using a larger addendum circle, and a larger dedendum circle, on the pinion gear (the smaller of the two meshing gears); and doing the opposite on the larger one. My script lets you do this by varying the own_add and mating_add parameters in the command line: for example, specify own_add = 0.5, mating_add = 0.3 on the pinion gear, and own_add = 0.3, mating_add 0.5 on the other one, and compare the result to the default output from the script.

Spur gear with a given tooth height, width (module), pressure angle, and profile shift, will mesh properly with any other gear matching these parameters, regardless of the number of teeth. So, since the process of constructing gears tends to be time-consuming, consider creating libraries of common gear curves for easy reuse in other projects.

5.4. Other types of gears

There are three other types of gears that you should know about. Firstly, we have helical gears, which are essentially spur gears - but (literally) with a twist. In these gears, the top profile is not simply extruded straight down, but twisted slightly - similar to what you can see here. Gears constructed this engage more gradually when rotating, resulting in smoother and quieter operation - but also produce some extra axial force pushing the two gears away from each other (similar to the action of a screw). To solve this issue, we also have herringbone gears, which essentially consist of two mirrored helical gears joined together; in this arrangement, the net force along the axis of rotation is zero.

Since both these gear types are largely impossible to machine without employing a rotary axis, and can be easily derived from spur gears, I will not be giving them too much attention; plastic spur gears are very quiet themselves when designed and lubricated properly, so there is seldom a need for these alternatives in normal applications.

Worm gears are another interesting type of a gear, this time relying on a rack tooth profile revolved around a spiral path (photo). Their primary benefit is a very high reduction ratio (one rotation of the shaft translates to advancing one teeth on the mating gear). Their primary disadvantage is that there is a fair amount of friction involved, resulting in poor efficiency (generally under 50%). Again, both of the mating gears need to be machined on a rotary axis (the mating gear is essentially just a low angle helical one); if need to make one of these, and have a difficulty figuring the geometry out, drop me a mail.

Lastly, we have bevel gears: a very useful device for changing the rotation axis (picture). These gears are constructed by first drawing two pitch circles in different planes, touching each other at the desired meshing angle (usually 90°), then finding the point where the axes of these circles, extruded perpendicular to their construction planes, intersect. For each of the wheels, a single tooth profile is drawn the usual way, and then rotated so that the plane of the tooth is perpendicular to a line extending from the aforementioned axis intersection point. The profile is then copied and scaled alongside this line fromt he intersection point, and the resulting two curves are lofted - producing a geometry like this. Unlike most other gears, any given bevel gear mates correctly only with its original counterpart.

5.5. Gearboxes and transmissions

The most useful type of a gearbox for robot designs would be the one constructed to reduce or increase RPM of a motor; this arrangement usually looks like this: a small gear turns a larger one, in turn permanently attached to a smaller gear, which then powers the next stage; more powerful gearboxes usually combine gears with progressively higher pressure angles, so that the initial, fast-rotating stages are quiet and very efficient, while the slowly turning output gears do not break too easily.

In settings where horizontal space is at a premium, several independently rotating pairs of gears may be stacked on two nearby axles instead, transferring rotation back and forth (as seen here or here). A flat arrangement with one axle per gear in alternating orientations is also possible (image) - but requires at least three different gear sizes to be used to avoid interference, whereas the stacked design only requires two.

Planetary gears are another interesting, space-efficient approach; the most significant benefit of this spiffy design is that it's very compact, self-contained, and capable of transferring more torque due to multiple meshing points in every stage. Downsides include the need for extra complexity to actually constrain and interface every stage (example), requiring you to spend long hours on every individual case. The only new thing that appears in the planetary gearbox are the internal teeth on the ring gear: this is constructed by subtracting the addendum, and adding the dedendum, rather than the other way round; and then generating the involute curve under, not above, the pitch circle - and creating the undercut curve using an appropriately rotated rack.

Certain specialized types of transmission rely on racks, belts, or chains instead of round gears. Racks should be self-explanatory, with straight teeth at an angle equal to the pressure angle; making your own belts is relatively challenging, because the belt needs to be very flexible, but not stretchy. This is usually accomplished with the use of a polyurethane rubber backed with aramid cloth, and takes some serious trial and error to get right. Since there is no rolling action, belt tooth profile can be pretty much arbitrary (examples).

5.6. Drive systems

Probably the last area where a quick summary of the options may be useful is the subject of picking the right drive mechanism for the first robot. The choices essentially amount to:

6. Final words

Well, that's it. Hopefully, this can get you started - and excited about CNC milling, and robotics in general; if you are looking to toy with specific designs now, I recommend heading over to Society of Robots; you can also check out this project of mine.

If you have any questions, concerns, corrections, praise, or chocolate, please ping me at lcamtuf@coredump.cx. It would be cool to know that this guide helped at least one person, in any way :-)

Your lucky number: 8456251